STK++ 0.9.13
STK::IRunnerSupervised< YArray_, XArray_, Weights_ > Class Template Referenceabstract

Abstract class for all classes making supervised learning. More...

#include <STK_IRunner.h>

Inheritance diagram for STK::IRunnerSupervised< YArray_, XArray_, Weights_ >:
Inheritance graph

Public Member Functions

virtual void setX (XArray_ const &x)
 set the x data set (predictors).
 
virtual void setY (YArray_ const &y)
 set the data set.
 
virtual void setData (YArray_ const &y, XArray_ const &x)
 set the data set.
 
virtual bool run ()=0
 run the computations.
 
virtual bool run (Weights_ const &weights)=0
 run the weighted computations.
 
- Public Member Functions inherited from STK::IRunnerBase
String consterror () const
 get the last error message.
 

Protected Member Functions

 IRunnerSupervised ()
 default constructor
 
 IRunnerSupervised (YArray_ const *const &p_y, XArray_ const *const &p_x)
 constructor
 
 IRunnerSupervised (YArray_ const &y, XArray_ const &x)
 default constructor
 
 IRunnerSupervised (IRunnerSupervised const &runner)
 copy constructor
 
 ~IRunnerSupervised ()
 destructor
 
virtual void updateY ()
 update the runner when y data set is set.
 
virtual void updateX ()
 update the runner when x data set is set.
 
virtual void update ()
 update the runner.
 
- Protected Member Functions inherited from STK::IRunnerBase
 IRunnerBase ()
 default constructor
 
 IRunnerBase (IRunnerBase const &runner)
 copy constructor
 
virtual ~IRunnerBase ()
 destructor
 

Protected Attributes

YArray_ constp_y_
 A pointer on the y data set.
 
XArray_ constp_x_
 A pointer on the x data set.
 
- Protected Attributes inherited from STK::IRunnerBase
String msg_error_
 String with the last error message.
 
bool hasRun_
 true if run has been used, false otherwise
 

Detailed Description

template<typename YArray_, typename XArray_, class Weights_>
class STK::IRunnerSupervised< YArray_, XArray_, Weights_ >

Abstract class for all classes making supervised learning.

This Interface is designed for supervised learning purpose. In an unsupervised learning setting, use IRunnerUnsupervised. The data sets x and y are not copied. There is two pointers on the data sets stored internally.

The pure virtual method to implement are

bool run();
bool run(weights);
virtual bool run()=0
run the computations.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...

Definition at line 269 of file STK_IRunner.h.

Constructor & Destructor Documentation

◆ IRunnerSupervised() [1/4]

STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::IRunnerSupervised ( )
inlineprotected

default constructor

Definition at line 273 of file STK_IRunner.h.

273: p_y_(0), p_x_(0) {}
YArray_ const * p_y_
A pointer on the y data set.
XArray_ const * p_x_
A pointer on the x data set.

◆ IRunnerSupervised() [2/4]

STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::IRunnerSupervised ( YArray_ const *const p_y,
XArray_ const *const p_x 
)
inlineprotected

constructor

Parameters
p_y,p_xpointers on the y and x data sets

Definition at line 277 of file STK_IRunner.h.

278 : p_y_(p_y), p_x_(p_x)
279 {}

◆ IRunnerSupervised() [3/4]

STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::IRunnerSupervised ( YArray_ const y,
XArray_ const x 
)
inlineprotected

default constructor

Parameters
y,xy and x data sets

Definition at line 283 of file STK_IRunner.h.

284 : p_y_(&y), p_x_(&x)
285 {}

◆ IRunnerSupervised() [4/4]

STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::IRunnerSupervised ( IRunnerSupervised< YArray_, XArray_, Weights_ > const runner)
inlineprotected

copy constructor

Parameters
runnerthe runner to copy

Definition at line 289 of file STK_IRunner.h.

290 : IRunnerBase(runner)
291 , p_y_(runner.p_y_), p_x_(runner.p_x_)
292 {}
IRunnerBase()
default constructor
Definition STK_IRunner.h:68

◆ ~IRunnerSupervised()

destructor

Definition at line 294 of file STK_IRunner.h.

294{}

Member Function Documentation

◆ run() [1/2]

◆ run() [2/2]

run the weighted computations.

Parameters
weightsthe weights of the samples
Returns
true if no error occur during the running process, false otherwise

Implemented in STK::IRegression< YArray, XArray, Weights >, and STK::IClassification< YArray_, XArray_, Weights_ >.

◆ setData()

◆ setX()

set the x data set (predictors).

If the state of the runner change when a new x data set is set, the user of this class have to overload the udpate() method.

Parameters
xThe x data set to run

Definition at line 302 of file STK_IRunner.h.

303 {
304 p_x_ = &x;
305 updateX();
306 this->hasRun_ = false;
307 }
virtual void updateX()
update the runner when x data set is set.

References STK::IRunnerBase::hasRun_, STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::p_x_, and STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::updateX().

◆ setY()

set the data set.

If the state of the runner change when a new data set is set, the user of this class have to overload the udpate() method.

Parameters
yThe y data set to run

Definition at line 313 of file STK_IRunner.h.

314 {
315 p_y_ = &y;
316 updateY();
317 this->hasRun_ = false;
318 }
virtual void updateY()
update the runner when y data set is set.

References STK::IRunnerBase::hasRun_, STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::p_y_, and STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::updateY().

◆ update()

virtual void STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::update ( )
inlineprotectedvirtual

update the runner.

This virtual method will be called when the state of the runner will change, i.e. when new x and y data sets are set. By default do nothing.

Reimplemented from STK::IRunnerBase.

Definition at line 362 of file STK_IRunner.h.

362{ updateX(); updateY();}

References STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::updateX(), and STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::updateY().

Referenced by STK::IQr< Derived >::insertCol(), STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::setData(), and STK::HDMatrixModelParameters< Array_ >::updateStatistics().

◆ updateX()

virtual void STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::updateX ( )
inlineprotectedvirtual

update the runner when x data set is set.

This virtual method will be called when the state of the runner will change, i.e. when a new x data set is set. By default do nothing.

Definition at line 357 of file STK_IRunner.h.

357{}

Referenced by STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::setX(), and STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::update().

◆ updateY()

virtual void STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::updateY ( )
inlineprotectedvirtual

update the runner when y data set is set.

This virtual method will be called when the state of the runner will change, i.e. when a new y data is set is set. By default do nothing.

Definition at line 352 of file STK_IRunner.h.

352{}

Referenced by STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::setY(), and STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::update().

Member Data Documentation

◆ p_x_

◆ p_y_


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