# dm.models.predictor package

## Submodules

## dm.models.predictor.THPredictorUtil module

Support for ventilation length prediction.

Creates training and testing sets for ventilation length prediction, including calculation of distance between a data point and cluster trendline (cluster centroid).

`dm.models.predictor.THPredictorUtil.``training_testing_data`(data, splitting)

  It creates training and testing data set.

  Parameters

    - data – dictionary of data

    - splitting – the percentage part of data used for training purposes

  Returns

    training, testing data sets and minimal number of events that lasted certain time

`dm.models.predictor.THPredictorUtil.``training_testing_data_only_distance`(training, testing, strategy, strategyFlag, one_line, test_points, cluster_boundaries, cluster_boundaries_all, training_file, testing_file)

  It creates training and testing data sets including only attributes related to distance.

  Parameters

    - training – list of training data

    - testing – list of testing data

    - strategy – strategy how to compute a slope of line(s)

    - strategyFlag – flag that denotes a used strategy for computation of a slope of line(s)

    - one_line – if only one line should be plotted

    - test_points – true if test points are plotted

    - cluster_boundaries – if cluster boundaries should be plotted

    - cluster_boundaries_all – if all cluster boundaries should be plotted

    - training_file – filename to which training data set is written

    - testing_file – filename to which training data set is written

  Returns

    training and testing data sets including only attributes related to distance

`dm.models.predictor.THPredictorUtil.``training_testing_data_with_distance`(training, testing, strategy, strategyFlag, one_line, test_points, cluster_boundaries, cluster_boundaries_all, training_file, testing_file)

  It creates training and testing data sets including attributes related to distance.

  Parameters

    - training – list of training data

    - testing – list of testing data

    - strategy – strategy how to compute a slope of line(s)

    - strategyFlag – flag that denotes a used strategy for computation of a slope of line(s)

    - one_line – if only one line should be plotted

    - test_points – true if test points are plotted

    - cluster_boundaries – if cluster boundaries should be plotted

    - cluster_boundaries_all – if all cluster boundaries should be plotted

    - training_file – filename to which training data set is written

    - testing_file – filename to which training data set is written

  Returns

    training and testing data sets including attributes related to distance

`dm.models.predictor.THPredictorUtil.``training_testing_data_without_distance`(training, testing, strategy, strategyFlag, one_line, test_points, cluster_boundaries, cluster_boundaries_all, training_file, testing_file)

  It creates training and testing data sets without attributes related to distance.

  Parameters

    - training – list of training data

    - testing – list of testing data

    - strategy – deprecated

    - strategyFlag – deprecated

    - one_line – deprecated

    - test_points – deprecated

    - cluster_boundaries – deprecated

    - cluster_boundaries_all – deprecated

    - training_file – filename to which training data set is written

    - testing_file – filename to which training data set is written

  Returns

    training and testing data sets without attributes related to distance

## dm.models.predictor.generic_training_file module

Creates adapted models for predictor of optimal ventilation length.

`dm.models.predictor.generic_training_file.``create_bins`(data, bins)

  It creates required number of bins.

  Parameters

    - data – dictionary of data

    - bins – number of bins

  Returns

    dictionary of data

`dm.models.predictor.generic_training_file.``training_data`(json_f, cls, devs, model_type, interval_extension, mapper, func, lat, lon, weather)

  It creates training data.

  Parameters

    - json_f – dictionary of data

    - cls – list of clients

    - devs – list of devices

    - model_type – type of model - based on CO2 concentration or temperature and humidity

    - interval_extension – time shift that is subtracted or added to start or end of an interval respectively

    - mapper – dictionary containing mapping of attribute name in database to the name used in dataset

    - func – object that determines function used for attribute calculation

    - lat – latitude of a locality

    - lon – longitude of a locality

    - weather – object used to get information about weather

  Returns

    dictionary of training data

`dm.models.predictor.generic_training_file.``training_file_co2`(events_file: str, no_event_time_shift: int, cls, devs, lat, lon, weather)

  It creates training data for predictor based on CO2 concentration.

  Parameters

    - events_file – file containing events

    - no_event_time_shift – number of seconds subtracted from start of event to define event when a window was closed

    - cls – list of clients

    - devs – list of devices

    - lat – latitude of a locality

    - lon – longitude of a locality

    - weather – object used to get information about weather

  Returns

    dictionary of training data for predictor based on CO2 concentration

`dm.models.predictor.generic_training_file.``training_file_t_h`(events_file: str, no_event_time_shift: int, cls, devs, lat, lon, weather)

  It creates training data for predictor based on temperature and humidity.

  Parameters

    - events_file – file containing events

    - no_event_time_shift – number of seconds subtracted from start of event to define event when a window was closed

    - cls – list of clients

    - devs – list of devices

    - lat – latitude of a locality

    - lon – longitude of a locality

    - weather – object used to get information about weather

  Returns

    dictionary of training data for predictor based on temperature and humidity

## dm.models.predictor.generic_training_file_from_local_db module

Creates training datasets from local database.

`dm.models.predictor.generic_training_file_from_local_db.``create_bins`(data, bins)

  It creates required number of bins.

  Parameters

    - data – dictionary of data

    - bins – number of bins

  Returns

    dictionary of data

`dm.models.predictor.generic_training_file_from_local_db.``training_file_co2`(events_file: str, no_event_time_shift: int)

  It creates training data for predictor based on CO2 concentration.

  Parameters

    - events_file – file containing events

    - no_event_time_shift – number of seconds subtracted from start of event to define event when a window was closed

  Returns

    dictionary of training data for predictor based on CO2 concentration.

`dm.models.predictor.generic_training_file_from_local_db.``training_file_t_h`(events_file: str, no_event_time_shift: int)

  It creates training data for predictor based on temperature and humidity.

  Parameters

    - events_file – file containing events

    - no_event_time_shift – number of seconds subtracted from start of event to define event when a window was closed

  Returns

    dictionary of training data for predictor based on temperature and humidity.

## Module contents