traveltimes_prediction.models package¶
Subpackages¶
- traveltimes_prediction.models.algorithms package
- Submodules
- traveltimes_prediction.models.algorithms.dbscan_wrapper module
- traveltimes_prediction.models.algorithms.elastic_net_wrapper module
- traveltimes_prediction.models.algorithms.linear_regression_wrapper module
- traveltimes_prediction.models.algorithms.mbkmeans_wrapper module
- traveltimes_prediction.models.algorithms.ridge_wrapper module
- traveltimes_prediction.models.algorithms.svr_wrapper module
- Module contents
Submodules¶
traveltimes_prediction.models.base_model module¶
-
class
traveltimes_prediction.models.base_model.
BaseModel
[source]¶ Bases:
object
-
dump
()[source]¶ Method for dumping of the model - saving all the necessary data for recreation & usage.
Returns: dict
-
fit
(X, Y)[source]¶ Method for fitting of the model.
Parameters: - X (pd.DataFrame) –
- Y (pd.DataFrame/pd.Series) –
Returns: self
-
static
load
(model)[source]¶ Method for recreating the model - creating new instance.
Parameters: model (dict) – dumped model Returns: BaseModel - instance of class derived from BaseModel
-
name
= None¶
-
traveltimes_prediction.models.cluster_model module¶
-
class
traveltimes_prediction.models.cluster_model.
ClusterModel
(regressor=None, regressor_params=None, clusterizer=None, clusterizer_params=None)[source]¶ Bases:
sklearn.base.BaseEstimator
,traveltimes_prediction.models.base_model.BaseModel
Regression model. Perform clustering on training data and train individual regressor for each cluster.
-
dump
()[source]¶ Method for dumping of the model.
Returns: dict - keys are names of attributes, values are their values
-
fit
(*args, **kwargs)¶
-
static
load
(model)[source]¶ Method for loading of the dumped model
Parameters: model (dict) – Returns: obj
-
name
= 'ClusterModel'¶
-
predict
(*args, **kwargs)¶
-
traveltimes_prediction.models.combined_model module¶
-
class
traveltimes_prediction.models.combined_model.
CombinedModel
(models=None, models_params=None, stacking_function=<function CombinedModel.<lambda>>)[source]¶ Bases:
sklearn.base.BaseEstimator
,traveltimes_prediction.models.base_model.BaseModel
Class - estimator. combination of multiple models.
-
dump
()[source]¶ Method for dumping of the model.
Returns: dict - keys are names of attributes, values are their values
-
fit
(X, Y)[source]¶ Method for fitting the model.
Parameters: - X (np.ndarray) – matrix of features - SxF
- Y (np.ndarray) – matrix of outputs - S
Returns:
-
static
load
(model)[source]¶ Method for loading of the dumped model
Parameters: model (dict) – Returns: obj
-
name
= 'CombinedModel'¶
-
predict
(*args, **kwargs)¶
-
traveltimes_prediction.models.create_model module¶
-
traveltimes_prediction.models.create_model.
create_model
(model_dump)[source]¶ Method for recreation of the model from dumps.
Parameters: model_dump (dict) – Returns:
traveltimes_prediction.models.time_domain_model module¶
-
class
traveltimes_prediction.models.time_domain_model.
TimeDomainModel
(regressor=None, regressor_params=None)[source]¶ Bases:
sklearn.base.BaseEstimator
,traveltimes_prediction.models.base_model.BaseModel
Regression model. Split data from each day to X minute windows (according to X[ColumnNames.FEAT_TIME_BIN]). Group windows by time. For each group of windows + adjacent groups to this group train individual regressor.
-
dump
()[source]¶ Method for for dumping of the model.
Returns: dict - Model dumped as dictionary, with keys as params` names and values as values of the params
-
fit
(X, Y)[source]¶ Method for fitting of the model.
Parameters: - X (pp.DataFrame) – data matrix X for training
- Y (pd.DataFrame) – data vector Y - outputs
Returns: self
-
static
load
(model)[source]¶ Method for creation of the model from its dump.
Parameters: model (dict) – Dumped model, keys are params` names, values are values. Returns: object - instance of TimeDomainModel created from its dump
-
name
= 'TimeDomainModel'¶
-
predict
(*args, **kwargs)¶
-