how can i use genetic algorithm to teain preceptron

3 visualizaciones (últimos 30 días)
mohammed
mohammed el 21 de Mzo. de 2011
Hi all;
how can i use genetic algorithm to teain Perceptrons?

Respuestas (1)

Timothy Felty
Timothy Felty el 21 de Mzo. de 2011
If you have a genetic algorithm already, the easiest way is to make the weights the chromosomes, and then use the error of the perceptron as the goal function. When error is less than your desired threshold freeze the best individual as the weights.
If you have different possible activation functions you could include them in the chromosomes and have the GA find that as well.
  1 comentario
mohammed
mohammed el 22 de Mzo. de 2011
I have Perceptron algorthim,
could you help me to add GA for training
=================
inputs = xlsread('data1.xls', 1, 'A2:D115');
inputs=inputs';
targets = xlsread('data1.xls', 1, 'L2:L115');
targets = targets';
numHiddenNeurons = 20; % Adjust as desired
net = newpr(inputs,targets,numHiddenNeurons);
net.divideParam.trainRatio = 70/100; % Adjust as desired
net.divideParam.valRatio = 15/100; % Adjust as desired
net.divideParam.testRatio = 15/100; % Adjust as desired
net.trainParam.epochs= 1000;
net.trainParam.goal=0.01;
net.adaptFcn= 'trains';
% Train and Apply Network
net.trainFcn= 'trainbr';%'trainbfg''trainbr';'trainlm';
[net,tr] = train(net,inputs,targets);
outputs = sim(net,inputs);
=================

Iniciar sesión para comentar.

Categorías

Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by