bluecast.general_utils.general_utils¶
General utilities.
Module Contents¶
Functions¶
|
|
|
|
|
Takes a pretrained model and saves it via dill. |
|
Load in a pretrained auto ml model. This function will try to load the model as provided. |
|
Return a number of samples. |
|
Save out of fold data. |
Attributes¶
- bluecast.general_utils.general_utils.logger¶
- bluecast.general_utils.general_utils.warning_to_logger(message, category, filename, lineno, file=None, line=None)¶
- bluecast.general_utils.general_utils.check_gpu_support() Dict[str, str]¶
- bluecast.general_utils.general_utils.save_to_production(class_instance: Any, file_path: str | None = None, file_name: str = 'automl_instance', file_type: str = '.dat') None¶
Takes a pretrained model and saves it via dill. :param class_instance: Takes instance of a BlueCast class. :param file_path: Takes a string containing the full absolute path. :param file_name: Takes a string containing the whole file name. :param file_type: Takes the expected type of file to export. :return:
- bluecast.general_utils.general_utils.load_for_production(file_path: str | None = None, file_name: str = 'automl_instance', file_type: str = '.dat') Any¶
Load in a pretrained auto ml model. This function will try to load the model as provided. It has a fallback logic to impute .dat as file_type in case the import fails initially. :param file_path: Takes a string containing the full absolute path. :param file_name: Takes a string containing the whole file name. :param file_type: Takes the expected type of file to import. :return: The loaded model object
- bluecast.general_utils.general_utils.log_sampling(nb_rows: int, alpha: float = 2.0) int¶
Return a number of samples.
- Parameters:
nb_rows – Number of rows in the dataset.
alpha – Alpha value for sampling weight. Higher alpha values will result in less samples.
- bluecast.general_utils.general_utils.save_out_of_fold_data(oof_data: pandas.DataFrame, y_hat: pandas.Series | numpy.ndarray, y_classes: pandas.Series | numpy.ndarray | None, y_true: pandas.Series | numpy.ndarray, target_column: str, class_problem: Literal[binary, multiclass, regression], training_config: bluecast.config.training_config.TrainingConfig, target_label_encoder: bluecast.preprocessing.encode_target_labels.TargetLabelEncoder | None = None) None¶
Save out of fold data.
- Parameters:
oof_data – Data to save.
y_hat – Predictions. Will be appended to oof_data and saved together. When class_problem is “binary”, only the target class score is expected.
y_classes – Predicted classes. Will be appended to oof_data and saved together. Only required for class_problem ‘binary’ or ‘multiclass’.
y_true – True targets.
target_column – String specifying name of the target column.
class_problem – Takes a string containing the class problem type. Either “binary”, “multiclass” or “regression”.
training_config – Training configuration.
target_label_encoder – (Optional) TargetLabelEncoder object. This object will be created during classification tasks automatically when the target label is a string. It can be retrieved from the BlueCast and BlueCastCV instances via bluecast_obj.target_label_encoder or bluecast_cv_onj.bluecast_models[idx_of_model].target_label_encoder. Adding this argument will reverse translate the targets from numerical encodings back to the original strings for the column nam representation.