src.predictive_model.regression package¶
Subpackages¶
Submodules¶
src.predictive_model.regression.apps module¶
-
class
src.predictive_model.regression.apps.
RegressionConfig
(app_name, app_module)¶ Bases:
src.predictive_model.apps.PredictiveModelConfig
-
name
= 'src.predictive_model.regression'¶
-
src.predictive_model.regression.custom_regression_models module¶
-
class
src.predictive_model.regression.custom_regression_models.
NNRegressor
(**kwargs)¶ Bases:
sklearn.base.RegressorMixin
Neural Network regressor, implements the same methods as the sklearn models to make it simple to add
-
fit
(train_data, targets)¶ creates and fits the predictive_model
first the encoded data is parsed, then the predictive_model created and then trained
Parameters: - train_data (
DataFrame
) – encoded training dataset - targets (
ndarray
) – encoded target dataset
Return type: None
- train_data (
-
predict
(test_data)¶ returns predictive_model predictions
parses the encoded test dataset, then returns the predictive_model predictions
Parameters: test_data ( DataFrame
) – encoded test datasetReturn type: ndarray
Returns: predictive_model predictions
-
reset
()¶ placeholder to allow use with other sklearn algorithms
Return type: None
-
src.predictive_model.regression.methods_default_config module¶
-
src.predictive_model.regression.methods_default_config.
regression_lasso
()¶
-
src.predictive_model.regression.methods_default_config.
regression_linear
()¶
-
src.predictive_model.regression.methods_default_config.
regression_nn
()¶
-
src.predictive_model.regression.methods_default_config.
regression_random_forest
()¶
-
src.predictive_model.regression.methods_default_config.
regression_xgboost
()¶
src.predictive_model.regression.models module¶
-
class
src.predictive_model.regression.models.
Lasso
(id, model_path, predictive_model, prediction_method, predictivemodel_ptr, regression_ptr, alpha, fit_intercept, normalize)¶ Bases:
src.predictive_model.regression.models.Regression
-
exception
DoesNotExist
¶ Bases:
src.predictive_model.regression.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
src.predictive_model.regression.models.MultipleObjectsReturned
-
alpha
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
fit_intercept
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
normalize
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
regression_ptr
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
regression_ptr_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
to_dict
()¶
-
exception
-
class
src.predictive_model.regression.models.
Linear
(id, model_path, predictive_model, prediction_method, predictivemodel_ptr, regression_ptr, fit_intercept, normalize)¶ Bases:
src.predictive_model.regression.models.Regression
-
exception
DoesNotExist
¶ Bases:
src.predictive_model.regression.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
src.predictive_model.regression.models.MultipleObjectsReturned
-
fit_intercept
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
normalize
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
regression_ptr
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
regression_ptr_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
to_dict
()¶
-
exception
-
class
src.predictive_model.regression.models.
NeuralNetwork
(id, model_path, predictive_model, prediction_method, predictivemodel_ptr, regression_ptr, n_hidden_layers, n_hidden_units, activation, n_epochs, dropout_rate)¶ Bases:
src.predictive_model.regression.models.Regression
-
exception
DoesNotExist
¶ Bases:
src.predictive_model.regression.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
src.predictive_model.regression.models.MultipleObjectsReturned
-
activation
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
dropout_rate
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_activation_display
(*, field=<django.db.models.fields.CharField: activation>)¶
-
n_epochs
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
regression_ptr
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
regression_ptr_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
to_dict
()¶
-
exception
-
class
src.predictive_model.regression.models.
RandomForest
(id, model_path, predictive_model, prediction_method, predictivemodel_ptr, regression_ptr, n_estimators, max_features, max_depth)¶ Bases:
src.predictive_model.regression.models.Regression
-
exception
DoesNotExist
¶ Bases:
src.predictive_model.regression.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
src.predictive_model.regression.models.MultipleObjectsReturned
-
max_depth
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
max_features
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
n_estimators
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
random_state
= 21¶
-
regression_ptr
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
regression_ptr_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
to_dict
()¶
-
exception
-
class
src.predictive_model.regression.models.
Regression
(*args, **kwargs)¶ Bases:
src.predictive_model.models.PredictiveModel
Container of Regression to be shown in frontend
-
exception
DoesNotExist
¶ Bases:
src.predictive_model.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
src.predictive_model.models.MultipleObjectsReturned
-
static
init
(configuration)¶
-
lasso
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
linear
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
neuralnetwork
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
predictivemodel_ptr
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
predictivemodel_ptr_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
randomforest
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
xgboost
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
exception
-
class
src.predictive_model.regression.models.
RegressionMethods
¶ Bases:
enum.Enum
An enumeration.
-
LASSO
= 'lasso'¶
-
LINEAR
= 'linear'¶
-
NN
= 'nn'¶
-
RANDOM_FOREST
= 'randomForest'¶
-
XGBOOST
= 'xgboost'¶
-
-
class
src.predictive_model.regression.models.
XGBoost
(id, model_path, predictive_model, prediction_method, predictivemodel_ptr, regression_ptr, max_depth, n_estimators)¶ Bases:
src.predictive_model.regression.models.Regression
-
exception
DoesNotExist
¶ Bases:
src.predictive_model.regression.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
src.predictive_model.regression.models.MultipleObjectsReturned
-
max_depth
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
n_estimators
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
regression_ptr
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
regression_ptr_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
to_dict
()¶
-
exception
src.predictive_model.regression.regression module¶
regression methods and functionalities
-
src.predictive_model.regression.regression.
regression
(training_df, test_df, clusterer, job)¶ main regression entry point
train and tests the regressor using the provided data
Parameters: - clusterer (
Clustering
) – - training_df (
DataFrame
) – training DataFrame - test_df (
DataFrame
) – testing DataFrame - job (
Job
) – job configuration
Return type: (<class ‘dict’>, <class ‘dict’>)
Returns: predictive_model scores and split
- clusterer (
-
src.predictive_model.regression.regression.
regression_single_log
(input_df, model)¶ single log regression
classifies a single log using the provided TODO: complete
Parameters: - input_df (
DataFrame
) – input DataFrame - model (
dict
) – TODO: complete
Return type: DataFrame
Returns: predictive_model scores
- input_df (