ads.model.extractor package

Submodules

ads.model.extractor.keras_extractor module

class ads.model.extractor.keras_extractor.KerasExtractor(model)[source]

Bases: ModelInfoExtractor

Class that extract model metadata from keras models.

model

The model to extract metadata from.

Type:

object

estimator

The estimator to extract metadata from.

Type:

object

property algorithm

Extracts the algorithm of the model.

Returns:

The algorithm of the model.

Return type:

object

property framework

Extracts the framework of the model.

Returns:

The framework of the model.

Return type:

str

property hyperparameter

Extracts the hyperparameters of the model.

Returns:

The hyperparameters of the model.

Return type:

dict

property version

Extracts the framework version of the model.

Returns:

The framework version of the model.

Return type:

str

ads.model.extractor.lightgbm_extractor module

class ads.model.extractor.lightgbm_extractor.LightgbmExtractor(model)[source]

Bases: ModelInfoExtractor

Class that extract model metadata from lightgbm models.

model

The model to extract metadata from.

Type:

object

estimator

The estimator to extract metadata from.

Type:

object

framework(self) str

Returns the framework of the model.

algorithm(self) object

Returns the algorithm of the model.

version(self) str

Returns the version of framework of the model.

hyperparameter(self) dict

Returns the hyperparameter of the model.

property algorithm

Extracts the algorithm of the model.

Returns:

The algorithm of the model.

Return type:

object

property framework

Extracts the framework of the model.

Returns:

The framework of the model.

Return type:

str

property hyperparameter

Extracts the hyperparameters of the model.

Returns:

The hyperparameters of the model.

Return type:

dict

property version

Extracts the framework version of the model.

Returns:

The framework version of the model.

Return type:

str

ads.model.extractor.model_info_extractor module

class ads.model.extractor.model_info_extractor.ModelInfoExtractor[source]

Bases: ABC

The base abstract class to extract model metadata.

framework(self) str[source]

Returns the framework of the model.

algorithm(self) object[source]

Returns the algorithm of the model.

version(self) str[source]

Returns the version of framework of the model.

hyperparameter(self) dict[source]

Returns the hyperparameter of the model.

info(self) dict[source]

Returns the model taxonomy metadata information.

abstract algorithm()[source]

The abstract method to extracts the algorithm of the model.

Returns:

The algorithm of the model.

Return type:

object

abstract framework()[source]

The abstract method to extracts the framework of the model.

Returns:

The framework of the model.

Return type:

str

abstract hyperparameter()[source]

The abstract method to extracts the hyperparameters of the model.

Returns:

The hyperparameter of the model.

Return type:

dict

info()[source]

Extracts the taxonomy metadata of the model.

Returns:

The taxonomy metadata of the model.

Return type:

dict

abstract version()[source]

The abstract method to extracts the framework version of the model.

Returns:

The framework version of the model.

Return type:

str

ads.model.extractor.model_info_extractor.normalize_hyperparameter(data: Dict) dict[source]

Converts all the fields to string to make sure it’s json serializable.

Parameters:

data (([Dict])) – The hyperparameter returned by the model.

Returns:

Normalized (json serializable) dictionary.

Return type:

Dict

ads.model.extractor.model_info_extractor_factory module

class ads.model.extractor.model_info_extractor_factory.ModelInfoExtractorFactory[source]

Bases: object

Class that extract Model Taxonomy Metadata for all supported frameworks.

static extract_info(model)[source]

Extracts model taxonomy metadata.

Parameters:

model ([ADS model, sklearn, xgboost, lightgbm, keras, oracle_automl]) – The model object

Returns:

A dictionary with keys of Framework, FrameworkVersion, Algorithm, Hyperparameters of the model

Return type:

ModelTaxonomyMetadata

Examples

>>> from ads.common.model_info_extractor_factory import ModelInfoExtractorFactory
>>> metadata_taxonomy = ModelInfoExtractorFactory.extract_info(model)

ads.model.extractor.pytorch_extractor module

class ads.model.extractor.pytorch_extractor.PyTorchExtractor(model)[source]

Bases: ModelInfoExtractor

Class that extract model metadata from pytorch models.

model

The model to extract metadata from.

Type:

object

estimator

The estimator to extract metadata from.

Type:

object

framework(self) str

Returns the framework of the model.

algorithm(self) object

Returns the algorithm of the model.

version(self) str

Returns the version of framework of the model.

hyperparameter(self) dict

Returns the hyperparameter of the model.

property algorithm

Extracts the algorithm of the model.

Returns:

The algorithm of the model.

Return type:

object

property framework

Extracts the framework of the model.

Returns:

The framework of the model.

Return type:

str

property hyperparameter

Extracts the hyperparameters of the model.

Returns:

The hyperparameters of the model.

Return type:

dict

property version

Extracts the framework version of the model.

Returns:

The framework version of the model.

Return type:

str

class ads.model.extractor.pytorch_extractor.PytorchExtractor(model)[source]

Bases: PyTorchExtractor

ads.model.extractor.sklearn_extractor module

class ads.model.extractor.sklearn_extractor.SklearnExtractor(model)[source]

Bases: ModelInfoExtractor

Class that extract model metadata from sklearn models.

model

The model to extract metadata from.

Type:

object

estimator

The estimator to extract metadata from.

Type:

object

framework(self) str

Returns the framework of the model.

algorithm(self) object

Returns the algorithm of the model.

version(self) str

Returns the version of framework of the model.

hyperparameter(self) dict

Returns the hyperparameter of the model.

property algorithm

Extracts the algorithm of the model.

Returns:

The algorithm of the model.

Return type:

object

property framework

Extracts the framework of the model.

Returns:

The framework of the model.

Return type:

str

property hyperparameter

Extracts the hyperparameters of the model.

Returns:

The hyperparameters of the model.

Return type:

dict

property version

Extracts the framework version of the model.

Returns:

The framework version of the model.

Return type:

str

ads.model.extractor.spark_extractor module

class ads.model.extractor.spark_extractor.SparkExtractor(model)[source]

Bases: ModelInfoExtractor

Class that extract model metadata from pyspark models.

model

The model to extract metadata from.

Type:

object

estimator

The estimator to extract metadata from.

Type:

object

framework(self) str

Returns the framework of the model.

algorithm(self) object

Returns the algorithm of the model.

version(self) str

Returns the version of framework of the model.

hyperparameter(self) dict

Returns the hyperparameter of the model.

property algorithm

Extracts the algorithm of the model.

Returns:

The algorithm of the model.

Return type:

object

property framework

Extracts the framework of the model.

Returns:

The framework of the model.

Return type:

str

property hyperparameter

Extracts the hyperparameters of the model.

Returns:

The hyperparameters of the model

Return type:

dict

property version

Extracts the framework version of the model.

Returns:

The framework version of the model.

Return type:

str

ads.model.extractor.tensorflow_extractor module

class ads.model.extractor.tensorflow_extractor.TensorflowExtractor(model)[source]

Bases: ModelInfoExtractor

Class that extract model metadata from tensorflow models.

model

The model to extract metadata from.

Type:

object

estimator

The estimator to extract metadata from.

Type:

object

framework(self) str

Returns the framework of the model.

algorithm(self) object

Returns the algorithm of the model.

version(self) str

Returns the version of framework of the model.

hyperparameter(self) dict

Returns the hyperparameter of the model.

property algorithm

Extracts the algorithm of the model.

Returns:

The algorithm of the model.

Return type:

object

property framework

Extracts the framework of the model.

Returns:

The framework of the model.

Return type:

str

property hyperparameter

Extracts the hyperparameters of the model.

Returns:

The hyperparameters of the model.

Return type:

dict

property version

Extracts the framework version of the model.

Returns:

The framework version of the model.

Return type:

str

ads.model.extractor.xgboost_extractor module

class ads.model.extractor.xgboost_extractor.XgboostExtractor(model)[source]

Bases: ModelInfoExtractor

Class that extract model metadata from xgboost models.

model

The model to extract metadata from.

Type:

object

estimator

The estimator to extract metadata from.

Type:

object

framework(self) str

Returns the framework of the model.

algorithm(self) object

Returns the algorithm of the model.

version(self) str

Returns the version of framework of the model.

hyperparameter(self) dict

Returns the hyperparameter of the model.

property algorithm

Extracts the algorithm of the model.

Returns:

The algorithm of the model.

Return type:

object

property framework

Extracts the framework of the model.

Returns:

The framework of the model.

Return type:

str

property hyperparameter

Extracts the hyperparameters of the model.

Returns:

The hyperparameters of the model.

Return type:

dict

property version

Extracts the framework version of the model.

Returns:

The framework version of the model.

Return type:

str

Module contents