Tasks

Detection

class epilearn.tasks.detection.Detection(prototype=None, model=None, dataset=None, lookback=None, horizon=None, device='cpu')

The Detection class is designed to handle the training and evaluation of models for detection tasks. It extends the BaseTask class, incorporating specific functionalities to work with spatial-temporal data models. This class includes methods for model training, evaluation, and data preprocessing to facilitate experiments with different types of neural network architectures and configurations.

evaluate_model(model=None, dataset=None, config=None, features=None, graph=None, dynamic_graph=None, norm={'mean': 0, 'std': 1}, states=None, targets=None)

Evaluates the trained model on a new dataset or using preloaded features and graphs. It outputs the prediction accuracy of the model.

get_splits(dataset=None, train_rate=0.6, val_rate=0.2, preprocess=False, region_idx=None, permute=False)

Splits the provided dataset into training, validation, and testing sets based on specified rates. It also handles preprocessing if necessary.

train_model(dataset=None, config=None, permute_dataset=True, train_rate=0.6, val_rate=0.2, loss='ce', epochs=1000, batch_size=10, lr=0.001, region_idx=None, initialize=True, verbose=False, patience=100)

Trains the detection model using the provided dataset and configuration settings. It handles data splitting, model initialization, and the training process, and also evaluates the model on the test set, reporting the accuracy.

Forecast

class epilearn.tasks.forecast.Forecast(prototype=None, model=None, dataset=None, lookback=None, horizon=None, device='cpu')

The Forecast class extends the BaseTask class, focusing on the training and evaluation of forecast models for time-series prediction tasks. It includes functionalities specific to handling time-series data, especially in settings that involve spatial-temporal dynamics. The class supports model initialization, training, evaluation, and preprocessing, facilitating the application of various neural network architectures and configurations.

evaluate_model(model=None, config=None, features=None, graph=None, dynamic_graph=None, norm=None, states=None, targets=None)

Evaluates the trained model on a new dataset or using preloaded features and graphs. It outputs prediction accuracy metrics such as MAE and RMSE for the forecasted values.

get_splits(dataset=None, train_rate=0.6, val_rate=0.2, region_idx=None, permute=False)

Splits the provided dataset into training, validation, and testing sets based on specified rates. It also handles preprocessing to normalize the data and prepare it for the model.

train_model(dataset=None, config=None, permute_dataset=False, train_rate=0.6, val_rate=0.2, loss='mse', epochs=1000, batch_size=10, lr=0.001, region_idx=None, initialize=True, verbose=False, patience=100)

Trains the forecast model using the provided dataset and configuration settings. It handles data splitting, model initialization, and the training process, and also evaluates the model on the test set, reporting metrics such as MAE and RMSE.