A templatized class for computing the KDE naively. More...
Public Member Functions | |
void | Compute () |
Compute kernel density estimates naively after intialization. | |
void | Compute (Vector *results) |
Compute kernel density estimates naively after intialization. | |
void | ComputeMaximumRelativeError (const Vector &density_estimates) |
Computes the maximum relative error for the approximated density estimates. | |
void | get_density_estimates (Vector *results) |
Get the density estimate. | |
void | Init (Matrix &qset, Matrix &rset, Matrix &reference_weights, struct datanode *module_in) |
Initialize the naive KDE algorithm object with the query and the reference datasets and the parameter list. | |
void | Init (Matrix &qset, Matrix &rset, struct datanode *module_in) |
NaiveKde () | |
Constructor - does not do anything. | |
void | PrintDebug () |
Output KDE results to a stream. | |
~NaiveKde () | |
Destructor - does not do anything. |
A templatized class for computing the KDE naively.
This class is only intended to compute once per instantiation.
Example use:
NaiveKde naive_kde; struct datanode* kde_module; Vector results; kde_module = fx_submodule(NULL, "kde", "kde_module"); naive_kde.Init(queries, references, reference_weights, kde_module); // Important to make sure that you don't call Init on results! naive_kde.Compute(&results);
Definition at line 64 of file naive_kde.h.
Constructor - does not do anything.
Definition at line 98 of file naive_kde.h.
Destructor - does not do anything.
Definition at line 102 of file naive_kde.h.
void NaiveKde< TKernel >::Compute | ( | ) | [inline] |
Compute kernel density estimates naively after intialization.
Definition at line 156 of file naive_kde.h.
References la::DistanceSqEuclidean(), fx_timer_start(), and fx_timer_stop().
Compute kernel density estimates naively after intialization.
results | An uninitialized vector which will be initialized with the computed density estimates. |
Definition at line 127 of file naive_kde.h.
References la::DistanceSqEuclidean(), fx_timer_start(), fx_timer_stop(), and NaiveKde< TKernel >::get_density_estimates().
Referenced by main().
void NaiveKde< TKernel >::ComputeMaximumRelativeError | ( | const Vector & | density_estimates | ) | [inline] |
Computes the maximum relative error for the approximated density estimates.
The maximum relative error is output after the program finishes the run under /maximum_relative_error_for_fast_KDE/
density_estimates | The vector holding approximated density estimates. |
Definition at line 297 of file naive_kde.h.
References fx_format_result(), fx_param_double(), and GenVector< T >::length().
Referenced by main().
void NaiveKde< TKernel >::get_density_estimates | ( | Vector * | results | ) | [inline] |
Get the density estimate.
results | An uninitialized vector which will be initialized with the computed density estimates. |
Definition at line 112 of file naive_kde.h.
References GenVector< T >::Init(), and GenVector< T >::length().
Referenced by NaiveKde< TKernel >::Compute().
void NaiveKde< TKernel >::Init | ( | Matrix & | qset, | |
Matrix & | rset, | |||
Matrix & | reference_weights, | |||
struct datanode * | module_in | |||
) | [inline] |
Initialize the naive KDE algorithm object with the query and the reference datasets and the parameter list.
qset | The column-oriented query dataset. | |
rset | The column-oriented reference dataset. | |
module_in | The module holding the parameters. |
Definition at line 196 of file naive_kde.h.
References AllkNN::ComputeNeighbors(), fx_param_double_req(), fx_param_int_req(), fx_param_str(), fx_root, fx_timer_start(), fx_timer_stop(), GenVector< T >::get(), AllkNN::Init(), ArrayList< TElem >::Init(), GenVector< T >::Init(), GenVector< T >::length(), GenVector< T >::SetZero(), and ArrayList< TElem >::size().
void NaiveKde< TKernel >::PrintDebug | ( | ) | [inline] |
Output KDE results to a stream.
If the user provided "--naive_kde_output=" argument, then the output will be directed to a file whose name is provided after the equality sign. Otherwise, it will be provided to the screen.
Definition at line 269 of file naive_kde.h.
References fx_param_str().
Referenced by main().