Analytics

from labml import analytics

Load runs

You can load runs with runs().

We are analysing some sample projects: * Predicting the stock price of next 5 minutes * Counterfactual Regret Minimization with Kuhn Poker,

stocks = analytics.runs('d76d3922a8a211eaa7a2857d91b0cff2')
kuhn = analytics.runs('90a456ee9b1c11eaaf7bf218981c2492')

dir gives all the available indicators and artifacts for the run(s).

dir(stocks)
['model_final_conv_bias',
 'model_final_conv_bias_grad',
 'model_final_conv_weight',
 'model_final_conv_weight_grad',
 'model_layers_0_conv_bias',
 'model_layers_0_conv_bias_grad',
 'model_layers_0_conv_weight',
 'model_layers_0_conv_weight_grad',
 'model_layers_1_conv_bias',
 'model_layers_1_conv_bias_grad',
 'model_layers_1_conv_weight',
 'model_layers_1_conv_weight_grad',
 'train_loss',
 'valid_loss',
 'valid_output',
 'valid_ref',
 'valid_strike_high',
 'valid_strike_low',
 'valid_target']

Distribution plot

distribution() plots the distribution of given set of indicators. Multiple indicators can be merged with +.

The plots are rendered with Altair. The smaller minimap below the main plot can be used to zoom in.

We are setting a smaller width to fit-in to the Read The Docs theme

analytics.distribution(stocks.valid_loss + stocks.train_loss,
                       width=400, height=300, height_minimap=50)
analytics.distribution(kuhn.average_strategy_Q_b + kuhn.average_strategy_Kb_b +
                       kuhn.strategy_Q_b + kuhn.strategy_Kb_b,
                       width=400, height=300, height_minimap=50)

Scatter plot

The below chart plots indicators on a scatter plot.

analytics.scatter(kuhn.average_strategy_Q_b, kuhn.average_strategy_Kb_b,
                  width=400, height=400)

Loading artifacts

You can also load up artifacts saved during training and analyse them.

series, names = analytics.artifact_data((stocks.valid_output + stocks.valid_target))
predictions, target = series
last_prediction = predictions[-1][1]
analytics.scatter([last_prediction.ravel()], target.ravel(),
                  names=['last_prediction'],
                  x_name='target',
                  height=400, width=400)