Home > TNNT_1_07 > FrontEnd > set_params.m

set_params

PURPOSE ^

SET_PARAMS sets the parameters on to the GUI

SYNOPSIS ^

function set_params(Handles,ThNN,TrainingParams)

DESCRIPTION ^

SET_PARAMS sets the parameters on to the GUI

Description:
Function to set the network and training parameters on the GUI.

Syntax:
SET_PARAMS(Handles,ThNN,TrainingParams);

Input Parameters:
o Handles: A structure containing the handles to all the GUI objects,
    as generated in ThNN_GUI.
o ThNN: An object of the theta neuron network class
o TrainingParams: A structure that contains information for training a
    theta neuron network, such as the learning method. This structure is
    generated by get_training_params.

Output Parameters:
o None

Example:
>> %Assumes valid simulation training results are loaded below
>> GUIHandle=start_ThNN;
>> Temp=get(GUIHandle,'UserData');
>> Handles=Temp{2};
>> cd('Results');
>> [File,PathLoad] = uigetfile('*.mat','Load Simulation...');
>> cd('..');
>> load([PathLoad, File]);
>> TrainingParams.Handles=Handles;
>> set_params(Handles,ThNN,TrainingParams);

See also theta_neuron_network

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function set_params(Handles,ThNN,TrainingParams)
0002 %SET_PARAMS sets the parameters on to the GUI
0003 %
0004 %Description:
0005 %Function to set the network and training parameters on the GUI.
0006 %
0007 %Syntax:
0008 %SET_PARAMS(Handles,ThNN,TrainingParams);
0009 %
0010 %Input Parameters:
0011 %o Handles: A structure containing the handles to all the GUI objects,
0012 %    as generated in ThNN_GUI.
0013 %o ThNN: An object of the theta neuron network class
0014 %o TrainingParams: A structure that contains information for training a
0015 %    theta neuron network, such as the learning method. This structure is
0016 %    generated by get_training_params.
0017 %
0018 %Output Parameters:
0019 %o None
0020 %
0021 %Example:
0022 %>> %Assumes valid simulation training results are loaded below
0023 %>> GUIHandle=start_ThNN;
0024 %>> Temp=get(GUIHandle,'UserData');
0025 %>> Handles=Temp{2};
0026 %>> cd('Results');
0027 %>> [File,PathLoad] = uigetfile('*.mat','Load Simulation...');
0028 %>> cd('..');
0029 %>> load([PathLoad, File]);
0030 %>> TrainingParams.Handles=Handles;
0031 %>> set_params(Handles,ThNN,TrainingParams);
0032 %
0033 %See also theta_neuron_network
0034 
0035 %Copyright (C) 2008 Sam McKennoch <Samuel.McKennoch@loria.fr>
0036 
0037 
0038 C=filesep;
0039 
0040 %TrainingParams
0041 set(Handles.Display_Frequency,'String',num2str(TrainingParams.DisplayFrequency));
0042 set(Handles.Testing_Frequency,'String',num2str(TrainingParams.TestingFrequency));
0043 
0044 set(Handles.Max_Error,'String',num2str(TrainingParams.MaxError));
0045 set(Handles.Num_Epochs,'String',num2str(TrainingParams.NumEpochs));
0046 set(Handles.Training_Data,'UserData',TrainingParams.Type);
0047 set(Handles.Input_Data,'String',TrainingParams.DataName);
0048 %Update DataType Menus
0049 set(Handles.axes3,'UserData',{});
0050 RegressionData=get(Handles.Regression,'String');
0051 ClassificationData=get(Handles.Classification,'String');
0052 SpikeTimesData=get(Handles.Spike_Times,'String');
0053 
0054 if ismember(TrainingParams.DataName,RegressionData)
0055     set(Handles.Classification,'Value',1);
0056     set(Handles.Spike_Times,'Value',1);
0057     set(Handles.Regression,'Value',strmatch(TrainingParams.DataName,RegressionData));
0058     set(Handles.Training_Data,'UserData','Regression');
0059     set_io_data(Handles,[pwd, C, 'Datasets', C, 'Regression', C, TrainingParams.DataName],...
0060         TrainingParams.DataName);
0061     
0062 elseif ismember(TrainingParams.DataName,ClassificationData)
0063     set(Handles.Regression,'Value',1);
0064     set(Handles.Spike_Times,'Value',1);
0065     set(Handles.Classification,'Value',strmatch(TrainingParams.DataName,ClassificationData));
0066     set(Handles.Training_Data,'UserData','Classification');
0067     set_io_data(Handles,[pwd, C, 'Datasets',C,'Classification',C, TrainingParams.DataName],...
0068         TrainingParams.DataName);
0069 
0070 elseif ismember(TrainingParams.DataName,SpikeTimesData)
0071     set(Handles.Classification,'Value',1);
0072     set(Handles.Regression,'Value',1);
0073     set(Handles.Spike_Times,'Value',strmatch(TrainingParams.DataName,SpikeTimesData));    
0074     set(Handles.Training_Data,'UserData','SpikeTimes');
0075     set_io_data(Handles,[pwd, C,'Datasets',C,'SpikeTimes',C, TrainingParams.DataName],...
0076         TrainingParams.DataName);
0077 
0078 else 
0079     disp('Warning: Dataset associated with loaded parameters is not in the current database');
0080 end
0081 
0082 
0083 Training_Method_Strings=(get(Handles.Training_Method,'String'));
0084 set(Handles.Training_Method,'Value',find(strcmp(Training_Method_Strings,TrainingParams.LearningMethod)));
0085 set(Handles.Learning_Rate,'String',num2str(TrainingParams.WeightLearningRate));
0086 set(Handles.Tau_Learning_Rate,'String',num2str(TrainingParams.DelayLearningRate));
0087 set(Handles.Delay_Enable,'Value',TrainingParams.DelayEnable);
0088 set(Handles.Numerical_Gradient,'Value',TrainingParams.NumericalGradient);
0089 
0090 %Network Params
0091 %Assumes networks made with GUI will
0092 %1) Have at most one layer of hidden neurons
0093 %2) Have identical alpha's for all neurons
0094 %3) Have identical Io in each layer
0095 %4) The indices of the hidden neurons immediately follow the input neuron indices
0096 NumInputs=length(ThNN.InputNeurons);
0097 NumOutputs=length(ThNN.OutputNeurons);
0098 NumNeurons=length(ThNN.Neurons);
0099 NumHidden=NumNeurons-(NumInputs+NumOutputs);
0100 set(Handles.Alpha,'String',num2str(ThNN.Neurons(1).Alpha));
0101 if NumHidden>0
0102     set(Handles.Hidden_Inot,'String',num2str(ThNN.Neurons(max(ThNN.InputNeurons)+1).Io));
0103     set(Handles.Output_Inot,'String',num2str(ThNN.Neurons(ThNN.OutputNeurons(1)).Io));
0104     set(Handles.Num_Hidden_Neurons,'String',num2str(NumHidden));
0105 else
0106     set(Handles.Hidden_Inot,'String','0');
0107     set(Handles.Output_Inot,'String',num2str(ThNN.Neurons(ThNN.OutputNeurons(1)).Io));
0108     set(Handles.Num_Hidden_Neurons,'String','0');
0109 end
0110 
0111 set(Handles.Reference_Time,'String',num2str(ThNN.ReferenceTime));
0112 %set(Handles.Randomize_Inot,'Value',TrainingParams.Randomize_Inot);
0113 set(Handles.NIPS2006_Gradient,'Value',ThNN.NIPS2007Gradient);
0114 
0115 %Don't set or unset other boxes, wini and Io random, since we cannot say
0116 %from the ThNN

Generated on Wed 02-Apr-2008 15:16:32 by m2html © 2003