1.2.1
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)
 
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::Limits ( )
Limits::Limits ( const VectorDouble mini,
const VectorDouble maxi,
const VectorBool incmini = VectorBool(),
const VectorBool incmaxi = VectorBool() 
)
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::Limits ( int  nclass)
Limits::Limits ( const Limits m)
Limits::~Limits ( )
virtual

Member Function Documentation

Limits * Limits::create ( const VectorDouble mini,
const VectorDouble maxi,
const VectorBool incmini = VectorBool(),
const VectorBool incmaxi = VectorBool() 
)
static
Limits * Limits::create ( const VectorDouble bounds,
bool  addFromZero = false 
)
static
Limits * Limits::create ( int  nclass)
static
bool Limits::empty ( ) const
inline
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
std::vector<Interval>& Limits::getBounds ( )
inline
int Limits::getLimitNumber ( ) const
inline
VectorDouble Limits::getLowerBounds ( ) const
VectorBool Limits::getLowerIncluded ( ) const
VectorDouble Limits::getUpperBounds ( ) const
VectorBool Limits::getUpperIncluded ( ) const
bool Limits::isInside ( double  value) const
Limits & Limits::operator= ( const Limits m)
VectorDouble Limits::statistics ( Db db,
const String name,
int  optionStat = 1,
bool  flagBelow = false,
bool  flagAbove = false 
)

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
int Limits::toCategory ( Db db,
const String name = "",
const NamingConvention namconv = NamingConvention("Category") 
) const
int Limits::toCategoryByAttribute ( Db db,
int  iatt,
const NamingConvention namconv 
) const
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
int Limits::toIndicatorByAttribute ( Db db,
int  iatt,
int  OptionIndicator = 1,
bool  flagBelow = false,
bool  flagAbove = false,
const NamingConvention namconv = NamingConvention("Indicator") 
) const
String Limits::toString ( const AStringFormat strfmt = nullptr) const
overridevirtual

Reimplemented from AStringable.


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