Presentation is loading. Please wait.

Presentation is loading. Please wait.

RCT tutorial 1 RC tutorial David Verstraeten. RCT tutorial 2 Reservoir Computing Random and fixed Trained.

Similar presentations


Presentation on theme: "RCT tutorial 1 RC tutorial David Verstraeten. RCT tutorial 2 Reservoir Computing Random and fixed Trained."— Presentation transcript:

1 RCT tutorial 1 RC tutorial David Verstraeten

2 RCT tutorial 2 Reservoir Computing Random and fixed Trained

3 RCT tutorial 3 Steps in training and testing Create random weight matrices –Input to reservoir –Reservoir to reservoir –(Output to reservoir) Scale weight matrices globally to the desired value Feed all input samples to the reservoir Collect reservoir states Train readout weight using linear regression or ridge regression

4 RCT tutorial 4 Scaling reservoir matrix: Spectral radius LTI system RC system Spectral radius

5 RCT tutorial 5 Training MNP InputsReservoirOutputs T1T1 T2T2 TSTS 1 2 S … 1 2 S … 1 2 S … AB

6 RCT tutorial 6 Linear/ridge regression AB W X = Linear regression Ridge regression

7 RCT tutorial 7 Pattern generation tasks: training Fixed connections Trained connections

8 RCT tutorial 8 Pattern generation: generation/testing WarmupFreerun Fixed connections Trained connections

9 RCT tutorial 9 Leaky integrator neurons

10 RCT tutorial 10 Global optimization parameters Input scaling Reservoir scaling (spectral radius) Leak rate Feedback scaling Regularization parameter (through cross- validation) Not: –connection fraction (only for spiking neurons) –reservoir size

11 RCT tutorial 11 RC toolbox

12 RCT tutorial 12 Outline Rationale, usage and structure Topology Datasets Cross-validation Parameter sweeps and custom scripts

13 RCT tutorial 13 Outline Rationale, usage and structure Topology Datasets Cross-validation Parameter sweeps and custom scripts

14 RCT tutorial 14 Rationale Reservoir Computing toolbox: Box of tools for –Quick-and-dirty experiments –Large scale parameter sweeps and optimizations Modular setup: function hooks for customization –Reservoir types –Learning rules –Scoring and evaluation methods

15 RCT tutorial 15 Getting started Download from http://snn.elis.ugent.be/rcthttp://snn.elis.ugent.be/rct Unpack, go to directory $RCT_ROOT and type: >> install For ‘Hello world’ experiment, type >> rc_simulate

16 RCT tutorial 16 Usage Default settings –Are ok as starting point for many experiments –Contained in $RCT_ROOT/default_settings/default_*.m –Look at these scripts! They give an overview of RCToolbox functionality

17 RCT tutorial 17 Custom settings Two ways of overriding defaults: –Command line >> dataset_generation_function=… @my_dataset_function(); >> rc_simulate; –Custom configuration file >> custom_configuration=‘my_conf’ >> rc_simulate; –Example: analog_speech.m Other examples: $RCTROOT/examples/configurations dataset_generation_function=@my_dataset_function(); topology.layer(3).scaling =.1; my_conf.m

18 RCT tutorial 18 Flow diagram for basic experiment Dataset Generate dataset Topology Generate topology Reservoir Simulate reservoir Evaluation Train readout layer and evaluate on test data

19 RCT tutorial 19 Structure of rc_simulate generic_simulaterc_simulate_jobrc_simulate Setup parameter sweeps Generate dataset Generate topology Simulate reservoir Construct state and weight matrices Simulate system Training and testing

20 RCT tutorial 20 Outline Rationale, usage and structure Topology Datasets Cross-validation Parameter sweeps and custom scripts

21 RCT tutorial 21 Standard topology for classification/regression Input Bias Reservoir Readout Mandatory Optional

22 RCT tutorial 22 Connectivity matrix between layers From/toInputBiasReservoirReadout Input0010/1 Bias000/1 Reservoir0011 Readout0000 Input Bias Reservoir Readout

23 RCT tutorial 23 Standard topology for classification/regression Mandatory Optional Bias Reservoir Readout

24 RCT tutorial 24 Connectivity matrix between layers From/toBiasReservoirReadout Bias00/1 Reservoir011 Readout010/1 Bias Reservoir Readout

25 RCT tutorial 25 Topology datastructure in the toolbox topology. –layer(1,n) –conn(n,n) –with n = number of layers Default settings: –$RCTROOT/default_settings/default_topology.m –Layer 1 : input –Layer 2 : bias –Layer 3 : reservoir –Layer 4 : readout

26 RCT tutorial 26 topology.layer(1:n). –size: integer –is_trained_offline: boolean –is_trained_online: boolean –node_type: string –training_function:function pointer –nonlin_functions: array of function pointers Topology datastructure in the toolbox

27 RCT tutorial 27 topology.layer(1:n). –init_simulation: function pointer –finish_simulation: function pointer –dt: float –regul_param: float –scoring: function pointer Topology datastructure in the toolbox

28 RCT tutorial 28 topology.conn(1:n,1:n). –is_active: boolean –creation_pipeline: array of function pointers –scaling_factor: float –conn_frac: float [0,1] –discrete_set: float array Topology datastructure in the toolbox

29 RCT tutorial 29 Topology creation pipeline Array of function pointers which pass weight matrices Generation functions –@gen_rand, @gen_1D, @gen_load Assignment functions –@assign_rand, @assign_discrete Scaling functions –@scale_specrad, @scale_constant

30 RCT tutorial 30 Topology creation pipeline Example (default for reservoir to reservoir connection): –topology.conn(3,3).creation_pipeline= {@gen_rand, @assign_randn, @scale_specrad} Can be customized! Function hooks gen_randassign_randnscale_specrad

31 RCT tutorial 31 Outline Rationale, usage and structure Topology Datasets Cross-validation Parameter sweeps and custom scripts

32 RCT tutorial 32 Dataset generation Function hook Default –dataset_generation_function=@dataset_narma_10(input_dt, input_maxtime, n_samples) Signature –function [inputs outputs] = my_dataset_function(…) –inputs = cell(1,nr_samples) inputs{:} = matrix (M,:); M = input dimensionality –outputs = cell(1,nr_samples) outputs{:} = matrix (P,:) or [] for signal generation tasks. P = output dimensionality Example: 10 th order NARMA

33 RCT tutorial 33 Data struct data.layer(1:n). –r : required/teacher forced states –s : simulated states

34 RCT tutorial 34 Outline Rationale, usage and structure Topology Datasets Cross-validation Parameter sweeps and custom scripts

35 RCT tutorial 35 Training and testing cross-validate –Training and testing using cross-validation cross_validate_grid -Training and testing using cross-validation with optimization of regularization parameter

36 RCT tutorial 36 Cross-validate Example: three-fold cross-validation with three samples. 1 1 2 2 3 3 Training Testing Results 1 1 2 2 3 3 error fold 1 Fold 1

37 RCT tutorial 37 Cross-validate Example: three-fold cross-validation with three samples. 1 1 2 2 3 3 Training Testing Results 1 1 2 2 3 3 error fold 1 Fold 2 error fold 2

38 RCT tutorial 38 Cross-validate Example: three-fold cross-validation with three samples. 1 1 2 2 3 3 Training Testing Results 1 1 2 2 3 3 error fold 1 Fold 3 error fold 2 error fold 3

39 RCT tutorial 39 Cross-validation Function hook: –train_params.cross_val_set_function –Default: @random_cross_val –Other possibilities: cross_val_only_training: no test set no_cross_val: simple train and test set random_freerun_cross_val : cross-validation for freerun tasks Freerun cross-validation 1 1 2 2 Training Testing 1 1 2 2 3 3 3 3 3 3 3 3 3 3 3 3 Fold 1 …

40 RCT tutorial 40 Cross-validate with gridsearch For optimization of regularization parameter Training Testing Results 1 1 3 3 error fold 1 Fold 1 Validation 2 2  1 1 2 2 3 3 Val. results error  error  error n … Subfold 1 2 2 1 1 Subfold 2  nn opt error fold 2 error fold 3 Fold 2 Fold 3

41 RCT tutorial 41 Outline Rationale, usage and structure Topology Datasets Cross-validation Parameter sweeps and custom scripts

42 RCT tutorial 42 Parameter sweeps parameter_ranges = struct( 'name', {}, 'range', {}); Example –1D sweep: parameter_ranges = struct( 'name', {‘topology.layer(3).size’}, 'range’, {10:10:100}); –2D sweep (all combinations!): parameter_ranges = struct( 'name', {‘topology.layer(3).size’, ‘topology.layer(1).scale_factor’}, 'range', {10:10:100,.1:.1:1});

43 RCT tutorial 43 Parameter sweeps Results are saved in output_directory Set save_results=true! Plot results of sweep –plot_error(output_directory) Get variables from simulation –get_saved_data(output_directory, variables)

44 RCT tutorial 44 Custom scripts Toolbox is: box of tools you can use to build your own experiments Good starting points: –$RCTROOT/examples/tutorial/tut1.m –$RCTROOT/examples/framework/rc_simulate _job.m

45 RCT tutorial 45 Questions


Download ppt "RCT tutorial 1 RC tutorial David Verstraeten. RCT tutorial 2 Reservoir Computing Random and fixed Trained."

Similar presentations


Ads by Google