traveltimes_prediction.models.algorithms package

Submodules

traveltimes_prediction.models.algorithms.dbscan_wrapper module

class traveltimes_prediction.models.algorithms.dbscan_wrapper.DBScanWrapper(eps=0.5, min_samples=5, metric='euclidean', algorithm='auto', leaf_size=30, p=None, n_jobs=1)[source]

Bases: traveltimes_prediction.models.base_model.BaseModel, sklearn.cluster.dbscan_.DBSCAN

Class-wrapper for DBSCAN - allowing to predict the cluster of given sample.

dump()[source]

Method for dumping of the important features of algorithm allowing to reconstruct it.

Returns:dict - important features are values in dict with corresponding keys
fit(X, y=None, sample_weight=None)[source]

Fit method for retrieving the cluster labels. The predictor of clusters` labels is fitted here too.

Parameters:
  • X (np.ndarray) – features matrix -> SxF
  • y (np.ndarray) – true values vector -> S
  • sample_weight
Returns:

self

static load(dumped_model)[source]

Method for loading (setting) the clusterizer from dumped dict.

Parameters:dumped_model (dict) –
Returns:self
name = 'DBSCAN'
predict(X)[source]

Method for prediction of the cluster for given samples. Cluster is predicted using kNN algorithm.

Parameters:X (np.ndarray) – samples to predict(feature) -> SxF
Returns:np.ndarray predicted labels -> S

traveltimes_prediction.models.algorithms.elastic_net_wrapper module

class traveltimes_prediction.models.algorithms.elastic_net_wrapper.ElasticNetWrapper(**kwargs)[source]

Bases: sklearn.linear_model.coordinate_descent.ElasticNet, traveltimes_prediction.models.base_model.BaseModel

Class - wrapper for ElasticNet.

dump()[source]

Method for dumping of the model providing descriptors of model in dict.

Returns:dict
fit(X, y, sample_weigth=None)[source]

Method for fitting of the estimator.

Parameters:
  • X (numpy.ndarray) – Matrix of input features.
  • y (numpy.ndarray) – Vector of ground truths for X.
  • sample_weigth (numpy.ndarray) –
Returns:

object - self

static load(model)[source]

Method for loading of the model - recreating it from dumped dict.

Parameters:model (dict) – dumped model
Returns:ElasticNetWrapper
name = 'ElasticNet'
predict(X)[source]

Method for prediction.

Parameters:X (numpy.ndarray) – Data, which should be used as input for the estimation of predicted value.
Returns:np.ndarray

traveltimes_prediction.models.algorithms.linear_regression_wrapper module

class traveltimes_prediction.models.algorithms.linear_regression_wrapper.LinearRegressionWrapper(**kwargs)[source]

Bases: sklearn.linear_model.base.LinearRegression, traveltimes_prediction.models.base_model.BaseModel

Class - wrapper for LinearRegression.

dump()[source]

Method for dumping of the existing model.

Returns:dict
fit(X, y, sample_weight=None)[source]

Method for fitting of the estimator.

Parameters:
  • X (numpy.ndarray) –
  • y (numpy.ndarray) –
  • sample_weight (numpy.ndarray) –
Returns:

static load(model)[source]

Method for recreating model from dumped data.

Parameters:model (dict) –
Returns:LinearRegressionWrapper
name = 'LinearRegression'
predict(X)[source]

Method for the prediction of the output values given the feature vector.

Parameters:X (numpy.ndarray) –
Returns:list

traveltimes_prediction.models.algorithms.mbkmeans_wrapper module

class traveltimes_prediction.models.algorithms.mbkmeans_wrapper.MBKMeansWrapper(**kwargs)[source]

Bases: sklearn.cluster.k_means_.MiniBatchKMeans

Class wrapper for MiniBatchKMeans.

dump()[source]

Method for dumping of the existing model.

Returns:dict
fit(X, y=None)[source]

Method for fitting of the model.

Parameters:
  • X (numpy.ndarray) –
  • y (numpy.ndarray) –
Returns:

object - self

static load(model)[source]

Method for the loading - recreating of the dumped model.

Parameters:model (dict) –
Returns:MBKMeans
name = 'MBKMeans'
predict(X)[source]

Method for prediction of the output cluster.

Parameters:X (numpy.ndarray) –
Returns:np.ndarray

traveltimes_prediction.models.algorithms.ridge_wrapper module

class traveltimes_prediction.models.algorithms.ridge_wrapper.RidgeWrapper(**kwargs)[source]

Bases: sklearn.linear_model.ridge.Ridge, traveltimes_prediction.models.base_model.BaseModel

Class - wrapper for RidgeRegression.

dump()[source]

Method for dumping of the estimator.

Returns:dict
fit(X, y, sample_weight=None)[source]

Method for prediction.

Parameters:
  • X (numpy.ndarray) –
  • y (numpy.ndarray) –
  • sample_weight (numpy.ndarray) –
Returns:

object - self

static load(model)[source]

Method for loading of the estimator - recreating it from dumped dict.

Parameters:model (dict) –
Returns:instance of RidgeWrapper
name = 'Ridge'
predict(X)[source]

Method for prediction.

Parameters:X (numpy.ndarray) –
Returns:list

traveltimes_prediction.models.algorithms.svr_wrapper module

class traveltimes_prediction.models.algorithms.svr_wrapper.SVRWrapper(**kwargs)[source]

Bases: traveltimes_prediction.models.base_model.BaseModel, sklearn.svm.classes.SVR

Class - wrapper for SVR.

dump()[source]

Method for dumping of the model.

Returns:dict
fit(X, y, sample_weight=None)[source]

Method for fitting of the estimator.

Parameters:
  • X (numpy.ndarray) –
  • y (numpy.ndarray) –
  • sample_weight (numpy.ndarray) –
Returns:

object - self

static load(model)[source]

Method for loading of the already dumped model - recreating it.

Parameters:model (dict) –
Returns:instance of SVRWrapper
name = 'SVR'
predict(X)[source]

Method for prediction the output value.

Parameters:X (numpy.ndarray) –
Returns:list

Module contents