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

PLearn::YMDDatedVMatrix Class Reference

#include <YMDDatedVMatrix.h>

Inheritance diagram for PLearn::YMDDatedVMatrix:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 YMDDatedVMatrix ()
 default constructor (for automatic deserialization)

 YMDDatedVMatrix (VMat data_, Mat years_, Mat months_, Mat days_)
 THE DATES MUST BE IN INCREASING CHRONOLOGICAL ORDER.

 YMDDatedVMatrix (Mat &YMD_and_data)
 alternatively, the given matrix has (year, month, day) in the first 3 columns and the rest of the data in the remaining columns.

 PLEARN_DECLARE_OBJECT (YMDDatedVMatrix)
virtual void build ()
 Should call simply inherited::build(), then this class's build_().

int nDateFields ()
 return the number of real fields required to specify a date: here 3 for YMD

VMat subDistrRelativeDates (int first, int n, const string &units)
VMat subDistrRelativeYears (int first_relative_year, int n_years)
VMat subDistrRelativeMonths (int first_relative_month, int n_months)
VMat subDistrRelativeDays (int first_relative_day, int n_days)
VMat subDistrAbsoluteYears (int year, int month, int day, int n_years)
 sub-distribution starting at the given date, for the given number of occured years, months or days

VMat subDistrAbsoluteMonths (int year, int month, int day, int n_months)
VMat subDistrAbsoluteDays (int year, int month, int day, int n_days)
VMat subDistrAbsoluteUnits (int year, int month, int day, int n_units, const string &units)
int lengthInDates (const string &units)
 return "size" in the given units (e.g.

int positionOfRelativeDate (int first, const string &units)
 return row position of example whose relative date is the first with the given (relative) value, in the given time units

int positionOfDate (int year, int month, int day)
 return row position associated with first sample whose date is given

void copyDatesOfRows (int from_row, int n_rows, Mat &dates)
 copy the date fields for the relative positions starting at the given row position for the given number of rows, into the given matrix

Vec copyRowDataAndDate (int row, int &year, int &month, int &day)
void copyDateOfRow (int row, int &year, int &month, int &day)
virtual void reset_dimensions ()
 in case the dimensions of an underlying vmat has changed, recompute it


Static Public Member Functions

void declareOptions (OptionList &ol)
 redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down)


Public Attributes

VMat data

Protected Attributes

Mat years
 single column of years (e.g. 1987), one year per data row

Mat months
 single column of months (between 1 and 12), one month per data row

Mat days
 single column of days (between 1 and 31), one day per data row

Vec pos_of_ith_year
 row index of first row of i-th year in the data

Vec pos_of_ith_month
 row index of first row of i-th month in the data

Vec pos_of_ith_day
 row index of first row of i-th month in the data

Vec day_of_ith_pos
 inverse map of pos_of_ith_day

Array< TMat< int > > pos_of_date
 dates[year-years(0,0)][month-1][day-1] is the


Private Types

typedef DatedVMatrix inherited

Private Member Functions

void build_ ()
 This does the actual building.


Detailed Description

A DatedVMatrix that knows about years, months, and days, and for which the relative differences between two dates (e.g. days) depends on the number of different values of that unit (e.g. the number of days which actually occur).

Definition at line 58 of file YMDDatedVMatrix.h.


Member Typedef Documentation

typedef DatedVMatrix PLearn::YMDDatedVMatrix::inherited [private]
 

Reimplemented from PLearn::DatedVMatrix.

Definition at line 60 of file YMDDatedVMatrix.h.

Referenced by YMDDatedVMatrix().


Constructor & Destructor Documentation

PLearn::YMDDatedVMatrix::YMDDatedVMatrix  ) 
 

default constructor (for automatic deserialization)

Definition at line 48 of file YMDDatedVMatrix.cc.

PLearn::YMDDatedVMatrix::YMDDatedVMatrix VMat  data_,
Mat  years_,
Mat  months_,
Mat  days_
 

THE DATES MUST BE IN INCREASING CHRONOLOGICAL ORDER.

Warning: VMFields are NOT YET handled by this constructor

Definition at line 52 of file YMDDatedVMatrix.cc.

References build(), inherited, and PLearn::Mat.

PLearn::YMDDatedVMatrix::YMDDatedVMatrix Mat YMD_and_data  ) 
 

alternatively, the given matrix has (year, month, day) in the first 3 columns and the rest of the data in the remaining columns.

Warning: VMFields are NOT YET handled by this constructor

Definition at line 59 of file YMDDatedVMatrix.cc.

References build().


Member Function Documentation

void PLearn::YMDDatedVMatrix::build  )  [virtual]
 

Should call simply inherited::build(), then this class's build_().

This method should be callable again at later times, after modifying some option fields to change the "architecture" of the object.

Reimplemented from PLearn::DatedVMatrix.

Definition at line 70 of file YMDDatedVMatrix.cc.

References build_().

Referenced by YMDDatedVMatrix().

void PLearn::YMDDatedVMatrix::build_  )  [private]
 

This does the actual building.

Reimplemented from PLearn::DatedVMatrix.

Definition at line 76 of file YMDDatedVMatrix.cc.

References data, day_of_ith_pos, days, PLearn::TVec< T >::isEmpty(), PLearn::TMat< T >::isNotEmpty(), PLearn::PP< VMatrix >::isNotNull(), PLearn::VMat::length(), PLearn::TMat< T >::length(), months, PLERROR, pos_of_date, pos_of_ith_day, pos_of_ith_month, pos_of_ith_year, PLearn::TVec< T >::resize(), PLearn::TVec< TMat< int > >::resize(), and years.

Referenced by build().

void PLearn::YMDDatedVMatrix::copyDateOfRow int  row,
int year,
int month,
int day
[virtual]
 

Implements PLearn::DatedVMatrix.

Definition at line 342 of file YMDDatedVMatrix.cc.

References days, months, and years.

void PLearn::YMDDatedVMatrix::copyDatesOfRows int  from_row,
int  n_rows,
Mat dates
[virtual]
 

copy the date fields for the relative positions starting at the given row position for the given number of rows, into the given matrix

Implements PLearn::DatedVMatrix.

Definition at line 324 of file YMDDatedVMatrix.cc.

References days, months, PLearn::TMat< T >::resize(), and years.

Vec PLearn::YMDDatedVMatrix::copyRowDataAndDate int  row,
int year,
int month,
int day
[virtual]
 

Implements PLearn::DatedVMatrix.

Definition at line 335 of file YMDDatedVMatrix.cc.

References data, days, months, and years.

void PLearn::YMDDatedVMatrix::declareOptions OptionList ol  )  [static]
 

redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down)

ex: static void declareOptions(OptionList& ol) { declareOption(ol, "inputsize", &MyObject::inputsize_, OptionBase::buildoption, "the size of the input\n it must be provided"); declareOption(ol, "weights", &MyObject::weights, OptionBase::learntoption, "the learnt model weights"); inherited::declareOptions(ol); }

Reimplemented from PLearn::DatedVMatrix.

Definition at line 184 of file YMDDatedVMatrix.cc.

References PLearn::declareOption(), and PLearn::OptionList.

int PLearn::YMDDatedVMatrix::lengthInDates const string units  )  [virtual]
 

return "size" in the given units (e.g.

interval in years, months, etc...) here e.g. the number of different years (if units=="years").

Implements PLearn::DatedVMatrix.

Definition at line 296 of file YMDDatedVMatrix.cc.

References PLearn::TVec< T >::length(), PLERROR, pos_of_ith_day, pos_of_ith_month, and pos_of_ith_year.

int PLearn::YMDDatedVMatrix::nDateFields  )  [inline, virtual]
 

return the number of real fields required to specify a date: here 3 for YMD

Implements PLearn::DatedVMatrix.

Definition at line 96 of file YMDDatedVMatrix.h.

PLearn::YMDDatedVMatrix::PLEARN_DECLARE_OBJECT YMDDatedVMatrix   ) 
 

int PLearn::YMDDatedVMatrix::positionOfDate int  year,
int  month,
int  day
 

return row position associated with first sample whose date is given

Definition at line 227 of file YMDDatedVMatrix.cc.

References PLERROR, pos_of_date, and years.

Referenced by subDistrAbsoluteDays(), subDistrAbsoluteMonths(), and subDistrAbsoluteYears().

int PLearn::YMDDatedVMatrix::positionOfRelativeDate int  first,
const string units
[virtual]
 

return row position of example whose relative date is the first with the given (relative) value, in the given time units

Implements PLearn::DatedVMatrix.

Definition at line 310 of file YMDDatedVMatrix.cc.

References PLERROR, pos_of_ith_day, pos_of_ith_month, and pos_of_ith_year.

virtual void PLearn::YMDDatedVMatrix::reset_dimensions  )  [inline, virtual]
 

in case the dimensions of an underlying vmat has changed, recompute it

Reimplemented from PLearn::VMatrix.

Definition at line 136 of file YMDDatedVMatrix.h.

References PLERROR.

VMat PLearn::YMDDatedVMatrix::subDistrAbsoluteDays int  year,
int  month,
int  day,
int  n_days
 

Definition at line 259 of file YMDDatedVMatrix.cc.

References data, day_of_ith_pos, pos_of_ith_day, positionOfDate(), and PLearn::VMat::subMatRows().

Referenced by subDistrAbsoluteUnits().

VMat PLearn::YMDDatedVMatrix::subDistrAbsoluteMonths int  year,
int  month,
int  day,
int  n_months
 

Definition at line 250 of file YMDDatedVMatrix.cc.

References data, positionOfDate(), and PLearn::VMat::subMatRows().

Referenced by subDistrAbsoluteUnits().

VMat PLearn::YMDDatedVMatrix::subDistrAbsoluteUnits int  year,
int  month,
int  day,
int  n_units,
const string units
[virtual]
 

this one calls one of subDistrRelative{Years,Months,Days} according to wether units=="years", "months", or "days" (or if the first letter matches, irrespective of upper/lower case distinctions)

Implements PLearn::DatedVMatrix.

Definition at line 267 of file YMDDatedVMatrix.cc.

References PLERROR, subDistrAbsoluteDays(), subDistrAbsoluteMonths(), and subDistrAbsoluteYears().

VMat PLearn::YMDDatedVMatrix::subDistrAbsoluteYears int  year,
int  month,
int  day,
int  n_years
 

sub-distribution starting at the given date, for the given number of occured years, months or days

Definition at line 243 of file YMDDatedVMatrix.cc.

References data, positionOfDate(), and PLearn::VMat::subMatRows().

Referenced by subDistrAbsoluteUnits().

VMat PLearn::YMDDatedVMatrix::subDistrRelativeDates int  first,
int  n,
const string units
[virtual]
 

this one calls one of subDistrRelative{Years,Months,Days} according to wether units=="years", "months", or "days" (or if the first letter matches, irrespective of upper/lower case distinctions)

Implements PLearn::DatedVMatrix.

Definition at line 282 of file YMDDatedVMatrix.cc.

References PLearn::Mat, PLERROR, subDistrRelativeDays(), subDistrRelativeMonths(), and subDistrRelativeYears().

VMat PLearn::YMDDatedVMatrix::subDistrRelativeDays int  first_relative_day,
int  n_days
 

Definition at line 216 of file YMDDatedVMatrix.cc.

References data, PLearn::TVec< T >::length(), PLERROR, pos_of_ith_day, and PLearn::VMat::subMatRows().

Referenced by subDistrRelativeDates().

VMat PLearn::YMDDatedVMatrix::subDistrRelativeMonths int  first_relative_month,
int  n_months
 

Definition at line 205 of file YMDDatedVMatrix.cc.

References data, PLearn::TVec< T >::length(), PLERROR, pos_of_ith_month, and PLearn::VMat::subMatRows().

Referenced by subDistrRelativeDates().

VMat PLearn::YMDDatedVMatrix::subDistrRelativeYears int  first_relative_year,
int  n_years
 

Definition at line 194 of file YMDDatedVMatrix.cc.

References data, PLearn::TVec< T >::length(), PLERROR, pos_of_ith_year, and PLearn::VMat::subMatRows().

Referenced by subDistrRelativeDates().


Member Data Documentation

VMat PLearn::YMDDatedVMatrix::data
 

Definition at line 63 of file YMDDatedVMatrix.h.

Referenced by build_(), copyRowDataAndDate(), subDistrAbsoluteDays(), subDistrAbsoluteMonths(), subDistrAbsoluteYears(), subDistrRelativeDays(), subDistrRelativeMonths(), and subDistrRelativeYears().

Vec PLearn::YMDDatedVMatrix::day_of_ith_pos [protected]
 

inverse map of pos_of_ith_day

Definition at line 71 of file YMDDatedVMatrix.h.

Referenced by build_(), and subDistrAbsoluteDays().

Mat PLearn::YMDDatedVMatrix::days [protected]
 

single column of days (between 1 and 31), one day per data row

Definition at line 67 of file YMDDatedVMatrix.h.

Referenced by build_(), copyDateOfRow(), copyDatesOfRows(), and copyRowDataAndDate().

Mat PLearn::YMDDatedVMatrix::months [protected]
 

single column of months (between 1 and 12), one month per data row

Definition at line 66 of file YMDDatedVMatrix.h.

Referenced by build_(), copyDateOfRow(), copyDatesOfRows(), and copyRowDataAndDate().

Array< TMat<int> > PLearn::YMDDatedVMatrix::pos_of_date [protected]
 

dates[year-years(0,0)][month-1][day-1] is the

Definition at line 72 of file YMDDatedVMatrix.h.

Referenced by build_(), and positionOfDate().

Vec PLearn::YMDDatedVMatrix::pos_of_ith_day [protected]
 

row index of first row of i-th month in the data

Definition at line 70 of file YMDDatedVMatrix.h.

Referenced by build_(), lengthInDates(), positionOfRelativeDate(), subDistrAbsoluteDays(), and subDistrRelativeDays().

Vec PLearn::YMDDatedVMatrix::pos_of_ith_month [protected]
 

row index of first row of i-th month in the data

Definition at line 69 of file YMDDatedVMatrix.h.

Referenced by build_(), lengthInDates(), positionOfRelativeDate(), and subDistrRelativeMonths().

Vec PLearn::YMDDatedVMatrix::pos_of_ith_year [protected]
 

row index of first row of i-th year in the data

Definition at line 68 of file YMDDatedVMatrix.h.

Referenced by build_(), lengthInDates(), positionOfRelativeDate(), and subDistrRelativeYears().

Mat PLearn::YMDDatedVMatrix::years [protected]
 

single column of years (e.g. 1987), one year per data row

Definition at line 65 of file YMDDatedVMatrix.h.

Referenced by build_(), copyDateOfRow(), copyDatesOfRows(), copyRowDataAndDate(), and positionOfDate().


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