mirar.processors.sources.machine_learning package

Module for machine learning models

Submodules

mirar.processors.sources.machine_learning.pytorch module

Module with classes to use apply an ML score from pytorch

class mirar.processors.sources.machine_learning.pytorch.Pytorch(model: Module, model_weights_url: str, apply_to_table: Callable[[Module, DataFrame], DataFrame])[source]

Bases: BaseSourceProcessor

Class to apply a pytorch model to a source table

base_key = 'pytorch'
description() str[source]

Return a description of the processor

Returns:

A description of the processor

download_model()[source]

Download the ML model

get_ml_path() Path[source]

Get the path to the ML model

Returns:

Path to the ML model

get_model()[source]

Load the ML model weights. Download it if it doesn’t exist.

Returns:

ML model

static load_model(path)[source]

Function to load a pytorch model dict from a path

Parameters:

path – Path to the model

Returns:

Pytorch model dict

mirar.processors.sources.machine_learning.xgboost module

Module with classes to use apply an ML score from pytorch

class mirar.processors.sources.machine_learning.xgboost.XGBoost(model_json_url: str, apply_to_table: Callable[[XGBClassifier, DataFrame], DataFrame])[source]

Bases: BaseSourceProcessor

Class to apply a xgboost model to a source table

base_key = 'xgboost'
description() str[source]

Return a description of the processor

Returns:

A description of the processor

download_model()[source]

Download the ML model

get_ml_path() Path[source]

Get the path to the ML model

Returns:

Path to the ML model

get_model()[source]

Load the ML model weights. Download it if it doesn’t exist.

Returns:

ML model

static load_model(path)[source]

Function to load an xgboost model dict from a path

Parameters:

path – Path to the model

Returns:

Pytorch model dict