robustx.lib.models.sklearn_models package

Submodules

robustx.lib.models.sklearn_models.DecisionTreeModel module

class robustx.lib.models.sklearn_models.DecisionTreeModel.DecisionTreeModel[source]

Bases: SklearnModel

A Decision Tree Classifier model wrapper for scikit-learn.

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

robustx.lib.models.sklearn_models.LogisticRegressionModel module

class robustx.lib.models.sklearn_models.LogisticRegressionModel.LogisticRegressionModel[source]

Bases: SklearnModel

A Logistic Regression Classifier model wrapper for scikit-learn.

Inherits from SklearnModel and initializes LogisticRegression as the underlying model.

robustx.lib.models.sklearn_models.SVMModel module

class robustx.lib.models.sklearn_models.SVMModel.SVMModel[source]

Bases: SklearnModel

A SVM model wrapper for scikit-learn.

Inherits from SklearnModel and initializes SVC as the underlying model.

robustx.lib.models.sklearn_models.SklearnModel module

class robustx.lib.models.sklearn_models.SklearnModel.SklearnModel(model)[source]

Bases: BaseModel

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 BaseModel.

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