Base time splitting method.
Copyright: | 2016 David Monllao {@link http://www.davidmonllao.com} |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 311 lines (9 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
base:: (18 methods):
get_id()
set_analysable()
set_modelid()
get_analysable()
is_valid_analysable()
ready_to_predict()
ready_to_train()
get_all_ranges()
get_training_ranges()
get_distinct_ranges()
get_most_recent_prediction_range()
get_range_by_index()
append_rangeindex()
infer_sample_info()
include_range_info_in_training_data()
cache_indicator_calculations()
valid_for_evaluation()
validate_ranges()
get_id() X-Ref |
Returns the time splitting method id. return: string |
set_analysable(\core_analytics\analysable $analysable) X-Ref |
Assigns the analysable and updates the time ranges according to the analysable start and end dates. param: \core_analytics\analysable $analysable return: void |
set_modelid(int $modelid) X-Ref |
Assigns the model id to this time-splitting method it case it needs it. param: int $modelid |
get_analysable() X-Ref |
get_analysable return: \core_analytics\analysable |
is_valid_analysable(\core_analytics\analysable $analysable) X-Ref |
Returns whether the course can be processed by this time splitting method or not. param: \core_analytics\analysable $analysable return: bool |
ready_to_predict($range) X-Ref |
Should we predict this time range now? param: array $range return: bool |
ready_to_train($range) X-Ref |
Should we use this time range for training? param: array $range return: bool |
get_all_ranges() X-Ref |
Returns the ranges used by this time splitting method. return: array |
get_training_ranges() X-Ref |
By default all ranges are for training. return: array |
get_distinct_ranges() X-Ref |
Returns the distinct range indexes in this time splitting method. return: int[] |
get_most_recent_prediction_range() X-Ref |
Returns the most recent range that can be used to predict. This method is only called when calculating predictions. return: array |
get_range_by_index($rangeindex) X-Ref |
Returns range data by its index. param: int $rangeindex return: array|false Range data or false if the index is not part of the existing ranges. |
append_rangeindex($sampleid, $rangeindex) X-Ref |
Generates a unique sample id (sample in a range index). param: int $sampleid param: int $rangeindex return: string |
infer_sample_info($uniquesampleid) X-Ref |
Returns the sample id and the range index from a uniquesampleid. param: string $uniquesampleid return: array array($sampleid, $rangeindex) |
include_range_info_in_training_data() X-Ref |
Whether to include the range index in the training data or not. By default, we consider that the different time ranges included in a time splitting method may not be compatible between them (i.e. the indicators calculated at the end of the course can easily differ from indicators calculated at the beginning of the course). So we include the range index as one of the variables that the machine learning backend uses to generate predictions. If the indicators calculated using the different time ranges available in this time splitting method are comparable you can overwrite this method to return false. Note that: - This is only relevant for models whose predictions are not based on assumptions (i.e. the ones using a machine learning backend to generate predictions). - The ranges can only be included in the training data when we know the final number of ranges the time splitting method will have. E.g. We can not know the final number of ranges of a 'daily' time splitting method as we will have one new range every day. return: bool |
cache_indicator_calculations() X-Ref |
Whether to cache or not the indicator calculations. Indicator calculations are stored to be reused across models. The calculations are indexed by the calculation start and end time, and these times depend on the time-splitting method. You should overwrite this method and return false if the time frames generated by your time-splitting method are unique and / or can hardly be reused by further models. return: bool |
valid_for_evaluation() X-Ref |
Is this method valid to evaluate prediction models? return: bool |
validate_ranges() X-Ref |
Validates the time splitting method ranges. return: void |