STK++ 0.9.13
STK::LocalVariancePage Class Reference

In this Page, we manage the options for the computation of the LocalVariance. More...

#include <STK_LocalVariancePage.h>

Inheritance diagram for STK::LocalVariancePage:
Inheritance graph

Public Member Functions

 LocalVariancePage ()
 default constructor
 
 LocalVariancePage (int const &level)
 constructor with a given level.
 
 LocalVariancePage (LocalVariancePage const &page)
 copy constructor.
 
virtual ~LocalVariancePage ()
 destructor.
 
virtual LocalVariancePageclone () const
 clone pattern
 
Reduct::TypeGraph typeGraph () const
 get the type of graph
 
int nbNeighbor () const
 
virtual bool validate ()
 validate the options.
 
- Public Member Functions inherited from STK::IPage
 IPage (String const &name, int const &level, bool isOptional)
 Constructor.
 
 IPage (IPage const &page)
 Copy constructor.
 
virtual ~IPage ()
 Destructor.
 
String constname () const
 name of the IPage.
 
bool isOptional () const
 is this Option optional ?.
 
ContOption constoptions () const
 get the options of the IPage
 
String constmsg_error () const
 name of the IPage.
 
Optionoption (String const &name)
 bookkeeping function.
 
Option constoption (String const &name) const
 bookkeeping function.
 
Option constoption (int const &pos) const
 get the ith constant option of the IPage
 
Optionoption (int const &pos)
 get the ith option of the IPage
 
Option constoperator[] (int const &pos) const
 get the ith constant option of the IPage
 
Optionoperator[] (int const &pos)
 get the ith option of the IPage
 
void addOption (Option const &opt)
 add an option to the page
 
void addPage (IPage const &page)
 add a sub-page as an option to the page
 
void read (istream &is)
 read in options from an input steam stream
 
void write (ostream &os) const
 write out options in a stream
 

Private Attributes

Reduct::TypeGraph type_
 type of the graph to compute
 
int nbNeighbor_
 number of neighbors of each individual in the graph.
 

Additional Inherited Members

- Public Types inherited from STK::IPage
typedef std::vector< OptionContOption
 Container for the options.
 
- Protected Attributes inherited from STK::IPage
bool isOptional_
 true if the Page is optinal, false otherwise
 
ContOption options_
 array of the options
 
String msg_error_
 Contain the last error message.
 

Detailed Description

In this Page, we manage the options for the computation of the LocalVariance.

The LocalVariance page have the form

# LocalVariancePage options
# proximity graph type using prim or distance
type graph = distance
# number of neighbors to use
A LocalVariance is an implementation of the abstract ILinearReduct class.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...

Definition at line 58 of file STK_LocalVariancePage.h.

Constructor & Destructor Documentation

◆ LocalVariancePage() [1/3]

STK::LocalVariancePage::LocalVariancePage ( )

default constructor

Definition at line 50 of file STK_LocalVariancePage.cpp.

51 : IPage(_T("LocalVariance"), 1, true)
53 , nbNeighbor_(3)
54{
55 // reserve for the 2 options
56 options_.reserve(2);
57 // first option : type of graph
58 options_.push_back(Option(_T("type graph"), Option::string_, true));
59 options_.back().setValue(_T("minimalDistance"));
60 // number of neighbor
61 options_.push_back(Option(_T("neighborhood"), Option::integer_, true));
62 options_.back().setValue(_T("3"));
63}
#define _T(x)
Let x unmodified.
ContOption options_
array of the options
Definition STK_IPage.h:201
IPage(String const &name, int const &level, bool isOptional)
Constructor.
Definition STK_IPage.cpp:72
int nbNeighbor_
number of neighbors of each individual in the graph.
Reduct::TypeGraph type_
type of the graph to compute
@ integer_
discrete number
Definition STK_Option.h:76
@ string_
characters
Definition STK_Option.h:74

References _T, STK::Option::integer_, STK::IPage::options_, and STK::Option::string_.

Referenced by clone().

◆ LocalVariancePage() [2/3]

STK::LocalVariancePage::LocalVariancePage ( int const level)

constructor with a given level.

Parameters
levelthe level of the page

Definition at line 66 of file STK_LocalVariancePage.cpp.

67 : IPage(_T("LocalVariance"), level, true)
69 , nbNeighbor_(2)
70{
71 // reserve for the 2 options
72 options_.reserve(2);
73 // first option : type of graph
74 options_.push_back(Option(_T("type graph"), Option::string_, true));
75 options_.back().setValue(_T("minimalDistance"));
76 // number of neighbor
77 options_.push_back(Option(_T("neighborhood"), Option::integer_, true));
78 options_.back().setValue(_T("2"));
79}

References _T, STK::Option::integer_, STK::IPage::options_, and STK::Option::string_.

◆ LocalVariancePage() [3/3]

STK::LocalVariancePage::LocalVariancePage ( LocalVariancePage const page)

copy constructor.

Parameters
pagethe page to copy

Definition at line 82 of file STK_LocalVariancePage.cpp.

83 : IPage(page)
84 , type_(page.type_)
85 , nbNeighbor_(page.nbNeighbor_)
86{}

◆ ~LocalVariancePage()

STK::LocalVariancePage::~LocalVariancePage ( )
virtual

destructor.

Definition at line 89 of file STK_LocalVariancePage.cpp.

90{}

Member Function Documentation

◆ clone()

virtual LocalVariancePage * STK::LocalVariancePage::clone ( ) const
inlinevirtual

clone pattern

Returns
a pointer on the clone of this

Reimplemented from STK::IPage.

Definition at line 76 of file STK_LocalVariancePage.h.

77 { return new LocalVariancePage(*this);}
LocalVariancePage()
default constructor

References LocalVariancePage().

◆ nbNeighbor()

int STK::LocalVariancePage::nbNeighbor ( ) const
inline
Returns
the number of neighbors to used in order to construct the proximity graph

Definition at line 86 of file STK_LocalVariancePage.h.

86{ return nbNeighbor_;}

References nbNeighbor_.

◆ typeGraph()

Reduct::TypeGraph STK::LocalVariancePage::typeGraph ( ) const
inline

get the type of graph

Returns
the TypeGraph used for computing the local variance

Definition at line 82 of file STK_LocalVariancePage.h.

82{ return type_;}

References type_.

◆ validate()

bool STK::LocalVariancePage::validate ( )
virtual

validate the options.

Check if the values are coherent.

Returns
true if the options are correct, false otherwise.

Reimplemented from STK::IPage.

Definition at line 92 of file STK_LocalVariancePage.cpp.

93{
94 // validate first option
97 {
98 msg_error_ = LOCALVARIANCEERRORCODES[1];
99 msg_error_ += "graph type unknown.\n";
100 return false;
101 }
102 // validate second option
103 nbNeighbor_ = options_[1].get(int());
104 if (nbNeighbor_ <= 0)
105 {
106 msg_error_ = LOCALVARIANCEERRORCODES[1];
107 msg_error_ += "neighborhood must be a strictly positive value.\n";
108 return false;
109 }
110 return true;
111}
String msg_error_
Contain the last error message.
Definition STK_IPage.h:204
std::basic_string< Char > String
STK fundamental type of a String.
TypeGraph stringToTypeGraph(String const &type)
convert a String to a TypeGraph.

References STK::IPage::msg_error_, nbNeighbor_, STK::IPage::options_, STK::Reduct::stringToTypeGraph(), type_, and STK::Reduct::unknown_graph_.

Member Data Documentation

◆ nbNeighbor_

int STK::LocalVariancePage::nbNeighbor_
private

number of neighbors of each individual in the graph.

Definition at line 96 of file STK_LocalVariancePage.h.

Referenced by nbNeighbor(), and validate().

◆ type_

Reduct::TypeGraph STK::LocalVariancePage::type_
private

type of the graph to compute

Definition at line 94 of file STK_LocalVariancePage.h.

Referenced by typeGraph(), and validate().


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