module asv_benchmark._create_asv_helper#

Short summary#

module mlprodict.asv_benchmark._create_asv_helper

Functions to creates a benchmark based on asv for many regressors and classifiers.

source on GitHub

Functions#

function

truncated documentation

_additional_imports

Adds additional imports for experimental models.

_asv_class_name

_display_code_lines

_format_dict

Formats a dictionary as code.

_handle_init_files

Returns created, location_model, prefix_import.

_read_patterns

Reads the testing pattern.

_select_pattern_problem

Selects a benchmark type based on the problem kind.

_sklearn_subfolder

Returns the list of subfolders for a model.

add_model_import_init

Modifies a template such as TemplateBenchmarkClassifier with code associated to the model model.

find_missing_sklearn_imports

Finds in scikit-learn the missing pieces.

find_sklearn_module

Finds the corresponding modulee for an element of scikit-learn.

Documentation#

Functions to creates a benchmark based on asv for many regressors and classifiers.

source on GitHub

mlprodict.asv_benchmark._create_asv_helper._additional_imports(model_name)#

Adds additional imports for experimental models.

source on GitHub

mlprodict.asv_benchmark._create_asv_helper._asv_class_name(model, scenario, optimisation, extra, dofit, conv_options, problem, shorten=True)#
mlprodict.asv_benchmark._create_asv_helper._display_code_lines(code)#
mlprodict.asv_benchmark._create_asv_helper._format_dict(opts, indent)#

Formats a dictionary as code.

source on GitHub

mlprodict.asv_benchmark._create_asv_helper._handle_init_files(model, flat, location, verbose, location_pyspy, fLOG)#

Returns created, location_model, prefix_import.

mlprodict.asv_benchmark._create_asv_helper._read_patterns()#

Reads the testing pattern.

source on GitHub

mlprodict.asv_benchmark._create_asv_helper._select_pattern_problem(prob, patterns)#

Selects a benchmark type based on the problem kind.

source on GitHub

mlprodict.asv_benchmark._create_asv_helper._sklearn_subfolder(model)#

Returns the list of subfolders for a model.

source on GitHub

mlprodict.asv_benchmark._create_asv_helper.add_model_import_init(class_content, model, optimisation=None, extra=None, conv_options=None)#

Modifies a template such as TemplateBenchmarkClassifier with code associated to the model model.

Parameters:
  • class_content – template (as a string)

  • model – model class

  • optimisation – model optimisation

  • extra – addition parameter to the constructor

  • conv_options – options for the conversion to ONNX

@returm modified template

source on GitHub

mlprodict.asv_benchmark._create_asv_helper.find_missing_sklearn_imports(pieces)#

Finds in scikit-learn the missing pieces.

Parameters:

pieces – list of names in scikit-learn

Returns:

list of corresponding imports

source on GitHub

mlprodict.asv_benchmark._create_asv_helper.find_sklearn_module(piece)#

Finds the corresponding modulee for an element of scikit-learn.

Parameters:

piece – name to import

Returns:

module name

The implementation is not intelligence and should be improved. It is a kind of white list.

source on GitHub