Class
BaseExperiment
Classical (monitored) experiment class.
- edit Alexis BRENON alexis.brenon@imag.fr
Data Types
keyboard_arrow_up-
ClassificationTable
List of classification metrics computed.
See some explanations about metrics on this site:
Fields:http://blog.revolutionanalytics.com/2016/03/com_class_eval_metrics_r.html
-
Dump
Dump.
-
InitArgument
Argument used for instanciation.
Todo:- Extract some arguments to Dump.
-
{train=environment.BaseEnvironment,test=environment.BaseEnvironment}
environment
Table withtrain
andtest
environments -
agent.BaseAgent
agent
The agent to use -
OutputArgument
output
Output options -
number
steps
Total number of steps to do (excluding evaluation steps) (defaultmath.huge
) -
number
eval_freq
Number of steps between two evaluations -
number
eval_steps
Number of evaluation steps -
number
save_at
Next interation at which to save the experiment (optional) -
{train=table,test=table}
loop
Results of the last iteration (optional) -
{train=table,test=table}
metrics
Table of saved metrics (optional) -
number
step
Current step (optional)
-
InteractionsResult
Result of a set of interactions.
Fields:-
integer
num_it
Actual number of interactions done -
{real=number,sys=number,user=number}
time
Times elapsed by interactions -
integer
num_rewards
Number of non-zero rewards received -
integer
num_episodes
Number of episodes (terminal states) -
number
total_reward
Sum of rewards obtained -
torch.Tensor
confusion_matrix
Confusion matrix -
InteractionsTable
interactions
Details of interactions -
ClassificationTable
classification_metrics
Sumed up metrics -
{torch.Tensor/tensor.md/,...}
inputs
Inputs of the interactions
-
integer
-
InteractionsTable
A list of interactions.
Fields:-
torch.Tensor
expected_actions
Actions expected by the environment -
torch.Tensor
actions
Actions executed -
torch.Tensor
rewards
Rewards obtained -
torch.Tensor
terminals
Terminal signal of the input state
-
torch.Tensor
-
OutputArgument
Arguments to describe the output.
Fields
keyboard_arrow_up-
agent.BaseAgent
agent
The agent to use
-
{train=environment.BaseEnvironment,test=environment.BaseEnvironment}
environment
Table with
train
andtest
environments -
number
eval_freq
Number of steps between two evaluations
-
number
eval_steps
Number of evaluation steps
-
{train=table,test=table}
loop
Results of the last iteration
-
{train=table,test=table}
metrics
Table of saved metrics
-
torch.DiskFile
metrics_file
File used as output.
-
OutputArgument
output
Output options
-
number
save_at
Next interation at which to save the experiment
-
number
step
Current step
-
number
steps
Total number of steps to do (excluding evaluation steps)
-
torch.Timer
timer
A Timer used to time the experiment.
Metamethods
keyboard_arrow_up-
__init ( args )
Default constructor.
Parameters:-
InitArgument
args
-
InitArgument
Public Methods
keyboard_arrow_up-
report ()
Report loop results.
Returns:-
self
-
-
run ()
Start the experiment.
This function will run steps learning interactions, separated by eval_steps evaluation interactions each eval_freq interactions.
-
save ()
Save the current experiment and dependencies.
Returns:-
self
-
-
setSteps ( steps )
Update the total number of steps to execute.
Use this function if you want to continue a previous experiment.
Parameters:-
number
steps
New number of steps to do
-
self
-
number
Private Methods
keyboard_arrow_up-
_graphical_report ()
Save some informations graphically.
This function will plot some graph, save images or something like this about the elements of the experiment.
Returns:-
self
-
-
_inputs_report ()
Save some inputs.
This can be used for checks and/or post-mortem debug.
Returns:-
self
-
-
_interact ( environment, steps )
Actually do interactions.
This function does the interactions without checking anything prior to it (agent mode, environment state, etc.). It resets the environment during the interactions if necessary.
Parameters:-
environment.BaseEnvironment
environment
Environment with witch to interact -
number
steps
Number of interactions to execute
-
InteractionsResult
Only a subset (
num_it
,interactions
,confusion_matrix
,inputs
) of fields are defined
-
environment.BaseEnvironment
-
_metrics_report ()
Build and save metrics string.
Returns:-
self
-
-
_plot_confusion_matrix ()
Save a graphical version of confusion matrix.
Returns:-
self
-
-
_plot_f1_score ()
Plot evolution of the F1-Score.
Returns:-
self
-
-
_plot_network_filters ()
Save a graphical representation of agent network filters
Returns:-
self
-
-
_plot_reward_per_ep ()
Plot evolution of reward per episode
Returns:-
self
-
-
_test ( steps )
Do some testing/evaluation interactions.
Parameters:-
number
steps
Number of interactions to do
- InteractionsResult Result of the interactions
-
number
-
_text_report ()
Build and print a quick textual report.
Returns:-
self
-
-
_torch_report ()
Save Torch components.
Todo:- save NN weights
-
self
-
_train ( steps )
Do some training interactions.
Parameters:-
number
steps
Number of interactions to do
- InteractionsResult Result of the interactions
-
number
-
draw_filters ( output_path, network )
Dump images of the filters of the convolutionnal network.
Parameters:-
string
output_path
Base output path for images -
nn.Container
network
Network to dump
-
string
Static Functions
keyboard_arrow_up-
_compute_classification_metrics ( confusion_matrix )
Compute classification metrics from a multi-classes confusion matrix.
See some explanations about metrics on this site:
Parameters:http://blog.revolutionanalytics.com/2016/03/com_class_eval_metrics_r.html
-
torch.Tensor
confusion_matrix
A 2D matrix
- ClassificationTable Classification metrics
-
torch.Tensor