|
STK++ 1.0
|
A ILinearReduct is an interface base class for criteria to maximize in order to find the axis of a linear reduction. More...
#include <STK_ILinearReduct.h>


Public Member Functions | |
| virtual | ~ILinearReduct () |
| virtual destructor | |
| bool | run () |
| Compute the Index. | |
| bool | run (Vector const &weights) |
| Compute the weighted index. | |
| Integer const & | nbAxis () const |
| get the number of axis. | |
| Vector const & | indexValues () const |
| get the values of the index of each axis | |
| Matrix const & | axis () const |
| get the axis | |
Protected Member Functions | |
| ILinearReduct (Matrix const &data) | |
| Constructor. | |
| virtual void | maximizeIndex ()=0 |
| Find the axis by maximizing the Index. | |
| virtual void | maximizeIndex (const Vector &weights)=0 |
| Find the axis by maximizing the weighted Index. | |
| void | projection () |
| Compute the projection of the data set on the Axis. | |
Protected Attributes | |
| Vector | index_values_ |
| The values of the index for each axis. | |
| Matrix | axis_ |
| The computed axis. | |
A ILinearReduct is an interface base class for criteria to maximize in order to find the axis of a linear reduction.
The class receive a matrix in input of size (n,p).
The class compute the optimal axis (stored in the axis_ ) attribute and the projected data set (stored in the p_reduct_ atribute of the base class IReduct) when the user use the virtual method run(nbAxis) (not weighted observations) or run(weights, nbAxis) (weighted observations).
The Matrix axis_ is computed by maximizing some criteria defined in derived classes. It is constructed using the pure virtual functions:
virtual void maximizeIndex() =0; virtual void maximizeIndex() =0;
Definition at line 68 of file STK_ILinearReduct.h.
| STK::ILinearReduct::ILinearReduct | ( | Matrix const & | data | ) | [protected] |
Constructor.
| data | the data set to reduce. |
Definition at line 46 of file STK_ILinearReduct.cpp.
: IReduct(data) {}
| STK::ILinearReduct::~ILinearReduct | ( | ) | [virtual] |
| bool STK::ILinearReduct::run | ( | ) | [virtual] |
Compute the Index.
Implements STK::IRunnerConstRef< Matrix >.
Definition at line 58 of file STK_ILinearReduct.cpp.
References STK::Exception::error(), STK::IRunnerBase::error(), maximizeIndex(), STK::IRunnerBase::msg_error_, and projection().
{
try
{
// maximize the Index and compute the axis
maximizeIndex();
// project data
projection();
} catch (Exception error)
{
msg_error_ = error.error();
return false;
}
return true;
}

| bool STK::ILinearReduct::run | ( | Vector const & | weights | ) |
Compute the weighted index.
| weights | the weights to used |
Definition at line 80 of file STK_ILinearReduct.cpp.
References STK::Exception::error(), STK::IRunnerBase::error(), maximizeIndex(), STK::IRunnerBase::msg_error_, and projection().
{
try
{
// maximize the Index and compute the axis
maximizeIndex(weights);
// project data
projection();
} catch (Exception error)
{
msg_error_ = error.error();
return false;
}
return true;
}

| Integer const& STK::ILinearReduct::nbAxis | ( | ) | const [inline] |
get the number of axis.
Definition at line 92 of file STK_ILinearReduct.h.
References STK::IReduct::dim_.
{ return dim_;}
| Vector const& STK::ILinearReduct::indexValues | ( | ) | const [inline] |
get the values of the index of each axis
Definition at line 96 of file STK_ILinearReduct.h.
References index_values_.
{ return index_values_; }
| Matrix const& STK::ILinearReduct::axis | ( | ) | const [inline] |
get the axis
Definition at line 100 of file STK_ILinearReduct.h.
References axis_.
{ return axis_; }
| virtual void STK::ILinearReduct::maximizeIndex | ( | ) | [protected, pure virtual] |
Find the axis by maximizing the Index.
Implemented in STK::LocalVariance, and STK::ProjectedVariance.
Referenced by run().
| virtual void STK::ILinearReduct::maximizeIndex | ( | const Vector & | weights | ) | [protected, pure virtual] |
Find the axis by maximizing the weighted Index.
| weights | the weights to used |
Implemented in STK::LocalVariance.
| void STK::ILinearReduct::projection | ( | ) | [protected] |
Compute the projection of the data set on the Axis.
Compute the reduction of the data set on the Axis.
Definition at line 98 of file STK_ILinearReduct.cpp.
References axis_, STK::mult(), STK::IReduct::p_reduced_, and STK::IRunnerConstRef< Matrix >::p_y_.
Referenced by run().
{
// free allocated memory
if (!p_reduced_) p_reduced_ = new Matrix;
// compute matrix multiplication
mult( *p_y_, axis_, *p_reduced_);
}

Vector STK::ILinearReduct::index_values_ [protected] |
The values of the index for each axis.
Definition at line 104 of file STK_ILinearReduct.h.
Referenced by STK::LocalVariance::computeAxis(), and indexValues().
Matrix STK::ILinearReduct::axis_ [protected] |
The computed axis.
Definition at line 106 of file STK_ILinearReduct.h.
Referenced by axis(), STK::LocalVariance::computeAxis(), and projection().