module tools.asv_options_helper#

Short summary#

module mlprodict.tools.asv_options_helper

Functions to show shortened options in asv benchmarks.

source on GitHub

Functions#

function

truncated documentation

display_onnx

Returns a shortened string of the model.

expand_onnx_options

Expands shortened options. Long names hide some part of graphs in asv benchmark. This trick converts a string …

shorten_onnx_options

Shortens onnx options into a string. Long names hide some part of graphs in asv benchmark.

version2number

Converts a version number into a real number.

Documentation#

Functions to show shortened options in asv benchmarks.

source on GitHub

mlprodict.tools.asv_options_helper.display_onnx(model_onnx, max_length=1000)#

Returns a shortened string of the model.

Parameters:
  • model_onnx – onnx model

  • max_length – maximal string length

Returns:

string

source on GitHub

mlprodict.tools.asv_options_helper.expand_onnx_options(model, optim)#

Expands shortened options. Long names hide some part of graphs in asv benchmark. This trick converts a string into real conversions options.

Parameters:
Returns:

expanded options

It is the reverse of function shorten_onnx_options. The following options are handled:

<<<

from sklearn.linear_model import LogisticRegression
from mlprodict.tools.asv_options_helper import expand_onnx_options

for name in ['cdist', 'nozipmap', 'raw_scores']:
    print(name, ':', expand_onnx_options(LogisticRegression, name))

>>>

    cdist : {<class 'type'>: {'optim': 'cdist'}}
    nozipmap : {<class 'type'>: {'zipmap': False}}
    raw_scores : {<class 'type'>: {'raw_scores': True, 'zipmap': False}}

source on GitHub

mlprodict.tools.asv_options_helper.shorten_onnx_options(model, opts)#

Shortens onnx options into a string. Long names hide some part of graphs in asv benchmark.

Parameters:
Returns:

shortened options

It is the reverse of function expand_onnx_options.

source on GitHub

mlprodict.tools.asv_options_helper.version2number(vers)#

Converts a version number into a real number.

source on GitHub