Functions

Summary

function

class parent

truncated documentation

_1d_problem

__pep8

_apply_optimisation_on_graph

Applies an optimisation function fct on a graph and not on the model.

_apply_remove_node_fct_node

Applies an optimizing function on a subgraphs.

_build_schemas

_call_runtime

Private.

_clean_values_optim

_create_node_id

_dictionary2str

_dispsimple

_dofit_model

_elem_type_as_str

_finalize

_get_doc_template

_get_estimators_label

This function computes labels for each estimator and returns a tensor produced by concatenating the labels.

_get_problem_data

_get_typed_class_attribute

Converts an attribute into a C++ value.

_guess_noshape

_guess_type

_hash_obj_content

Hash the content of an object.

_make_att_graph

_make_node

Constructs a NodeProto.

_measure_time

Measures the execution time for a function.

_merge_options

_modify_dimension

Modifies the number of features to increase or reduce the number of features.

_noshapevar

_numpy_array

Single function to create an array.

_onnx_cdist_manhattan

Returns the ONNX graph which computes the Minkowski distance or minkowski(X, Y, p).

_onnx_cdist_minkowski

Returns the ONNX graph which computes the Minkowski distance or minkowski(X, Y, p).

_onnx_cdist_sqeuclidean

Returns the ONNX graph which computes cdist(X, metric='sqeuclidean').

_parse_node

_parse_tree_structure

_problem_for_cl_decision_function

Returns X, y, intial_types, method, name, X runtime for a scoring problem. It is based on Iris dataset.

_problem_for_cl_decision_function_binary

Returns X, y, intial_types, method, name, X runtime for a scoring problem. Binary classification. It is based …

_problem_for_clnoproba

Returns X, y, intial_types, method, name, X runtime for a scoring problem. It is based on Iris dataset.

_problem_for_clnoproba_binary

Returns X, y, intial_types, method, name, X runtime for a scoring problem. Binary classification. It is based …

_problem_for_clustering

Returns X, intial_types, method, name, X runtime for a clustering problem. It is based on Iris dataset.

_problem_for_clustering_scores

Returns X, intial_types, method, name, X runtime for a clustering problem, the score part, not the cluster. It …

_problem_for_dict_vectorizer

Returns a problem for the sklearn.feature_extraction.DictVectorizer.

_problem_for_feature_hasher

Returns a problem for the sklearn.feature_extraction.DictVectorizer.

_problem_for_label_encoder

Returns a problem for the sklearn.preprocessing.LabelEncoder.

_problem_for_numerical_scoring

Returns X, y, intial_types, method, name, X runtime for a scoring problem. It is based on Iris dataset.

_problem_for_numerical_trainable_transform

Returns X, intial_types, method, name, X runtime for a transformation problem. It is based on Iris dataset.

_problem_for_numerical_transform

Returns X, intial_types, method, name, X runtime for a transformation problem. It is based on Iris dataset.

_problem_for_one_hot_encoder

Returns a problem for the sklearn.preprocessing.OneHotEncoder.

_problem_for_outlier

Returns X, intial_types, method, name, X runtime for a transformation problem. It is based on Iris dataset.

_problem_for_predictor_binary_classification

Returns X, y, intial_types, method, node name, X runtime for a binary classification problem. It is based on Iris …

_problem_for_predictor_multi_classification

Returns X, y, intial_types, method, node name, X runtime for a m-cl classification problem. It is based on Iris …

_problem_for_predictor_multi_classification_label

Returns X, y, intial_types, method, node name, X runtime for a m-cl classification problem. It is based on Iris …

_problem_for_predictor_multi_regression

Returns X, y, intial_types, method, name, X runtime for a mregression problem. It is based on Iris dataset.

_problem_for_predictor_regression

Returns X, y, intial_types, method, name, X runtime for a regression problem. It is based on Iris dataset.

_register_converters_lightgbm

This functions registers additional converters for lightgbm.

_register_converters_xgboost

This functions registers additional converters for xgboost.

_rename_graph_input

Renames an input and adds an Identity node to connect the dots.

_rename_graph_output

Renames an output and adds an Identity node to connect the dots.

_rename_node_input

Renames an input from a node.

_rename_node_output

Renames an output from a node.

_replace

_retrieve_problems_extra

Use by enumerate_compatible_opset().

_run_skl_prediction

_setup_hook

If this function is added to the module, the help automation and unit tests call it first before anything goes on …

_shape_exc

_translate_split_criterion

_type_to_string

Converts a type into a readable string.

_validate_runtime_dict

_validate_runtime_separate_process

_var_as_dict

Converts a protobuf object into something readable. The current implementation relies on json. That’s not …

astype_range

Computes ranges for every number in an array once converted into float32. The function returns two matrices which …

benchmark_fct

Benchmarks a function which takes an array as an input and changes the number of rows.

build_custom_scenarios

Defines parameters values for some operators.

build_custom_scenarios

Defines parameters values for some operators.

calculate_linear_classifier_output_shapes

This operator maps an input feature vector into a scalar label if the number of outputs is one. If two outputs appear …

change_style

Switches from AaBb into aa_bb.

check

Checks the library is working. It raises an exception. If you want to disable the logs:

check_is_almost_equal

Checks that two floats or two arrays are almost equal.

check_model_representation

Checks that a trained model can be exported in a specific list of formats and produces the same outputs if the representation …

check_type

Raises an exception if the model is not of the expected type.

compile_c_function

Compiles a C function with cffi. It takes one features vector.

compose_page_onnxrt_ops

Writes page Python Runtime for ONNX operators.

convert_lightgbm

This converters reuses the code from LightGbm.py

convert_nearest_neighbors_regressor

Converts sklearn.neighbors.KNeighborsRegressor into ONNX.

convert_score_cdist_sum

Converts function score_cdist_sum() into ONNX.

convert_scorer

Converts a scorer into ONNX assuming there exists a converter associated to it. The function wraps the function …

convert_sklearn_ada_boost_regressor

Rewrites the converters implemented in sklearn-onnx to support an operator supported doubles.

convert_sklearn_decision_tree_regressor

Rewrites the converters implemented in sklearn-onnx to support an operator supported doubles.

convert_sklearn_gradient_boosting_regressor

Rewrites the converters implemented in sklearn-onnx to support an operator supported doubles.

convert_sklearn_random_forest_regressor_converter

Rewrites the converters implemented in sklearn-onnx to support an operator supported doubles.

convert_validate

Converts a model stored in pkl file and measure the differences between the model and the ONNX predictions.

convert_xgboost

This converters reuses the code from XGBoost.py

custom_scorer_transform_converter

Selects the appropriate converter for a @see cl CustomScorerTransform.

custom_scorer_transform_parser

This function updates the inputs and the outputs for a @see cl CustomScorerTransform.

custom_scorer_transform_shape_calculator

Computes the output shapes for a @see cl CustomScorerTransform.

debug_onnx_object

__dict__ is not in most of onnx objects. This function uses function dir to explore this object.

default_time_kwargs

Returns default values number and repeat to measure the execution of a function.

dump_into_folder

Dumps information when an error was detected using pickle.

enumerate_compatible_opset

Lists all compatible opsets for a specific model.

enumerate_fitted_arrays

Enumerate all fitted arrays included in a scikit-learn object.

enumerate_model_node_outputs

Enumerates all the nodes of a model.

enumerate_pipeline_models

Enumerates all the models within a pipeline.

enumerate_random_inputs

Enumerates random matrices.

enumerate_validated_operator_opsets

Tests all possible configurations for all possible operators and returns the results.

enumerate_visual_onnx_representation_into_rst

Returns content for pages such as linear_model.

find_suitable_problem

Defines suitables problems for additional converters.

find_suitable_problem

Determines problems suitable for a given scikit-learn operator. It may be

get_default_context

Returns a default context useful for most of the conversion from a function using numpy into ONNX.

get_default_context_cpl

Returns a default useful context to compile the converter returned by translate_fct2onnx().

get_defined_inputs

Retrieves defined inputs in already declared variables bsed on their names.

get_defined_outputs

Gets types of predefined outputs when they cannot be inferred. Some part of it should be automated based on type …

get_opset_number_from_onnx

Retuns the current onnx opset based on the installed version of onnx.

get_opset_number_from_onnx

Retuns the current onnx opset based on the installed version of onnx.

get_rst_doc

Returns a documentation in RST format for all OnnxOperator.

guess_initial_types

Guesses initial types from an array or a dataframe.

identify_interpreter

Identifies the interpreter for a scikit-learn model.

inspect_sklearn_model

Inspects a scikit-learn model and produces some figures which tries to represent the complexity of it.

interpret_options_from_string

Converts a string into a dictionary.

iris_data

Returns (X, y) for iris data.

load_audit

Use to test conversion of sklearn.ensemble.GradientBoostingClassifier into ONNX.

load_ipython_extension

To allow the call %load_ext mlprodict

load_op

Sets up a class for a specific ONNX operator.

load_op

Gets the operator related to the onnx node.

load_op

Gets the operator related to the onnx node.

main

Implements python -m mlprodict <command> <args>.

max_depth

Retrieves the max depth assuming the estimator is a decision tree.

measure_relative_difference

Measures the relative difference between predictions between two ways of computing them. The functions returns nan …

measure_time

Measures a statement and returns the results as a dictionary.

modules_list

Returns modules and versions currently used.

numpy_dot_inplace

Implements a dot product, deals with inplace information.

onnx_cdist

Returns the ONNX graph which computes cdist(X, Y, metric=metric).

onnx_nearest_neighbors_indices

Retrieves the nearest neigbours ONNX.

onnx_optim

Optimises an ONNX model.

onnx_optimisations

Calls several possible optimisations including onnx_remove_node().

onnx_remove_node

Removes as many nodes as possible without changing the outcome. It applies onnx_remove_node_identity(), then …

onnx_remove_node_identity

Removes as many Identity nodes as possible. The function looks into every node and subgraphs if recursive is …

onnx_remove_node_redundant

Removes redundant part of the graph. A redundant part is a set of nodes which takes the same inputs and produces …

onnx_shaker

Shakes a model ONNX. Explores the ranges for every prediction. Uses astype_range()

onnx_statistics

Computes statistics on ONNX models.

onnx_stats

Computes statistics on an ONNX model.

onnxview

Displays an ONNX graph into a notebook.

pairwise_array_distances

Computes pairwise distances between two lists of arrays l1 and l2. The distance is 1e9 if shapes are not equal.

plot_validate_benchmark

Plots a graph which summarizes the performances of a benchmark validating a runtime for ONNX.

py_make_float_array

Creates an array with a single element from a constant.

py_mul

Function for python operator *.

py_opp

Function for python unary operator -.

py_pow

Function for python operator **.

register_converters

This functions registers additional converters to the list of converters sklearn-onnx declares.

register_onnx_magics

Register magics function, can be called from a notebook.

register_rewritten_operators

Registers modified operators and returns the old values.

register_scorers

Registers operators for @see cl CustomScorerTransform.

score_cdist_sum

Computes the sum of pairwise distances between expected_values and predictions. It has no particular purpose …

select_model_inputs_outputs

Takes a model and changes its outputs.

side_by_side_by_values

Compares the execution of two sessions. It calls method OnnxInference.run

sklearn2graph

Converts any kind of scikit-learn model into a grammar model.

sklearn_decision_tree_regressor

Converts a DecisionTreeRegressor

sklearn_linear_regression

Converts a linear regression

sklearn_logistic_regression

Interprets a logistic regression

sklearn_operators

Builds the list of operators from scikit-learn. The function goes through the list of submodule and get …

sklearn_standard_scaler

Converts a standard scaler

split_columns_subsets

Functions used in the documentation to split a dataframe by columns into multiple dataframe to reduce the scrolling. …

squareform_pdist

Replacements for squareform

summary_report

Finalizes the results computed by function enumerate_validated_operator_opsets().

to_onnx

Converts a model using on sklearn-onnx.

topk_sorted_implementation

Retrieves the top-k elements.

translate_fct2onnx

Translates a function into ONNX. The code it produces is using classes OnnxAbs, OnnxAdd, …

type_mapping

Mapping between types name and type integer value.

validate_runtime

Walks through most of scikit-learn operators or model or predictor or transformer, tries to convert them …

visual_rst_template

Returns a jinja2 template to display DOT graph for each converter from sklearn-onnx.