1.4.0
CCC
 
Limits Class Reference

#include <Limits.hpp>

Inheritance diagram for Limits:
AStringable

Public Member Functions

 Limits ()
 
 Limits (const VectorDouble &mini, const VectorDouble &maxi, const VectorBool &incmini=VectorBool(), const VectorBool &incmaxi=VectorBool())
 
 Limits (const VectorDouble &bounds, bool addFromZero=false)
 
 Limits (int nclass)
 
 Limits (const Limits &m)
 
Limitsoperator= (const Limits &m)
 
virtual ~Limits ()
 
virtual String toString (const AStringFormat *strfmt=nullptr) const override
 
int getLimitNumber () const
 
std::vector< Interval > & getBounds ()
 
VectorDouble getBound (int iclass, int mode=0) const
 
VectorDouble getLowerBounds () const
 
VectorDouble getUpperBounds () const
 
VectorBool getLowerIncluded () const
 
VectorBool getUpperIncluded () const
 
bool isInside (double value) const
 
bool empty () const
 
int toCategory (Db *db, const String &name="", const NamingConvention &namconv=NamingConvention("Category")) const
 
int toIndicator (Db *db, const String &name="", int OptionIndicator=1, bool flagBelow=false, bool flagAbove=false, const NamingConvention &namconv=NamingConvention("Indicator")) const
 
VectorDouble statistics (Db *db, const String &name, int optionStat=1, bool flagBelow=false, bool flagAbove=false) const
 
int toCategoryByAttribute (Db *db, int iatt, const NamingConvention &namconv) const
 
int toIndicatorByAttribute (Db *db, int iatt, int OptionIndicator=1, bool flagBelow=false, bool flagAbove=false, const NamingConvention &namconv=NamingConvention("Indicator")) const
 
- Public Member Functions inherited from AStringable
 AStringable ()
 
 AStringable (const AStringable &r)
 
AStringableoperator= (const AStringable &r)
 
virtual ~AStringable ()
 
virtual void display (const AStringFormat *strfmt=nullptr) const final
 
virtual void display (int level) const final
 

Static Public Member Functions

static Limitscreate (const VectorDouble &mini, const VectorDouble &maxi, const VectorBool &incmini=VectorBool(), const VectorBool &incmaxi=VectorBool())
 
static Limitscreate (const VectorDouble &bounds, bool addFromZero=false)
 
static Limitscreate (int nclass)
 

Constructor & Destructor Documentation

◆ Limits() [1/5]

Limits::Limits ( )

◆ Limits() [2/5]

Limits::Limits ( const VectorDouble mini,
const VectorDouble maxi,
const VectorBool incmini = VectorBool(),
const VectorBool incmaxi = VectorBool() 
)

◆ Limits() [3/5]

Limits::Limits ( const VectorDouble bounds,
bool  addFromZero = false 
)

Create the limits from a list of bounds. Intervals are delimited between two given bounds: [z_i, z_(i+1)[

Parameters
boundsList of cutoffs used to create the limits. The number of limits is equal to the number of elements in the 'bounds' vector minus one.
addFromZeroWhen TRUE, add a class from 0 to bounds[0]

◆ Limits() [4/5]

Limits::Limits ( int  nclass)

◆ Limits() [5/5]

Limits::Limits ( const Limits m)

◆ ~Limits()

Limits::~Limits ( )
virtual

Member Function Documentation

◆ create() [1/3]

Limits * Limits::create ( const VectorDouble bounds,
bool  addFromZero = false 
)
static

◆ create() [2/3]

Limits * Limits::create ( const VectorDouble mini,
const VectorDouble maxi,
const VectorBool incmini = VectorBool(),
const VectorBool incmaxi = VectorBool() 
)
static

◆ create() [3/3]

Limits * Limits::create ( int  nclass)
static

◆ empty()

bool Limits::empty ( ) const
inline

◆ getBound()

VectorDouble Limits::getBound ( int  iclass,
int  mode = 0 
) const

Retrieve the set of bounds or one bound

Parameters
iclassRank of the class
mode0 for both bounds; 1 for lower bound; 2 for upper bound
Returns
The vector of bound values

◆ getBounds()

std::vector<Interval>& Limits::getBounds ( )
inline

◆ getLimitNumber()

int Limits::getLimitNumber ( ) const
inline

◆ getLowerBounds()

VectorDouble Limits::getLowerBounds ( ) const

◆ getLowerIncluded()

VectorBool Limits::getLowerIncluded ( ) const

◆ getUpperBounds()

VectorDouble Limits::getUpperBounds ( ) const

◆ getUpperIncluded()

VectorBool Limits::getUpperIncluded ( ) const

◆ isInside()

bool Limits::isInside ( double  value) const

◆ operator=()

Limits & Limits::operator= ( const Limits m)

◆ statistics()

VectorDouble Limits::statistics ( Db db,
const String name,
int  optionStat = 1,
bool  flagBelow = false,
bool  flagAbove = false 
) const

Calculate the statistics per Class

Parameters
dbTarget Db
nameName of the Target Variable
optionStat1 for Mean; 2 for Proportions
flagBelowWhen TRUE, add a class for samples below lowest bound
flagAboveWhen TRUE, add a class for samples above highest bound
Returns

◆ toCategory()

int Limits::toCategory ( Db db,
const String name = "",
const NamingConvention namconv = NamingConvention("Category") 
) const

◆ toCategoryByAttribute()

int Limits::toCategoryByAttribute ( Db db,
int  iatt,
const NamingConvention namconv 
) const

◆ toIndicator()

int Limits::toIndicator ( Db db,
const String name = "",
int  OptionIndicator = 1,
bool  flagBelow = false,
bool  flagAbove = false,
const NamingConvention namconv = NamingConvention("Indicator") 
) const

Create indicators variables on the intervals defined by the limits for a given variable in a Db.
Note:

  • If OptionIndicator is 1, the Db-class will contain the new indicator variables. There are as many new variables as they are classes. Each sample of the indicator variable for class 'iclass' is set to 1 if the sample belongs to this class or 0 otherwise.
  • If OptionIndicator is 0, the Db-class will contain one variable such that each sample contains the average of the variable calculated over the samples whose value belong to this class.
Parameters
dbDb containing the variable to be discretized (from which the indicators are computed)
nameName of the variable in the Db to be discretized.
OptionIndicatorWhen 1, the function assignes the indicator variables. When 0, the function assignes the average of the class.
flagBelowWhen True, consider samples below lowest bound
flagAboveWhen True, consider samples above highest bound
namconvNaming convention
Returns

◆ toIndicatorByAttribute()

int Limits::toIndicatorByAttribute ( Db db,
int  iatt,
int  OptionIndicator = 1,
bool  flagBelow = false,
bool  flagAbove = false,
const NamingConvention namconv = NamingConvention("Indicator") 
) const

◆ toString()

String Limits::toString ( const AStringFormat strfmt = nullptr) const
overridevirtual

Reimplemented from AStringable.


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