robustx.lib.tasks package

Submodules

robustx.lib.tasks.ClassificationTask module

class robustx.lib.tasks.ClassificationTask.ClassificationTask(model, training_data)[source]

Bases: Task

A specific task type for classification problems that extends the base Task class.

This class provides methods for training the model and retrieving positive instances from the training data.

model

The model to be trained and used for predictions.

_training_data

The dataset used for training the model.

get_negative_instances(neg_value=0, column_name='target')[source]

Filters all the negative instances in the dataset as predicted by the model and returns them @param neg_value: What target value counts as a “negative” instance @param column_name: Target column’s name @return: All instances with a negative target value predicted by the model

Return type:

DataFrame

get_random_positive_instance(neg_value, column_name='target')[source]

Retrieves a random positive instance from the training data that does not have the specified negative value.

This method continues to sample from the training data until a positive instance is found whose predicted label is not equal to the negative value.

@param neg_value: The value considered negative in the target variable. @param column_name: The name of the target column used to identify positive instances. @return: A Pandas Series representing a random positive instance.

Return type:

Series

robustx.lib.tasks.Task module

class robustx.lib.tasks.Task.Task(model, training_data)[source]

Bases: ABC

An abstract base class representing a general task that involves training a model on a specific dataset.

_training_data

The dataset used for training the model.

Type:

DatasetLoader

__model

The model to be trained and used for predictions.

Type:

BaseModel

get_negative_instances(neg_value=0, column_name='target')[source]

Abstract method to retrieve all the negative instances in the dataset as predicted by the model.

@param neg_value: The value considered negative in the target variable. @param column_name: The name of the target column. @return: All instances with a negative target value predicted by the model.

Return type:

DataFrame

get_random_positive_instance(neg_value, column_name='target')[source]

Abstract method to retrieve a random positive instance from the training data.

@param neg_value: The value considered negative in the target variable. @param column_name: The name of the target column. @return: A Pandas Series representing a random positive instance.

Return type:

Series

property model

Property to access the model.

@return: The model instance that extends BaseModel

property training_data

Property to access the training data.

@return: The training data loaded from DatasetLoader.

Module contents