Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Scilab by Hubert ( 15 years ago )
// Kod eksperymentu 2

funcprot(0);
exec('mlp.sce', -1);
funcprot(1);

architecture = [13 2 1];
betaParam = 1;
[trainingInput, trainingOutput] = readDataFromCSVFile('housing.data')

epochsNo = 500;
iters = 10;
learningCoeffs = [0.01 0.018 0.033 0.056 0.1 0.18 0.33 0.56 1 1.8 3.3 5.6 10];


for learningCoefficient = learningCoeffs
    clf();
    xtitle(sprintf('coeff. = %f' ,learningCoefficient), 't', 'SSE');
    for iter = 1:iters    
        W = createRandomizedWeights(architecture);
        SSElog = [];
        
        // Proces uczenia sieci w kolejnych epokach
        for epochNo = 1:epochsNo
          for exampleNo = 1:size(trainingInput, 1)
            [X, D] = getInputAndOutputVector(...
              trainingInput, trainingOutput, exampleNo);
              
            gradients = calculateGradients(W, X, D);
        
            for i = 1:length(W)
              W(i) = W(i) - learningCoefficient*gradients(i);
            end
          end
          
          SSE = calculateSSE(W, trainingInput, trainingOutput);
          SSElog(epochNo) = SSE;
        end
        
        // przetestuj siec -- wypisz wartosci zwracane dla kazdego 
        // z wektorow ze zbioru uczacego i porownaj z docelowymi
//        mprintf('\nTraining set examples results:\n');
//        for exampleNo = 1:size(trainingInput, 1)
//          [X, D] = getInputAndOutputVector(...
//              trainingInput, trainingOutput, exampleNo);
//          [XOut, U1, V1, U2, Y] = runNetwork(W, X);
//          if size(X, 1) ~= 13 or size(D, 1) ~= 1
//            error('Support for non-default input and output ' + ... 
//                    'is not implemented');
//          end    
//          mprintf('X= [%f %f]^T, D=%f, Y=%f\n', X(1, 1), X(2, 1), D, Y);
//        end
        
        plot(SSElog);
    end
    mprintf('Zadanie wykonane dla parametru %f\n', learningCoefficient);
    mprintf('Wcisnij enter, aby wykonac test dla kolejnego parametru\n');
    halt();

end
mprintf('To koniec\n');

 

Revise this Paste

Children: 32858 32870
Your Name: Code Language: