rocelib.tasks package

Submodules

rocelib.tasks.ClassificationTask module

class rocelib.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_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

train(**kwargs)[source]

Trains the model using the training data.

This method uses the features (X) and labels (y) from the training data to fit the model.

rocelib.tasks.Task module

class rocelib.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:

TrainableModel

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 TrainableModel

abstract train(**kwargs)[source]

Abstract method to train the model on the provided training data. Must be implemented by subclasses.

property training_data

Property to access the training data.

@return: The training data loaded from DatasetLoader.

Module contents