|
PLearn 0.1
|
#include <SDBWithStats.h>

Public Member Functions | |
| int | nsymbols () |
| FieldStat () | |
| int | ntotal () const |
| int | missing () const |
| int | nonmissing () const |
| real | mean () const |
| real | stddev () const |
| real | min () const |
| real | max () const |
| void | updateString (const string &sym) |
| void | updateNumber (double d) |
| void | updateMissing () |
| void | clear () |
| clear everything | |
| void | finalize () |
| computes final mean and stddev | |
Public Attributes | |
| map< string, int > | symbolcount |
| For symbolic values. | |
| map< string, int > | symbolid |
| an int between 1 and nsymbols associated to each symbol | |
Static Public Attributes | |
| static int | max_nsymbols = 400 |
| stop remembering symbols above this number... | |
Protected Attributes | |
| int | nonmissing_ |
| For all values: | |
| int | missing_ |
| number of entries with missing value | |
| double | sum_ |
| For numeric values: | |
| double | sumsquare_ |
| double | min_ |
| double | max_ |
| double | mean_ |
| double | stddev_ |
Friends | |
| class | SDBWithStats |
Definition at line 58 of file SDBWithStats.h.
| PLearn::FieldStat::FieldStat | ( | ) | [inline] |
Definition at line 85 of file SDBWithStats.h.
:nonmissing_(0), missing_(0), sum_(0.), sumsquare_(0), min_(FLT_MAX), max_(-FLT_MAX) {}
| void PLearn::FieldStat::clear | ( | ) |
clear everything
Definition at line 72 of file SDBWithStats.cc.
Referenced by PLearn::SDBWithStats::forgetStats().
{
nonmissing_ = 0;
missing_ = 0;
sum_ = 0;
sumsquare_ = 0;
min_ = FLT_MAX;
max_ = -FLT_MAX;
mean_ = 0;
stddev_ = 0;
symbolcount.clear();
symbolid.clear();
}

| void PLearn::FieldStat::finalize | ( | ) |
computes final mean and stddev
Definition at line 86 of file SDBWithStats.cc.
References PLearn::sqrt(), and PLearn::square().
{
mean_ = sum_/nonmissing_;
double meansquare_ = sumsquare_/nonmissing_;
stddev_ = sqrt( meansquare_ - square(mean_) );
if(nsymbols()>=max_nsymbols) // too many different values: ignore it (not really symbolic)
{
symbolcount.clear();
symbolid.clear();
}
}

| real PLearn::FieldStat::max | ( | ) | const [inline] |
Definition at line 96 of file SDBWithStats.h.
Referenced by PLearn::SDBWithStats::saveStats().

| real PLearn::FieldStat::mean | ( | ) | const [inline] |
Definition at line 93 of file SDBWithStats.h.
Referenced by PLearn::SDBVMFieldNormalize::convertField(), and PLearn::SDBWithStats::saveStats().

| real PLearn::FieldStat::min | ( | ) | const [inline] |
Definition at line 95 of file SDBWithStats.h.
Referenced by PLearn::SDBWithStats::saveStats().

| int PLearn::FieldStat::missing | ( | ) | const [inline] |
Definition at line 91 of file SDBWithStats.h.
Referenced by PLearn::SDBWithStats::saveStats().
{ return missing_; }

| int PLearn::FieldStat::nonmissing | ( | ) | const [inline] |
Definition at line 92 of file SDBWithStats.h.
Referenced by PLearn::SDBWithStats::saveStats().
{ return nonmissing_; }

| int PLearn::FieldStat::nsymbols | ( | ) | [inline] |
Definition at line 82 of file SDBWithStats.h.
Referenced by PLearn::SDBWithStats::saveStats().
{ return (int)symbolcount.size(); }

| int PLearn::FieldStat::ntotal | ( | ) | const [inline] |
Definition at line 90 of file SDBWithStats.h.
{ return missing_+nonmissing_; }
| real PLearn::FieldStat::stddev | ( | ) | const [inline] |
Definition at line 94 of file SDBWithStats.h.
Referenced by PLearn::SDBVMFieldDivSigma::convertField(), PLearn::SDBVMFieldNormalize::convertField(), and PLearn::SDBWithStats::saveStats().

| void PLearn::FieldStat::updateMissing | ( | ) | [inline] |
Definition at line 100 of file SDBWithStats.h.
{ ++missing_; }
| void PLearn::FieldStat::updateNumber | ( | double | d | ) |
Definition at line 59 of file SDBWithStats.cc.
References d, and PLearn::tostring().
{
++nonmissing_;
if(nsymbols()<max_nsymbols)
symbolcount[tostring(d)]++;
sum_ += d;
sumsquare_ += d*d;
if(d<min_)
min_ = d;
if(d>max_)
max_ = d;
}

| void PLearn::FieldStat::updateString | ( | const string & | sym | ) |
Definition at line 52 of file SDBWithStats.cc.
{
++nonmissing_;
if(nsymbols()<max_nsymbols)
symbolcount[sym]++;
}
friend class SDBWithStats [friend] |
Definition at line 60 of file SDBWithStats.h.
double PLearn::FieldStat::max_ [protected] |
Definition at line 73 of file SDBWithStats.h.
Referenced by PLearn::SDBWithStats::loadStats().
int PLearn::FieldStat::max_nsymbols = 400 [static] |
stop remembering symbols above this number...
Definition at line 83 of file SDBWithStats.h.
double PLearn::FieldStat::mean_ [protected] |
Definition at line 74 of file SDBWithStats.h.
Referenced by PLearn::SDBWithStats::loadStats().
double PLearn::FieldStat::min_ [protected] |
Definition at line 72 of file SDBWithStats.h.
Referenced by PLearn::SDBWithStats::loadStats().
int PLearn::FieldStat::missing_ [protected] |
number of entries with missing value
Definition at line 66 of file SDBWithStats.h.
Referenced by PLearn::SDBWithStats::loadStats().
int PLearn::FieldStat::nonmissing_ [protected] |
For all values:
number of entries with non missing value
Definition at line 65 of file SDBWithStats.h.
Referenced by PLearn::SDBWithStats::loadStats().
double PLearn::FieldStat::stddev_ [protected] |
Definition at line 75 of file SDBWithStats.h.
Referenced by PLearn::SDBWithStats::loadStats().
double PLearn::FieldStat::sum_ [protected] |
For numeric values:
Definition at line 69 of file SDBWithStats.h.
double PLearn::FieldStat::sumsquare_ [protected] |
Definition at line 70 of file SDBWithStats.h.
| map<string,int> PLearn::FieldStat::symbolcount |
For symbolic values.
Definition at line 80 of file SDBWithStats.h.
Referenced by PLearn::SDBWithStats::loadStats(), and PLearn::SDBWithStats::saveStats().
map<string,int> PLearn::FieldStat::symbolid [mutable] |
an int between 1 and nsymbols associated to each symbol
Definition at line 81 of file SDBWithStats.h.
Referenced by PLearn::SDBWithStats::loadStats(), PLearn::SDBVMFieldRemapReals::SDBVMFieldRemapReals(), and PLearn::SDBVMFieldRemapStrings::SDBVMFieldRemapStrings().
1.7.4