module benchmark.mlprediction
#
Short summary#
module jupytalk.benchmark.mlprediction
Functions#
function |
truncated documentation |
---|---|
Builds a dataframe from multiple arrays. |
|
Measures the time for a given expression. |
|
Optimizes the rendering of time. |
Documentation#
- jupytalk.benchmark.mlprediction.make_dataframe(labels, arrays)#
Builds a dataframe from multiple arrays.
- Parameters:
labels – list of labels
arrays – list of arrays (or one array)
- Returns:
dataframes
- jupytalk.benchmark.mlprediction.timeexec(legend, code, number=50, repeat=200, verbose=True, context=None)#
Measures the time for a given expression.
- Parameters:
legend – name of the experiment
code – code to measure (as a string)
number – number of time to run the expression (and then divide by this number to get an average)
repeat – number of times to repeat the computation of the above average
verbose – print the time
globals – context (usuable equal to
globals()
)
- Returns:
dictionary
<<<
from jupytalk.benchmark.mlprediction import timeexec code = "3 * 45535266234653452" print(timeexec("multiplication", code))
>>>
Average: 41.39 ns deviation 1.49 ns (with 50 runs) in [40.40 ns, 42.60 ns] {'legend': 'multiplication', 'average': 4.1390443220734597e-08, 'deviation': 1.4878432620448562e-09, 'first': 6.039626896381378e-08, 'first3': 4.8590203126271565e-08, 'last3': 4.093473156293233e-08, 'repeat': 200, 'min5': 4.040077328681946e-08, 'max5': 4.259869456291199e-08, 'code': '3 * 45535266234653452', 'run': 50}
- jupytalk.benchmark.mlprediction.unit(x)#
Optimizes the rendering of time.
<<<
from jupytalk.benchmark.mlprediction import unit print(unit(34)) print(unit(3.4)) print(unit(0.34)) print(unit(0.034)) print(unit(0.0034)) print(unit(0.00034)) print(unit(0.000034)) print(unit(0.0000034)) print(unit(0.00000034))
>>>
34.00 s 3.40 s 340.00 ms 34.00 ms 3.40 ms 340.00 µs 34.00 µs 3.40 µs 340.00 ns