pqagent.pqagent module

class pqagent.pqagent.PqAgent(config_path: str = None, name: str = 'default')[source]

Bases: object

compare_models()[source]
eval(y_pred: DataFrame, y_true: DataFrame) dict[source]
evaluate_model(dataset: DataSet, model_to_use: str) dict[source]

Evaluates the performance of a model on a given dataset. This method applies the selected model to the provided dataset, generates predictions, and computes evaluation metrics. It returns both the calculated metrics and the predictions for further analysis.

Parameters:
  • dataset (DataSet) – The dataset on which the model’s performance is to be evaluated. Should contain the data and corresponding labels.

  • model_to_use – A string specifying the model to be used for predictions.

Returns:

A dictionary containing evaluation metrics and a DataFrame with the generated predictions.

Return type:

tuple(dict, pd.DataFrame)

classmethod from_file(filepath: str) PqAgent[source]
property get_models: list
load_model_from_checkpoint(model_name: str, trial_id: str = None, checkpoint_path: str = None) None[source]
models: Dict[str, PqModel]
predict(data: DataSet | DataFrame, model_to_use: str, get_comparison: bool = False) DataFrame[source]
preprocessor: Preprocessor
reset_ray()[source]
retrain(dataset: DataSet, base_model: str, strategy: Callable, model_name: str | None = None, update_config_path: str = None) None[source]
save(file_path: str = None, folder_path: str = None) None[source]

Save the model and preprocessor to a specified file or folder.

Parameters: - file_path (str, optional): The path to save the file directly. - folder_path (str, optional): The folder path to save the file with a default naming convention.

Raises: - ValueError: If neither file_path nor folder_path is provided.

train_model(data: DataSet, model_name: str = 'base', train_val_split_feature_groups: list = None, save_train_data: bool = False) None[source]
static transform_fc_layers_args(config)[source]

Converts the β€˜args’ in β€˜fc_layers’ from strings to tuples. This modifies the config in place if β€˜fc_layers’ is present.

update_config(config_path: str)[source]