SummaryMeasureGenerator: SummaryMeasureGenerator

Description Usage Format Methods

Description

This is a decorator for a general Data.Base object. It retrieves data from it, processes it, and returns a data frame containing the summary measure provided. Currently it only provides the lag of the data, but this could be extended with for example the mean, variance, MSSD of the data to the super learner machine learning model.

Usage

1

Format

An object of class R6ClassGenerator of length 24.

Methods

initialize(data = NULL, SMG.list, verbose = FALSE, pre_processor = NULL)

Initializes a new SummaryMeasureGenerator. Note that generating a new SMG can also be done using the SMGFactory class.

@param data Data.Base (default = NULL) the data to use as the basis to generate the summary measures from. This should be an instance of a Data.Base object or NULL. When NULL, the actual data should be provided later, prior to actually using this object.

@param SMG.list list the list of SummaryMeasureGenerator objects to use.

@param verbose (default = FALSE) the verbosity of the SummaryMeasureGenerator.

@param pre_processor PreProcessor (default = NULL) the PreProcessor to use for processing the data. This is an optional parameter. If NULL the data won't be preprocessed / normalized.

reset()

Removes all data in the SMG and resets it to a neutral state.

check_enough_data_available(relevantVariables)

This function asks each of the provided SMGs how much data they need to generate a new block. This function returns a boolean representing whether or not this condition is met.

@param relevantVariables list the relevant variables for which we want to check if enough data is available.

setData(data)

The object can be initialized without any data. This function can then be used to inject the data to use.

@param data Data.Base the data to set in the instance.

fillCache()

Some of the SMG's need a cache of data to be available before they can generate a new observation. This function fills this cache and makes sure enough data is available.

@return boolean representing whether the cache was actually updated.

get_latest_covariates(data)

For online learning we need to be able to create new data blocks on the fly (as not all data is available beforehand. This function updates a set of variables to contain the current variables as well. This function can be used to get the last set of covariates given a data.table of current blocks

@param data data.table the currently available data.

@return the updated / latest available data.table.

summarize_data(data, n = 1)

Returns the latest n rows from the processed (the blocks) data.

@param data data.table the data currently available for the SMGs (e.g., the cache of this class).

@param n integer (default = 1) the number of blocks to retrieve from the data.

getNext(n = 1)

Gets the next n blocks from a data set. This uses most functions in this class and is probably the most useful function. It summarizes the data, refreshes the cache, and returns the new blocks.

@param n integer (default = 1) the number of blocks one wants to retrieve.

@return data.table the data.table generated by this function.

set_minimal_measurements_needed(minimal_measurements_needed)

Setter for the minimal measurements needed by all SMGs.

@param minimal_measurements_needed integer the minimal number of measurements needed. This is the maximum of all maxima of the SMGs.

get_pre_processor

Active method. Returns the preprocessor provided on initialization.

@return PreProcessor the PreProcessor instance (or NULL if none is available).

is_normalized

Active method. Returns a boolean representing whether we hae normalized the data.

@return boolean representing whether we hae normalized the data.

getCache

Active method. Returns the cache of the SummaryMeasureGenerator.

@return data.table the stored cache.

get_data_object

Active method. Returns the data of the current instance.

@return Data.Base the instance of the data passed in on initialization or using the setter.

get_smg_list

Active method. Returns the list of SMG objects that were provided on initialization.

@return list the used SMG instances.

get_minimal_measurements_needed

Active method. Returns the number of minimal measurements needed for the SummaryMeasureGenerators to function properly.

@return integer the minimal number of measurements needed.


frbl/OnlineSuperLearner documentation built on Feb. 9, 2020, 9:28 p.m.