STK++ 0.9.13
|
A LocalVariance is an implementation of the abstract ILinearReduct
class.
More...
#include <STK_LocalVariance.h>
Public Types | |
typedef hidden::Traits< Array >::Row | RowVector |
typedef ILinearReduct< Array, VectorX > | Base |
![]() | |
typedef IReducer< Array, VectorX > | Base |
Public Member Functions | |
LocalVariance (Array const *p_data, Reduct::TypeGraph type=Reduct::distance_, int nbNeighbor=1) | |
Constructor. | |
LocalVariance (Array const &data, Reduct::TypeGraph type=Reduct::distance_, int nbNeighbor=1) | |
Constructor. | |
LocalVariance (LocalVariance const &reducer) | |
copy Constructor. | |
virtual LocalVariance * | clone () const |
clone pattern | |
virtual | ~LocalVariance () |
Destructor. | |
int | nbNeighbor () const |
ArrayXXi const & | pred () const |
ArraySquareX const & | covariance () const |
ArraySquareX const & | localCovariance () const |
![]() | |
ILinearReduct () | |
Default Constructor. | |
ILinearReduct (Array const *p_data) | |
Constructor. | |
ILinearReduct (Array const &data) | |
Constructor. | |
ILinearReduct (ILinearReduct const &reducer) | |
copy Constructor. | |
virtual | ~ILinearReduct () |
virtual destructor | |
VectorX const & | criteriaValues () const |
Array const & | axis () const |
virtual bool | run () |
Compute the projection matrix axis_ by maximizing the criteria and project the data set in order to obtain p_projected_ . | |
virtual bool | run (VectorX const &weights) |
Compute the projection matrix set by maximizing the weighted criteria and project the data set in order to obtain p_projected_ . | |
![]() | |
virtual | ~IReducer () |
virtual destructor. | |
int | dim () const |
get the number of dimension. | |
Array * | p_reduced () const |
get a pointer on the reduced data set | |
void | setDimension (const int &dim) |
set the number of dimension. | |
void | clear () |
clear allocated memory | |
![]() | |
Array const * | p_data () const |
get the data set | |
virtual void | setData (Array const *p_data) |
Set the data set. | |
virtual void | setData (Array const &data) |
Set the data set. | |
![]() | |
String const & | error () const |
get the last error message. | |
Protected Member Functions | |
virtual void | update () |
Compute the proximity graph if the data set is modified. | |
virtual void | maximizeStep () |
Compute the axis by maximizing the ratio of the local variance on the total variance of the data set. | |
virtual void | maximizeStep (VectorX const &weights) |
Compute the axis by maximizing the ratio of the weighted local variance on the weighted total variance of the data set. | |
void | prim () |
compute the minimal spanning tree | |
void | minimalDistance () |
compute the minimal distance graph | |
void | computeCovarianceMatrices () |
compute the covariances matrices of the data set | |
void | computeCovarianceMatrices (VectorX const &weights) |
compute the weighted covariances matrices of the data set | |
![]() | |
IReducer () | |
Default constructor. | |
IReducer (Array const *p_data) | |
Constructor with a pointer on the constant data set. | |
IReducer (Array const &data) | |
Constructor with a constant reference on the data set. | |
IReducer (IReducer const &reducer) | |
Copy constructor. | |
![]() | |
IRunnerUnsupervised () | |
default constructor. | |
IRunnerUnsupervised (Array const *const p_data) | |
constructor with a pointer on the constant data set | |
IRunnerUnsupervised (Array const &data) | |
constructor with a constant reference on the data set | |
IRunnerUnsupervised (IRunnerUnsupervised const &runner) | |
copy constructor | |
~IRunnerUnsupervised () | |
destructor | |
![]() | |
IRunnerBase () | |
default constructor | |
IRunnerBase (IRunnerBase const &runner) | |
copy constructor | |
virtual | ~IRunnerBase () |
destructor | |
Protected Attributes | |
Reduct::TypeGraph | type_ |
number of neighbors | |
int | nbNeighbor_ |
number of neighbors | |
ArrayXXi | neighbors_ |
Predecessor array : store the spanning tree or the minimal distance to the neighbors. | |
ArrayXX | dist_ |
distance matrix : store the minimal distance to the neighbors | |
ArraySquareX | localCovariance_ |
the local covariance Array | |
ArraySquareX | covariance_ |
the covariance Array | |
![]() | |
VectorX | idx_values_ |
The values of the index for each axis. | |
Array | axis_ |
The computed axis. | |
![]() | |
int | dim_ |
dimension of the reduced data set | |
Array * | p_reduced_ |
The reduced data set. | |
![]() | |
Array const * | p_data_ |
A pointer on the original data set. | |
![]() | |
String | msg_error_ |
String with the last error message. | |
bool | hasRun_ |
true if run has been used, false otherwise | |
Private Member Functions | |
void | computeAxis () |
compute the axis using the first eigenvectors of the matrix of covariance and local covariance | |
LocalVariance (Reduct::TypeGraph type=Reduct::distance_, int nbNeighbor=1) | |
Default constructor. | |
Additional Inherited Members | |
![]() | |
Array * | p_reduced_ |
The reduced data set. | |
![]() | |
typedef IRunnerUnsupervised< Array, Weights > | Runner |
A LocalVariance is an implementation of the abstract ILinearReduct
class.
A LocalVariance is an Index which maximize the projected local variance of the data set. The class can use the algorithm of Prim or the minimal distance in order to compute the proximity graph defining the local variance.
This class derive from ILinearReduct which derive itself from IRunnerUnsupervised. The run()
and run(weights)
methods have been implemented in the ILinearReduct interface using the pure virtual methods maximizeStep()
and MaximizeCriteria(weights)
.
Definition at line 62 of file STK_LocalVariance.h.
typedef ILinearReduct<Array, VectorX> STK::LocalVariance< Array >::Base |
Definition at line 66 of file STK_LocalVariance.h.
typedef hidden::Traits<Array>::Row STK::LocalVariance< Array >::RowVector |
Definition at line 65 of file STK_LocalVariance.h.
STK::LocalVariance< Array >::LocalVariance | ( | Array const * | p_data, |
Reduct::TypeGraph | type = Reduct::distance_ , |
||
int | nbNeighbor = 1 |
||
) |
Constructor.
the TypeGraph and the number of neighbors are given by the user and cannot modified.
p_data | pointyer on the data set to process |
type | type of proximity graph to build |
nbNeighbor | number of neighbors to use in the proximity graph |
Definition at line 165 of file STK_LocalVariance.h.
References STK::LocalVariance< Array >::dist_, STK::Reduct::distance_, STK::LocalVariance< Array >::LocalVariance(), STK::LocalVariance< Array >::minimalDistance(), STK::LocalVariance< Array >::nbNeighbor(), STK::LocalVariance< Array >::nbNeighbor_, STK::LocalVariance< Array >::neighbors_, STK::IRunnerUnsupervised< Array, Weights >::p_data(), STK::LocalVariance< Array >::prim(), STK::Reduct::prim_, STK::IArray2D< Derived >::resize(), STKRUNTIME_ERROR_NO_ARG, STK::LocalVariance< Array >::type_, and STK::Reduct::unknown_graph_.
Referenced by STK::LocalVariance< Array >::LocalVariance(), and STK::LocalVariance< Array >::LocalVariance().
STK::LocalVariance< Array >::LocalVariance | ( | Array const & | data, |
Reduct::TypeGraph | type = Reduct::distance_ , |
||
int | nbNeighbor = 1 |
||
) |
Constructor.
the TypeGraph and the number of neighbors are given by the user and cannot modified.
data | data set to process |
type | type of proximity graph to build |
nbNeighbor | number of neighbors to use in the proximity graph |
Definition at line 198 of file STK_LocalVariance.h.
References STK::Reduct::distance_, STK::LocalVariance< Array >::LocalVariance(), STK::LocalVariance< Array >::minimalDistance(), STK::LocalVariance< Array >::nbNeighbor(), STK::LocalVariance< Array >::prim(), STK::Reduct::prim_, STKRUNTIME_ERROR_NO_ARG, STK::LocalVariance< Array >::type_, and STK::Reduct::unknown_graph_.
STK::LocalVariance< Array >::LocalVariance | ( | LocalVariance< Array > const & | reducer | ) |
copy Constructor.
reducer | the reducer to copy |
Definition at line 225 of file STK_LocalVariance.h.
|
virtual |
|
private |
Default constructor.
The TypeGraph and the number of neighbors are given by the user and are not modified.
type | type of proximity graph to build |
nbNeighbor | number of neighbors to use in the proximity graph |
|
inlinevirtual |
|
private |
compute the axis using the first eigenvectors of the matrix of covariance and local covariance
Definition at line 370 of file STK_LocalVariance.h.
References STK::IRegression< YArray, XArray, Weights >::run(), and STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::setData().
|
protected |
compute the covariances matrices of the data set
Definition at line 304 of file STK_LocalVariance.h.
References STK::IRegression< YArray, XArray, Weights >::run(), STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::setData(), and STK::sum().
|
protected |
compute the weighted covariances matrices of the data set
Definition at line 336 of file STK_LocalVariance.h.
References STK::IRegression< YArray, XArray, Weights >::run(), STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::setData(), and STK::sum().
|
inline |
Definition at line 103 of file STK_LocalVariance.h.
References STK::LocalVariance< Array >::covariance_.
|
inline |
Definition at line 105 of file STK_LocalVariance.h.
References STK::LocalVariance< Array >::localCovariance_.
|
protectedvirtual |
Compute the axis by maximizing the ratio of the local variance on the total variance of the data set.
Implements STK::ILinearReduct< Array, VectorX >.
Definition at line 271 of file STK_LocalVariance.h.
References STK::LocalVariance< Array >::maximizeStep(), and STKRUNTIME_ERROR_NO_ARG.
Referenced by STK::LocalVariance< Array >::maximizeStep(), and STK::LocalVariance< Array >::maximizeStep().
|
protectedvirtual |
Compute the axis by maximizing the ratio of the weighted local variance on the weighted total variance of the data set.
weights | the weights to use |
Implements STK::ILinearReduct< Array, VectorX >.
Definition at line 288 of file STK_LocalVariance.h.
References STK::LocalVariance< Array >::maximizeStep(), and STKRUNTIME_ERROR_NO_ARG.
|
protected |
compute the minimal distance graph
Definition at line 442 of file STK_LocalVariance.h.
References STK::dist().
Referenced by STK::LocalVariance< Array >::LocalVariance(), and STK::LocalVariance< Array >::LocalVariance().
|
inline |
Definition at line 99 of file STK_LocalVariance.h.
References STK::LocalVariance< Array >::nbNeighbor_.
Referenced by STK::LocalVariance< Array >::LocalVariance(), and STK::LocalVariance< Array >::LocalVariance().
|
inline |
Definition at line 101 of file STK_LocalVariance.h.
References STK::LocalVariance< Array >::neighbors_.
|
protected |
compute the minimal spanning tree
Definition at line 395 of file STK_LocalVariance.h.
References STK::dist(), and STK::IArray2D< Derived >::swap().
Referenced by STK::LocalVariance< Array >::LocalVariance(), and STK::LocalVariance< Array >::LocalVariance().
|
protectedvirtual |
Compute the proximity graph if the data set is modified.
Reimplemented from STK::IRunnerBase.
Definition at line 243 of file STK_LocalVariance.h.
References STK::Reduct::distance_, STK::Reduct::prim_, STKRUNTIME_ERROR_NO_ARG, STK::Reduct::unknown_graph_, and STK::LocalVariance< Array >::update().
Referenced by STK::LocalVariance< Array >::update().
|
protected |
the covariance Array
Definition at line 126 of file STK_LocalVariance.h.
Referenced by STK::LocalVariance< Array >::covariance().
|
protected |
distance matrix : store the minimal distance to the neighbors
Definition at line 121 of file STK_LocalVariance.h.
Referenced by STK::LocalVariance< Array >::LocalVariance().
|
protected |
the local covariance Array
Definition at line 124 of file STK_LocalVariance.h.
Referenced by STK::LocalVariance< Array >::localCovariance().
|
protected |
number of neighbors
Definition at line 116 of file STK_LocalVariance.h.
Referenced by STK::LocalVariance< Array >::LocalVariance(), and STK::LocalVariance< Array >::nbNeighbor().
|
protected |
Predecessor array : store the spanning tree or the minimal distance to the neighbors.
Definition at line 119 of file STK_LocalVariance.h.
Referenced by STK::LocalVariance< Array >::LocalVariance(), and STK::LocalVariance< Array >::pred().
|
protected |
number of neighbors
Definition at line 114 of file STK_LocalVariance.h.
Referenced by STK::LocalVariance< Array >::LocalVariance(), and STK::LocalVariance< Array >::LocalVariance().