It’s Alive!

for my final year project i am attempting to teach a computer to think like a three month old baby..

obviously it must must lie around drooling a bit before it can gurgle and play hidey-peep with me but we’ve passed the first hurdle. I built a completely general purpose Perceptron. (yes, look impressed)

what’s more i’ve done on practically my first attempt at playing with Matlab.. I’m rather proud.. here’s the code.

% perceptron delta rule solution script
% data files :
% percept.input
% percept.teach

IN = load('percept.input'); % load input data
OUT = load('percept.teach'); % load target outputs

[datarows, inelem]=size(IN); % find size of data arrays
[testrows, outelem]=size(OUT);

nepochs = 1000;
gamma = 0.2;
TotError = zeros(nepochs*datarows,2);

W = 0.05* randn(inelem,outelem); % initialise random weight matrix

for n = 1:nepochs
for p = 1:datarows
% get appropriate input & target rows
A = IN(p,1:inelem);
T = OUT(p,1:outelem)';

% feedforward
O = activation(A*W,1,0);

% calculate & apply the delta adjustments
dW = gamma * (T - O) .* d_activation(A*W,1,0) * A';
W = W + dW;

% running count of total error
totsweep = (n-1)*datarows+p;
TotError(totsweep,1) = totsweep;
TotError(totsweep,2) = SumSquaresError(T,O);

see how it solves the logical AND problem and fails on XOR !! (ooh… aah…)

About caspar

Caspar is just one monkey among billions. Battering his keyboard without expectations even of peanuts, let alone of aping the Immortal Bard. By day he is an infantologist at Birkbeck Babylab, by night he runs
This entry was posted in good, psycho and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *