Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::SDBVMFieldICBCTargets Class Reference

#include <SDBVMat.h>

Inheritance diagram for PLearn::SDBVMFieldICBCTargets:

Inheritance graph
[legend]
Collaboration diagram for PLearn::SDBVMFieldICBCTargets:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SDBVMFieldICBCTargets (Schema schema, bool use_roadstar, bool add_claims_sum_column, bool rescale_by_interval, bool rescale_by_start_date, Mat &start_date_rescaling_values, const string &targetname="ALL")
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

bool use_roadstar_
bool add_claims_sum_column_
bool rescale_by_interval_
bool rescale_by_start_date_
Mat start_date_rescaling_values_
string targetname_
int reference_start_date_year_
int reference_start_date_month_
SDBVMSource start_date_
SDBVMSource end_date_
SDBVMSource bodily_injury_incurred_
SDBVMSource property_damage_incurred_
SDBVMSource accident_death_incurred_
SDBVMSource collision_lou_incurred_
SDBVMSource comprehensive_incurred_
SDBVMSource bodily_injury_count_
SDBVMSource property_damage_count_
SDBVMSource accident_death_count_
SDBVMSource collision_lou_count_
SDBVMSource comprehensive_count_
SDBVMSource bodily_injury_severity_
SDBVMSource property_damage_severity_
SDBVMSource accident_death_severity_
SDBVMSource collision_lou_severity_
SDBVMSource comprehensive_severity_

Private Types

typedef SDBVMField inherited

Detailed Description

This class is specialized for processing an ICBC database with the following fields: "policy_start_date"; "policy_end_date"; "bodily_injury_incurred"; "property_damage_incurred"; "accident_death_incurred"; "collision_lou_incurred"; "comprehensive_incurred"; "roadstar_incurred";

The output has at least 1 value and at most 8 values (number of outputs = targetname=="ALL"?5:1 + int(use_roadstar) + int(add_claims_sum_column) + int(rescale_by_interval)). targetname can be "ALL" or one of the 5 other targets (excluding "roadstar_incurred"), or sum_all_but_BI. There are targetname=="ALL"?5:1 + int(use_roadstar) "*_incurred" targets + possibly one target corresponding to the sum of all the "*_incurred" targets (if add_claims_sum_column==true) and possibly one "weight" if rescale_by_interval==true. If targetname=="sum_all_but_BI" then there is only one target, which is the sum of all 4 KOLs excluding Bodily Injury.

The weight is computed as follows: duration = Year(policy_end_date)-Year(policy_start_date) weight = duration^2

The 5 + int(use_roadstar) targets are computed as follows: _incurred_target = 0.001 * *_incurred; if (rescale_by_interval) _incurred_target /= duration if (rescale_by_start_date) _incurred_target /= smoothed *_incurred monthly mean for month m and year y where m and y are the month and year of the policy start date of the contract. (PS: for more information on the smoothed monthly means, read the comments in PLearn/Databases/ICBCdatabases.h) if is_missing(X_incurred_target) then X_incurred_target = 0

where Year is the date given in units of years (with fractional part), so that in the common case where the difference is one year, the weight is 1 and there is no normalization of the targets. Note that the target outputs are in UNITS OF 1000 DOLLARS PER YEAR.

This "weight" is the weight that should be given to the squared loss (f(x)-normalized_target)^2. This comes from the following reasoning:

We are to learn a function f(x) that predicts the incurred amounts for ONE YEAR, but the (x,target) pairs in the data may cover more or less than one year. So the loss should be (f(x)*duration - target)^2 where duration is in units of years. To make it more "standard" we instead consider the weighted squared loss, since (f(x)*duration - target)^2 = duration^2 * (f(x) - target/duration)^2 = w * (f(x) - normalized_target)^2

When add_claims_sum_column==true sum of targets = sum of all the *_incurred targets after they have been rescaled

PS: * Year is the date given in units of years (with fractional part), so that in the common case where the difference is one year, the weight is 1 and there is no normalization of the targets. Note that the target outputs are in UNITS OF 1000 DOLLARS PER YEAR. When rescale_by_interval==true, the "weight" is the weight that should be given to the squared loss (f(x)-normalized_target)^2. This comes from the following reasoning: We are to learn a function f(x) that predicts the incurred amounts for ONE YEAR, but the (x,target) pairs in the data may cover more or less than one year. So the loss should be (f(x)*duration - target)^2 where duration is in units of years. To make it more "standard" we instead consider the weighted squared loss, since (f(x)*duration - target)^2 = duration^2 * (f(x) - target/duration)^2 = w * (f(x) - normalized_target)^2

Definition at line 971 of file SDBVMat.h.


Member Typedef Documentation

typedef SDBVMField PLearn::SDBVMFieldICBCTargets::inherited [private]
 

Definition at line 973 of file SDBVMat.h.

Referenced by SDBVMFieldICBCTargets().


Constructor & Destructor Documentation

PLearn::SDBVMFieldICBCTargets::SDBVMFieldICBCTargets Schema  schema,
bool  use_roadstar,
bool  add_claims_sum_column,
bool  rescale_by_interval,
bool  rescale_by_start_date,
Mat start_date_rescaling_values,
const string targetname = "ALL"
 

Definition at line 953 of file SDBVMat.cc.

References inherited, PLearn::Mat, reference_start_date_month_, reference_start_date_year_, rescale_by_start_date_, and start_date_rescaling_values_.


Member Function Documentation

void PLearn::SDBVMFieldICBCTargets::convertField const SDBWithStats sdb,
const Row row,
const Vec output
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 1014 of file SDBVMat.cc.

References accident_death_count_, accident_death_incurred_, add_claims_sum_column_, bodily_injury_count_, bodily_injury_incurred_, collision_lou_count_, collision_lou_incurred_, comprehensive_count_, comprehensive_incurred_, end_date_, PLearn::endl(), PLearn::SDBVMSource::getValue(), PLearn::is_missing(), PLearn::PDate::month, PLERROR, property_damage_count_, property_damage_incurred_, reference_start_date_month_, reference_start_date_year_, rescale_by_interval_, rescale_by_start_date_, start_date_, start_date_rescaling_values_, targetname_, PLearn::FieldValue::toDate(), PLearn::Vec, and PLearn::PDate::year.

virtual int PLearn::SDBVMFieldICBCTargets::fieldWidth  )  const [inline, virtual]
 

Width that the field occupies in the VMat.

Implements PLearn::SDBVMField.

Definition at line 983 of file SDBVMat.h.


Member Data Documentation

SDBVMSource PLearn::SDBVMFieldICBCTargets::accident_death_count_ [protected]
 

Definition at line 1018 of file SDBVMat.h.

Referenced by convertField().

SDBVMSource PLearn::SDBVMFieldICBCTargets::accident_death_incurred_ [protected]
 

Definition at line 1012 of file SDBVMat.h.

Referenced by convertField().

SDBVMSource PLearn::SDBVMFieldICBCTargets::accident_death_severity_ [protected]
 

Definition at line 1024 of file SDBVMat.h.

bool PLearn::SDBVMFieldICBCTargets::add_claims_sum_column_ [protected]
 

Definition at line 1001 of file SDBVMat.h.

Referenced by convertField().

SDBVMSource PLearn::SDBVMFieldICBCTargets::bodily_injury_count_ [protected]
 

Definition at line 1016 of file SDBVMat.h.

Referenced by convertField().

SDBVMSource PLearn::SDBVMFieldICBCTargets::bodily_injury_incurred_ [protected]
 

Definition at line 1010 of file SDBVMat.h.

Referenced by convertField().

SDBVMSource PLearn::SDBVMFieldICBCTargets::bodily_injury_severity_ [protected]
 

Definition at line 1022 of file SDBVMat.h.

SDBVMSource PLearn::SDBVMFieldICBCTargets::collision_lou_count_ [protected]
 

Definition at line 1019 of file SDBVMat.h.

Referenced by convertField().

SDBVMSource PLearn::SDBVMFieldICBCTargets::collision_lou_incurred_ [protected]
 

Definition at line 1013 of file SDBVMat.h.

Referenced by convertField().

SDBVMSource PLearn::SDBVMFieldICBCTargets::collision_lou_severity_ [protected]
 

Definition at line 1025 of file SDBVMat.h.

SDBVMSource PLearn::SDBVMFieldICBCTargets::comprehensive_count_ [protected]
 

Definition at line 1020 of file SDBVMat.h.

Referenced by convertField().

SDBVMSource PLearn::SDBVMFieldICBCTargets::comprehensive_incurred_ [protected]
 

Definition at line 1014 of file SDBVMat.h.

Referenced by convertField().

SDBVMSource PLearn::SDBVMFieldICBCTargets::comprehensive_severity_ [protected]
 

Definition at line 1026 of file SDBVMat.h.

SDBVMSource PLearn::SDBVMFieldICBCTargets::end_date_ [protected]
 

Definition at line 1009 of file SDBVMat.h.

Referenced by convertField().

SDBVMSource PLearn::SDBVMFieldICBCTargets::property_damage_count_ [protected]
 

Definition at line 1017 of file SDBVMat.h.

Referenced by convertField().

SDBVMSource PLearn::SDBVMFieldICBCTargets::property_damage_incurred_ [protected]
 

Definition at line 1011 of file SDBVMat.h.

Referenced by convertField().

SDBVMSource PLearn::SDBVMFieldICBCTargets::property_damage_severity_ [protected]
 

Definition at line 1023 of file SDBVMat.h.

int PLearn::SDBVMFieldICBCTargets::reference_start_date_month_ [protected]
 

Definition at line 1007 of file SDBVMat.h.

Referenced by convertField(), and SDBVMFieldICBCTargets().

int PLearn::SDBVMFieldICBCTargets::reference_start_date_year_ [protected]
 

Definition at line 1006 of file SDBVMat.h.

Referenced by convertField(), and SDBVMFieldICBCTargets().

bool PLearn::SDBVMFieldICBCTargets::rescale_by_interval_ [protected]
 

Definition at line 1002 of file SDBVMat.h.

Referenced by convertField().

bool PLearn::SDBVMFieldICBCTargets::rescale_by_start_date_ [protected]
 

Definition at line 1003 of file SDBVMat.h.

Referenced by convertField(), and SDBVMFieldICBCTargets().

SDBVMSource PLearn::SDBVMFieldICBCTargets::start_date_ [protected]
 

Definition at line 1008 of file SDBVMat.h.

Referenced by convertField().

Mat PLearn::SDBVMFieldICBCTargets::start_date_rescaling_values_ [protected]
 

Definition at line 1004 of file SDBVMat.h.

Referenced by convertField(), and SDBVMFieldICBCTargets().

string PLearn::SDBVMFieldICBCTargets::targetname_ [protected]
 

Definition at line 1005 of file SDBVMat.h.

Referenced by convertField().

bool PLearn::SDBVMFieldICBCTargets::use_roadstar_ [protected]
 

Definition at line 1000 of file SDBVMat.h.


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:23:00 2004 for PLearn by doxygen 1.3.7