Go to the documentation of this file.00001 #ifndef rrel_kernel_density_obj_h_
00002 #define rrel_kernel_density_obj_h_
00003
00004
00005
00006
00007
00008
00009 #include <rrel/rrel_objective.h>
00010
00011 enum rrel_kernel_scale_type { RREL_KERNEL_MAD, RREL_KERNEL_PRIOR, RREL_KERNEL_MUSE };
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 class rrel_kernel_density_obj : public rrel_objective
00028 {
00029 public:
00030
00031 rrel_kernel_density_obj(rrel_kernel_scale_type scale_type=RREL_KERNEL_MAD);
00032
00033
00034 virtual ~rrel_kernel_density_obj() {}
00035
00036
00037
00038
00039 virtual double fcn( vect_const_iter res_begin, vect_const_iter res_end,
00040 vect_const_iter scale_begin,
00041 vnl_vector<double>* param_vector=0 ) const;
00042
00043
00044
00045
00046 virtual double fcn( vect_const_iter res_begin, vect_const_iter res_end,
00047 double prior_scale = 0,
00048 vnl_vector<double>* = 0) const;
00049
00050
00051
00052
00053
00054 virtual void set_scale_type( rrel_kernel_scale_type t = RREL_KERNEL_MAD )
00055 { scale_type_ = t; }
00056
00057
00058
00059 virtual bool requires_prior_scale() const
00060 { return scale_type_ == RREL_KERNEL_PRIOR; }
00061
00062
00063 void fix_x() { fix_x_ = true; }
00064
00065
00066
00067 double best_x( vect_const_iter res_begin, vect_const_iter res_end,
00068 double scale = 0 ) const;
00069 private:
00070
00071
00072 double bandwidth(vect_const_iter res_begin, vect_const_iter res_end,
00073 double prior_scale) const;
00074
00075
00076 double kernel_density(vect_const_iter res_begin, vect_const_iter res_end,
00077 double x, double h) const;
00078
00079
00080 double kernel_function(double u) const;
00081
00082 rrel_kernel_scale_type scale_type_;
00083
00084 bool fix_x_;
00085 };
00086
00087 #endif