STK++ 1.0
STK::ILinearReduct Class Reference

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>

Inheritance diagram for STK::ILinearReduct:
Collaboration diagram for STK::ILinearReduct:

List of all members.

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.

Detailed Description

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).

  • n is the number of samples,
  • p is the number of variables. The n samples can be weighted.

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.


Constructor & Destructor Documentation

STK::ILinearReduct::ILinearReduct ( Matrix const &  data) [protected]

Constructor.

Parameters:
datathe data set to reduce.

Definition at line 46 of file STK_ILinearReduct.cpp.

                                                : IReduct(data)
{}
STK::ILinearReduct::~ILinearReduct ( ) [virtual]

virtual destructor

Definition at line 52 of file STK_ILinearReduct.cpp.

{}

Member Function Documentation

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;
}

Here is the call graph for this function:

bool STK::ILinearReduct::run ( Vector const &  weights)

Compute the weighted index.

Parameters:
weightsthe 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;
}

Here is the call graph for this function:

Integer const& STK::ILinearReduct::nbAxis ( ) const [inline]

get the number of axis.

Returns:
The number of axis computed or to compute

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

Returns:
a constant reference Vector of the value of the Index

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

Returns:
a constant reference Matrix of 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.

Parameters:
weightsthe 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_);
}

Here is the call graph for this function:


Member Data Documentation

The values of the index for each axis.

Definition at line 104 of file STK_ILinearReduct.h.

Referenced by STK::LocalVariance::computeAxis(), and indexValues().

The computed axis.

Definition at line 106 of file STK_ILinearReduct.h.

Referenced by axis(), STK::LocalVariance::computeAxis(), and projection().


The documentation for this class was generated from the following files: