rocelib.models.sklearn_models package

Submodules

rocelib.models.sklearn_models.TrainableDecisionTreeModel module

class rocelib.models.sklearn_models.TrainableDecisionTreeModel.TrainableDecisionTreeModel[source]

Bases: TrainableSKLearnModel

A Decision Tree Classifier model wrapper for scikit-learn.

Inherits from TrainableSKLearnModel and initializes a DecisionTreeClassifier as the underlying model.

rocelib.models.sklearn_models.TrainableLogisticRegressionModel module

class rocelib.models.sklearn_models.TrainableLogisticRegressionModel.TrainableLogisticRegressionModel[source]

Bases: TrainableSKLearnModel

A Logistic Regression Classifier model wrapper for scikit-learn.

Inherits from TrainableSKLearnModel and initializes LogisticRegression as the underlying model.

rocelib.models.sklearn_models.TrainableSVMModel module

class rocelib.models.sklearn_models.TrainableSVMModel.TrainableSVMModel[source]

Bases: TrainableSKLearnModel

A SVM model wrapper for scikit-learn.

Inherits from TrainableSKLearnModel and initializes SVC as the underlying model.

rocelib.models.sklearn_models.TrainableSKLearnModel module

class rocelib.models.sklearn_models.TrainableSKLearnModel.TrainableSKLearnModel(model)[source]

Bases: TrainableModel

A base class for scikit-learn models.

This class wraps a scikit-learn model and provides methods for training, predicting, and evaluating the model. Inherits from TrainableModel.

evaluate(X, y)[source]

Evaluates the model’s performance using accuracy and F1 score.

@param X: The feature variables, should be a DataFrame. @param y: The true target values, should be a DataFrame. @return: A dictionary with “accuracy” and “f1_score” of the model.

Return type:

dict

predict(X)[source]

Predicts the outcomes for given feature variables.

@param X: The feature variables, should be a DataFrame. @return: Predictions for each instance, returned as a DataFrame.

Return type:

DataFrame

predict_proba(X)[source]

Predicts the probabilities of outcomes for given feature variables.

@param X: The feature variables, should be a DataFrame. @return: Probabilities of each outcome, returned as a DataFrame.

Return type:

DataFrame

predict_proba_tensor(X)[source]

Predicts the probabilities of outcomes for given feature variables.

@param X: The feature variables, should be a DataFrame. @return: Probabilities of each outcome, returned as a DataFrame.

Return type:

Tensor

predict_single(X)[source]

Predicts the outcome for a single instance.

@param X: The feature variables for a single instance, should be a DataFrame. @return: Prediction for the single instance, returned as an integer.

Return type:

int

train(X, y, **kwargs)[source]

Trains the scikit-learn model.

@param X: The feature variables, should be a DataFrame. @param y: The target variable, should be a DataFrame.

Return type:

None

Module contents