module tools.asv_options_helper
#
Short summary#
module mlprodict.tools.asv_options_helper
Functions to show shortened options in asv benchmarks.
Functions#
function |
truncated documentation |
---|---|
Returns a shortened string of the model. |
|
Expands shortened options. Long names hide some part of graphs in asv benchmark. This trick converts a string … |
|
Shortens onnx options into a string. Long names hide some part of graphs in asv benchmark. |
|
Converts a version number into a real number. |
Documentation#
Functions to show shortened options in asv benchmarks.
- 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
- 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:
model – model class (scikit-learn)
optim – option
- 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}}
- 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:
model – model class (scikit-learn)
opts – options
- Returns:
shortened options
It is the reverse of function
expand_onnx_options
.
- mlprodict.tools.asv_options_helper.version2number(vers)#
Converts a version number into a real number.