PLearn 0.1
|
#include <SDBVMat.h>
Public Member Functions | |
SDBVMFieldICBCClassification (Schema schema, const string &fieldname="", const string &tmap_file="") | |
virtual void | convertField (const SDBWithStats &sdb, const Row &row, const Vec &output) const |
virtual int | fieldWidth () const |
Width that the field occupies in the VMat. | |
Protected Attributes | |
SDBVMSource | bodily_injury_incurred_ |
SDBVMSource | property_damage_incurred_ |
SDBVMSource | accident_death_incurred_ |
SDBVMSource | collision_lou_incurred_ |
SDBVMSource | comprehensive_incurred_ |
FieldPtr | policy_start_date_ |
string | fieldname_ |
int | threshold |
Private Types | |
typedef SDBVMField | inherited |
typedef SDBVMField PLearn::SDBVMFieldICBCClassification::inherited [private] |
PLearn::SDBVMFieldICBCClassification::SDBVMFieldICBCClassification | ( | Schema | schema, |
const string & | fieldname = "" , |
||
const string & | tmap_file = "" |
||
) |
Definition at line 1232 of file SDBVMat.cc.
References PLERROR, and threshold.
: inherited(0), bodily_injury_incurred_(schema("bodily_injury_incurred")), property_damage_incurred_(schema("property_damage_incurred")), accident_death_incurred_(schema("accident_death_incurred")), collision_lou_incurred_(schema("collision_lou_incurred")), comprehensive_incurred_(schema("comprehensive_incurred")), policy_start_date_(schema("policy_start_date")), fieldname_(fieldname) { // is this used anyway? threshold seems to be hardcoded in ConvertField if (fieldname == "") threshold = 10000; else if (fieldname == "condprob3") threshold = 10000; else if (fieldname == "bodily_injury_incurred") threshold = 50000; else if (fieldname == "property_damage_incurred") threshold = 4000; else if (fieldname == "accident_death_incurred") threshold = 12000; else if (fieldname == "collision_lou_incurred") threshold = 5000; else if (fieldname == "comprehensive_incurred") threshold = 1000; else if (fieldname == "sum_all_but_BI") threshold = 10000; else PLERROR("Bad field fieldname"); }
void PLearn::SDBVMFieldICBCClassification::convertField | ( | const SDBWithStats & | sdb, |
const Row & | theRow, | ||
const Vec & | outputField | ||
) | const [virtual] |
Given a database row, convert the appropriate parts to a (preallocated) output vector of the correct width (given by fieldWidth). Replace MISSING_VALUEs by missing_values_mapping.
Implements PLearn::SDBVMField.
Definition at line 1264 of file SDBVMat.cc.
References accident_death_incurred_, bodily_injury_incurred_, collision_lou_incurred_, comprehensive_incurred_, fieldname_, PLearn::SDBVMSource::getValue(), PLearn::ICBCpartition(), property_damage_incurred_, PLearn::TVec< T >::resize(), and threshold.
{ int threshold = 10000; Vec claims(1); if (fieldname_ == "") { claims.resize(5); claims[0] = real(bodily_injury_incurred_.getValue(sdb,row)); claims[1] = real(property_damage_incurred_.getValue(sdb,row)); claims[2] = real(accident_death_incurred_.getValue(sdb,row)); claims[3] = real(collision_lou_incurred_.getValue(sdb,row)); claims[4] = real(comprehensive_incurred_.getValue(sdb,row)); } // ugly hack else if (fieldname_ == "condprob3") { claims[0] = real(property_damage_incurred_.getValue(sdb,row)) + real(accident_death_incurred_.getValue(sdb,row)) + real(collision_lou_incurred_.getValue(sdb,row)) + real(comprehensive_incurred_.getValue(sdb,row)); output[0]=claims[0]<=0?0:1; return; } else if (fieldname_ == "bodily_injury_incurred") claims[0] = real(bodily_injury_incurred_.getValue(sdb,row)); else if (fieldname_ == "property_damage_incurred") claims[0] = real(property_damage_incurred_.getValue(sdb,row)); else if (fieldname_ == "accident_death_incurred") claims[0] = real(accident_death_incurred_.getValue(sdb,row)); else if (fieldname_ == "collision_lou_incurred") claims[0] = real(collision_lou_incurred_.getValue(sdb,row)); else if (fieldname_ == "comprehensive_incurred") claims[0] = real(comprehensive_incurred_.getValue(sdb,row)); else if (fieldname_ == "sum_all_but_BI") claims[0] = real(property_damage_incurred_.getValue(sdb,row)) + real(accident_death_incurred_.getValue(sdb,row)) + real(collision_lou_incurred_.getValue(sdb,row)) + real(comprehensive_incurred_.getValue(sdb,row)); output[0] = ICBCpartition(claims, threshold); }
virtual int PLearn::SDBVMFieldICBCClassification::fieldWidth | ( | ) | const [inline, virtual] |
Width that the field occupies in the VMat.
Implements PLearn::SDBVMField.
Definition at line 1095 of file SDBVMat.h.
{ return 1; }
Definition at line 1100 of file SDBVMat.h.
Referenced by convertField().
Definition at line 1098 of file SDBVMat.h.
Referenced by convertField().
Definition at line 1101 of file SDBVMat.h.
Referenced by convertField().
Definition at line 1102 of file SDBVMat.h.
Referenced by convertField().
string PLearn::SDBVMFieldICBCClassification::fieldname_ [protected] |
Definition at line 1104 of file SDBVMat.h.
Referenced by convertField().
Definition at line 1099 of file SDBVMat.h.
Referenced by convertField().
int PLearn::SDBVMFieldICBCClassification::threshold [protected] |
Definition at line 1105 of file SDBVMat.h.
Referenced by convertField(), and SDBVMFieldICBCClassification().