1.11.1
CCC
 
Loading...
Searching...
No Matches
gstlrn::Limits Class Reference

#include <Limits.hpp>

Inheritance diagram for gstlrn::Limits:
gstlrn::AStringable

Public Member Functions

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

Static Public Member Functions

static Limits * create (const 1 &mini, const 1 &maxi, const VectorBool &incmini=VectorBool(), const VectorBool &incmaxi=VectorBool())
 
static Limits * create (const 1 &bounds, bool addFromZero=false)
 
static Limits * create (Id nclass)
 

Constructor & Destructor Documentation

◆ Limits() [1/5]

gstlrn::Limits::Limits ( )

◆ Limits() [2/5]

gstlrn::Limits::Limits ( const 1 &  mini,
const 1 &  maxi,
const VectorBool &  incmini = VectorBool(),
const VectorBool &  incmaxi = VectorBool() 
)

◆ Limits() [3/5]

gstlrn::Limits::Limits ( const 1 &  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]

gstlrn::Limits::Limits ( Id  nclass)

◆ Limits() [5/5]

gstlrn::Limits::Limits ( const Limits &  m)

◆ ~Limits()

gstlrn::Limits::~Limits ( )
virtual

Member Function Documentation

◆ create() [1/3]

Limits * gstlrn::Limits::create ( const 1 &  bounds,
bool  addFromZero = false 
)
static

◆ create() [2/3]

Limits * gstlrn::Limits::create ( const 1 &  mini,
const 1 &  maxi,
const VectorBool &  incmini = VectorBool(),
const VectorBool &  incmaxi = VectorBool() 
)
static

◆ create() [3/3]

Limits * gstlrn::Limits::create ( Id  nclass)
static

◆ empty()

bool gstlrn::Limits::empty ( ) const
inline

◆ getBound()

gstlrn::Limits::getBound ( Id  iclass,
Id  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 > & gstlrn::Limits::getBounds ( )
inline

◆ getLowerBounds()

gstlrn::Limits::getLowerBounds ( ) const

◆ getLowerIncluded()

VectorBool gstlrn::Limits::getLowerIncluded ( ) const

◆ getNLimit()

Id gstlrn::Limits::getNLimit ( ) const
inline

◆ getUpperBounds()

gstlrn::Limits::getUpperBounds ( ) const

◆ getUpperIncluded()

VectorBool gstlrn::Limits::getUpperIncluded ( ) const

◆ isInside()

bool gstlrn::Limits::isInside ( double  value) const

◆ operator=()

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

◆ statistics()

gstlrn::Limits::statistics ( Db *  db,
const String &  name,
Id  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()

Id gstlrn::Limits::toCategory ( Db *  db,
const String &  name = "",
const NamingConvention &  namconv = NamingConvention("Category") 
) const

◆ toCategoryByAttribute()

Id gstlrn::Limits::toCategoryByAttribute ( Db *  db,
Id  iatt,
const NamingConvention &  namconv 
) const

◆ toIndicator()

Id gstlrn::Limits::toIndicator ( Db *  db,
const String &  name = "",
Id  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()

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

◆ toString()

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

Reimplemented from gstlrn::AStringable.


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