Snippets of codesΒΆ

Enumerate all coordinates

<<<

from pymlbenchmark.plotting.plot_helper import list_col_options
from pandas import DataFrame
df = DataFrame([
    dict(i=1, t='aa', x=0.5),
    dict(i=2, t='bb', x=0.5),
    dict(i=2, t='aa', x=0.5),
])
for opt in list_col_options(df, ['i', 't']):
    print(opt)

# if None...
print(list_col_options(df, None))

>>>

    {'i': 1, 't': 'aa'}
    {'i': 1, 't': 'bb'}
    {'i': 2, 't': 'aa'}
    {'i': 2, 't': 'bb'}
    [None]

(original entry : plot_helper.py:docstring of pymlbenchmark.plotting.plot_helper.list_col_options, line 5)

Plot benchmark improvments

from pymlbenchmark.datasets import experiment_results
from pymlbenchmark.plotting import plot_bench_xtime
import matplotlib.pyplot as plt

df = experiment_results('onnxruntime_LogisticRegression')

plot_bench_xtime(df, row_cols='N', col_cols='method',
                 hue_cols='fit_intercept',
                 title="LogisticRegression\nAcceleration scikit-learn / onnxruntime")
plt.show()

(png, hires.png, pdf)

_images/plot_bench_xtime-1.png

(original entry : plot_bench_xtime.py:docstring of pymlbenchmark.plotting.plot_bench_xtime.plot_bench_xtime, line 31)

Plot benchmark results

from pymlbenchmark.datasets import experiment_results
from pymlbenchmark.plotting import plot_bench_results
import matplotlib.pyplot as plt

df = experiment_results('onnxruntime_LogisticRegression')

plot_bench_results(df, row_cols='N', col_cols='method',
                   x_value='dim', hue_cols='fit_intercept',
                   title="LogisticRegression\nBenchmark scikit-learn / onnxruntime")
plt.show()

(png, hires.png, pdf)

_images/plot_bench_results-1.png

(original entry : plot_bench_results.py:docstring of pymlbenchmark.plotting.plot_bench_results.plot_bench_results, line 26)