Strani

sreda, 07. december 2016

Video: Two Deep Learning algorithms

  • Online web session (second half of  video, after 32 minutes of intro)


  • ABSTRACT

    In this video conference, two new algorithms for learning Feed-Forward Artificial Neural Network are presented. In the introduction, a brief description of the development of the existing algorithms and their flaws are shown. The second part describes the first new algorithm - Bipropagation. The basic idea is given first, followed by a detailed description of the algorithm. In the third part yet another new algorithm is given, called Border Pairs Method. Again is first given a basic idea and then follows a detailed description of the algorithm. In the fourth part, the results and findings of experimental work are presented. In the conclusion, it is found that two described algorithms are fast and reliable - the second one is also constructive.

    SPEAKER 

    Bojan PLOJ, PhD
    Born    1965 in Maribor, Slovenia, Europe
    Thesis   Border Pairs Method for learning of neural network
    Job 1 year R&D engineer at Birostroj Computers
       10 years teaching at Electronics high school in Ptuj
       4 years assistant professor University of Maribor
       7 years lecturer at Higher vocational college Ptuj
       3 years lecturer at the college of Ptuj (Artificial intelligence)
    Research
       Voice recognition with NN
       Hexapod gait control with NN
       Bipropagation algorithm for learning NN
       Border pairs method for learning NN 

ponedeljek, 14. november 2016

Bipropagation demo in TensorFlow

Rezultat iskanja slik za neural net


Bipropagation is new Deep Learning algorithm. It is much faster and much more reliable than Backpropagation. Here is the demo at ResearGate and GitHub. Inner layers are not hidden anymore, learning is done layer by layer. Please cite me in your work.

Any comments are desirable.

nedelja, 16. oktober 2016

Video prikaz dveh novih metod strojnega učenja, ki zasenčita dosedanjo metodo






Rezultat iskanja slik za ijs is2016


Raziskovalci se občasno sestanemo, da drug drugemu predstavimo svoje delo, svoje dosežke. Dobra priložnost za to so znanstvene konference. Ena naj bolj uglednih tovrstnih konferenc na področju umetne inteligence v Sloveniji z naslovom Informacijska družba 2016, se je odvila te dni na institutu Jožef Štefan v Ljubljani.

Rezultat iskanja slik za ijs is2016

Na njej smo obravnavali mnogo zanimivih tem, ki nam nakazujejo smer razvoja informacijske tehnologije v družbi v bližnji prihodnosti. Zadnja leta je vedno bolj v ospredju umetna inteligenca in strojno učenje, trenutno v svetu še posebej odmevajo dosežki globokega učenja. Nekatere druge teme so bile: evidentiranje genetsko modificiranih organizmov v živilih, zaznavanje stresa v službi, priporočanje čtiva, odkrivanje novih zlitin, sinteza slovenskega govora, razvoj avtonomnega vozila; seveda vse skupaj na osnovi umetne inteligence. Sam sem predstavil kolegom dva nova algoritma strojnega učenja, ki sem ju razvil v bližnji preteklosti. Več o vsebini si lahko ogledate v zborniku. Razen vsebine prispevkov, pa je na konferenci pomembno tudi navezovanje stikov s kolegi in izmenjava mnenj z njimi.

Video





sreda, 24. avgust 2016

Beyond Backpropagation


Advances in Machine Learning Research



Gartner is predicting a very bright near future for the "Machine learning". 2015 was a peak year of inflated expectations, now, in 2016 is following period of disillusionment and in 2017 should be reached the plateau of productivity. Elsewhere this process usually last for 10 years. One kind of the most popular modern "machine learning" is named "Deep Learning" what is another name for neural networks with little bit more layers and perhaps even with a convolution and/or recursion. The learning of this kinds networks was until now usually based on gradient descent, on slow, iterative, non-reliable process named Backpropagation. That kind of learning is very demanding and extensive. On plain computer can last for hours or even many days and is often unsuccessful concluded. Recently are appeared two algorithms that significantly improve this kind of machine learning: "Bipropagation" and "Border pairs method".


Bipropagation algorithm is still iterative like a "backpropagation", but internal layers are not hidden anymore since their desired values are now calculated in advance before learning. That way can machine learning be conducted layer by layer, what represents great improvement (it could be more than a few ten times faster).


"Border pairs method" is a totally new algorithm which has many advantages over "backpropagation" algorithm. Firstly we look for the pairs of patterns of opposite class which are so near, that no third pattern does lie in between them. This are the Border pairs and only this patterns are significant when we want to draw a borderline between classes. So the majority of learning patterns (sometimes more than 90%) is eliminated even before the learning begins. Then we are trying to separate all border pairs with a minimal number of border lines, which represent neurons of the 1st layer, so we find the minimal structure of the neural network. While we draw one by one borderline, the learning of the first layer is done with only one neuron at the same time. Since these neurons have a hard limiter, they put binary output values and so the next layers could even be replaced with a logical circuit. Border pairs also allow a simple reduction of the noise.


More info 

So it is time for a change.

petek, 01. julij 2016

Umetna inteligenca, odločitvena drevesa, nevronske mreže in mehka logika





Rezultat iskanja slik za elektrotehniška revijaPred kratkim sem dobil od urednika Elektrotehniške revije, g. Ervina Sršena, vabilo za objavo članka, ki se nanaša na moje raziskovalno področje - umetno inteligenco. Takšna čast te ne doleti vsak dan, zato sem se z veseljem odzval in se lotil pisanja. Z urednikom sva se dogovorila, da bo članek obsegal več nadaljevanj.  Prvo nadaljevanje govori o umetni inteligenci na splošno. Drugo nadaljevane govori o odločitvenih drevesih . V tretjem nadaljevanju so predstavljene nevronske mreže, v četrtem pa mehki asociativni pomnilnik. V pripravi pa je še eno nadaljevanje o genetskih algoritmih. Dragi bralec zanima me tvoje mnenje, ki ga lahko podaš v komentarju spodaj.

sobota, 12. marec 2016

Zgodovinski trenutek za umetno inteligenco



Trenutno globoko učenje (Deep learning) in z njim celotna umetna inteligenca doživlja razcvet, saj je v preteklem letu bilo doseženih nekaj pomembnih in odmevnih rezultatov kot so prepoznavanje fotografij in govora, prevajanje govorjenega besedila, pisanje besedila na osnovi podanih ključnih besed,... Danes, 12. 3. 2016 pa je bil tej zbirki uspehov dodan še en. Googlova globoka nevronska mreža (Deep neural Network) poimenovana AlphaGo je premagala v igri Go najboljšega igralca na svetu, Leeja Sedola.


Igralna plošča azijske miselne igre GO


V tej azijski miselni igri nasprotnika izmenjaje polagata črne in bele kamne na mrežo velikosti 19 krat 19. Nasprotnikovi kamni, ki so obdani z vseh 4 strani se odstranijo iz igralnega polja, cilj igre pa je zavzeti čim večji del tega polja.
Rezultat zgodovinskega dvoboja med človekom in strojem je bil 3 proti 0 v korist stroja. Poraženec Lee je po dvoboju izjavil, da je pozitivno presenečen nad zmogljivostjo umetne inteligence. Ta dogodek ima še toliko večjo težo za razvoj umetne inteligence, ker velja Go za izrazito strateško igro, kjer naučene poteze ne pridejo v poštev, saj je možnih situacij na igralni plošči več kot je vseh atomov vesolju.

Rezultat iskanja slik za alphago
Logotip zmagovalca na dvoboju med človekom in strojem

ponedeljek, 22. februar 2016

Bionika, zanimiv poklic prihodnosti

Živimo v času, ko se znanje ustvarja in širi vedno hitreje in temu trendu se pridružujemo tudi izobraževalne ustanove. Ponudba smeri in stopenj izobraževalnih programov se vsako leto povečuje in med novimi programi prevladujejo interdisciplinarni. To ustreza manjšim podjetjem, ki so bolj prožna in odzivna in se zato lahko bolje znajdejo v tem gospodarsko razburkanem času. V malih podjetjih namreč ni prostora za množico ozko usmerjenih strokovnjakov, v prednosti so kadri z interdisciplinarno širino, ki jo omogočata mehatronika in predvsem bionika.






     Na višji strokovni šoli na Ptuju smo že pred časom zaznali piš tega novega vetra in začeli prikrojevati naša jadra. Prvi korak v to smer je bil program Mehatronika, ki smo ga razvili pred približno desetletjem in povezuje med seboj več tehniških strok. Predvsem so to elektrotehnika, računalništvo in strojništvo. Trg delovne sile je potrdil našo vizijo saj se naši diplomanti uspešno zaposlujejo tako v Sloveniji, kakor tudi v tujini. Dodatna potrditev našega razmišljanja so številne šole v Sloveniji, ki so nam sledile in uvedle ta program tudi same.





      S študijskim letom 2012/13 smo na Šolskem centru Ptuj uvedli višješolski program Bionike, leta 2013/14 pa še visokošolskega. Tudi ta dva učna programa sta avtorsko delo Ptujskih strokovnjakov. Diplomanti višje šole bodo po dveh letih uspešnega študija pridobili naziv inženir bionike. Gre za interdisciplinarni poklic, ki ima še večjo širino od mehatronika, saj združuje tehniko in ekonomijo z živo naravo, ki velja za neusahljiv vir idej za različne stroke. Ne samo tehniki, tudi pravniki, ekonomisti in mnogi drugi črpajo svoje ideje v naravi, saj lahko tam vedno znova najdejo uporabne rešitve za izboljševanje izdelkov in storitev. Evolucija, izvirni greh življenja, je tekom več milijard let z naravno selekcijo na več milijardnih populacijah našla odgovore na številna zahtevna vprašanja. Človeški um  te zakladnice znanja še ne bo tako kmalu presegel, saj narava skrbno varuje svoje skrivnosti in nam jih izdaja le po drobtinicah.
Srednješolci, ki letos zaključujejo izobraževanje, se v tem trenutku nahajajo pred odločitvijo kam sedaj. Velika večina jih bo verjetno nadaljevala z izobraževanjem oziroma s študijem. In ker je izbira poklica je ena pomembnejših odločitev v življenju, jo je treba skrbno izpeljati. Predpogoj za to pa je informiranost. Vsi, ki vam je zakladnica narave blizu, ste vabljeni, da se seznanite s tem edinstvenim študijem v slovenskem prostoru. Prve informacije lahko najdete na spletu, za podrobnejšo seznanitev pa se oglasite na telefon (+386 (0)2 7871 812) ali pa nas obiščite. Dobrodošli, veselimo se vas.

ponedeljek, 08. februar 2016

Bipropagation demonstration in MatLAB

Here is given an example of the "bipropagation" algorithm for learning of NN. It is written in MatLAB language (R2015a) and is as similar as possible  to  "Deep learning" example "AutoencoderDigitsExample.m" which is included in MatLAB's Neural Network Toolbox. So you can easily compare both algorithms. I believe that my algorithm have few advantages over autoencoder. Please tell me what do you think about it. Please cite me in your works. Thanks a lot.

Download demo

======================================================
%% Training a Deep Neural Network for Digit Classification
% This example shows how to use the Neural Network Toolbox(TM) to train a
% deep neural network to classify images of digits and is very similar to
% "AutoencoderDigitsExample.m" which is included in
% Neuronal Network ToolBox from MatLAB. This example is made for comparison
% of both algorithms.
%
% Neural networks with multiple hidden layers can be useful for solving
% classification problems with complex data, such as images. Each layer can
% learn features at a different level of abstraction. However, training
% neural networks with multiple hidden layers can be difficult in practice.
%
% One way to effectively train a neural network with multiple layers is by
% training one layer at a time. You can achieve this by training separate
% hidden layers with biopropagation algorithm. 
%
% This example shows you how to train a neural network with two hidden
% layers to classify digits in images. First you train the hidden layers
% individually. Then you train a final softmax layer, and join the layers
% together to form a deep network, which is trained one final time.
%
% Copyright 2016, Bojan PLOJ PhD.


%% Data Set
% This example uses synthetic data throughout, for training and testing.
% The synthetic images have been generated by applying random affine
% transformations to digit images created using different fonts.
%
% Each digit image is 28-by-28 pixels, and there are 5,000 training
% examples. You can load the training data, and view some of the images.

% Load the training data into memory
[xTrainImages, tTrain] = digittrain_dataset;


%%
% The labels for the images are stored in a 10-by-5000 matrix, where in
% every column a single element will be 1 to indicate the class that the
% digit belongs to, and all other elements in the column will be 0. It
% should be noted that if the tenth element is 1, then the digit image is a
% zero.
%
% To use the images for training a neural network, you have to arrange them
% into a matrix where each column represents a single image. You can do
% this by stacking the columns of an image to form a vector, and then
% forming a matrix from these vectors.

% Get the number of pixels in each image
imageWidth = 28;
imageHeight = 28;
inputSize = imageWidth*imageHeight;

% Turn the training images into vectors and put them in a matrix
xTrain = zeros(inputSize, numel(xTrainImages));
for i = 1:numel(xTrainImages)
    xTrain(:,i) = xTrainImages{i}(:);
end

% Now that the training images have been arranged into a matrix, you are
% ready to begin training the network.

%% Training the first layer

%
% Bipropagation is an algorithm which attempts gradualy transform the
% input signal thrue the layers to the desired output signal.
% The size of individual layers usualy remain the same as is the size of
% the input. Only few outputs are slightly diferent than inputs according
% to the belonging class of pattern. Weight matrix
% started with values of eye matrix. Thus, the learning error is
% very small from the beginning on and learnin run very fast.

% Set the size of the hidden layer for hidden layers.

hiddenSize1 = 784;

% Create the network. You can experiment by changing the number of training
% epochs, and the training function
layer1 = perceptron;
layer1.trainFcn = 'trainscg';
layer1.trainParam.epochs = 1;

% Do not use process functions at the input or output
layer1.inputs{1}.processFcns = {};
layer1.outputs{1}.processFcns = {};

% Set the transfer function for both layers to the logistic sigmoid
layer1.layers{1}.transferFcn = 'satlin';


% Use all of the data for training
layer1.divideFcn = 'dividerand';%dividetrain,dividerand
layer1.performFcn = 'mse';



%%
% You now train the 1st layer. It should be noted that for the
% Bipropagation, the input data and target data are almost identical.


% Correction of xTrain according to the patterns class is:

correction=zeros(inputSize,5000);
 for i=1:5000
     for j=1:10
        correction(78*(j-1)+1:78*j,i)=tTrain(j,i)/10000000;
     end
 end
CorrectedxTrain=0.9999999*xTrain+correction*1;

layer1 = train(layer1,xTrain,xTrain);
layer1.IW{1,1}=eye(784);
layer1.b{1}=zeros(784,1);
rezultat=layer1(xTrain)-xTrain;
layer1.trainParam.epochs = 100;
layer1.trainParam.min_grad=0.0000000001;

layer1 = train(layer1,xTrain,CorrectedxTrain,'useGPU','yes','showResources','yes');


%% Visualizing the Results from the first layer
% After training the 1 st layer, you can gain an insight into the features
% it has learned by visualizing them. Each neuron in the hidden layer will
% have a vector of weights associated with it in the input layer which will
% be tuned to respond to a particular visual feature. By reshaping these
% weight vectors, we can view a representation of these features.

W1 = layer1.IW{1};
weightsImage = helperWeightsToImageGallery(W1,imageHeight,imageWidth,10,10);
imshow(weightsImage);

vmes=layer1(xTrain);

%% drugi sloj

% Create the network. You can experiment by changing the number of training
% epochs, and the training function
layer2= perceptron;
layer2.trainFcn = 'trainscg';
layer2.trainParam.epochs = 1;

% Do not use process functions at the input or output
layer2.inputs{1}.processFcns = {};
layer2.outputs{1}.processFcns = {};

% Set the transfer function for both layers to the logistic sigmoid
layer2.layers{1}.transferFcn = 'satlin';%satlin,logsig


% Use all of the data for training
layer2.divideFcn = 'dividerand';%dividetrain,dividerand



layer2.performFcn = 'mse';



%%
% You now train the 2nd layer. It should be noted that for an
% bipropagation, the input data and target data are almost identical.


 CorrectedxTrain=0.9999998*vmes+correction*2;

% Train the autoencoder
layer2 = train(layer2,xTrain,xTrain);
%pause(2);
layer2.IW{1,1}=eye(784);
layer2.b{1}=zeros(784,1);
rezultat=layer2(xTrain)-xTrain;
layer2.trainParam.epochs = 100;
layer2.trainParam.min_grad=0.0000000001;
layer2 = train(layer2,xTrain,CorrectedxTrain,'useGPU','yes','showResources','yes');




%% Visualizing the Results from the first layer
% After training the layer, you can gain an insight into the features
% it has learned by visualizing them. Each neuron in the hidden layer will
% have a vector of weights associated with it in the input layer which will
% be tuned to respond to a particular visual feature. By reshaping these
% weight vectors, we can view a representation of these features.

W1 = layer2.IW{1,1};
weightsImage = helperWeightsToImageGallery(W1,imageHeight,imageWidth,10,10);
imshow(weightsImage);

vmes2=layer2(xTrain);







%% Training the final Softmax Layer
% You will create a softmax layer, and train it on the output from the
% hidden layer of the second layerr. As the softmax layer only
% consists of one layer, you create it manually.

% Create an empty network
finalSoftmax = network;

% Set the number of inputs and layers
finalSoftmax.numInputs = 1;
finalSoftmax.numLayers = 1;

% Connect the 1st (and only) layer to the 1st input, and connect the 1st
% layer to the output
finalSoftmax.inputConnect(1,1) = 1;
finalSoftmax.outputConnect = 1;

% Add a connection for a bias term to the first layer
finalSoftmax.biasConnect = 1;

% Set the size of the input and the 1st layer
finalSoftmax.inputs{1}.size = hiddenSize1;
finalSoftmax.layers{1}.size = 10;

% Use the softmax transfer function for the first layer
finalSoftmax.layers{1}.transferFcn = 'softmax';

% Use all of the data for training
finalSoftmax.divideFcn = 'dividerand';%dividetrain,dividerand

% Use the cross-entropy performance function
finalSoftmax.performFcn = 'crossentropy';

% You can experiment by the number of training epochs and the training
% function
finalSoftmax.trainFcn = 'trainscg';
finalSoftmax.trainParam.epochs = 200;

%%
% Next, you train the softmax layer. 

finalSoftmax = train(finalSoftmax,vmes2,tTrain);





%%
% You join these layers together to form a multilayer neural network. You
% create the neural network manually, and then configure the settings, and
% copy the weights and biases from the bipropagation layers
% and softmax layer.

% Create an empty network
finalNetwork = network;

% Specify one input and three layers
finalNetwork.numInputs = 1;
finalNetwork.numLayers = 3;

% Connect the 1st layer to the input
finalNetwork.inputConnect(1,1) = 1;

% Connect the 2nd layer to the 1st layer
finalNetwork.layerConnect(2,1) = 1;
finalNetwork.layerConnect(3,2) = 1;



% Connect the output to the 3rd layer
finalNetwork.outputConnect(1,3) = 1;

% Add a connection for a bias term for each layer
finalNetwork.biasConnect = [1; 1; 1];

% Set the size of the input
finalNetwork.inputs{1}.size = inputSize;

% Set the size of the first layer to the same as the layer in autoencHid1
finalNetwork.layers{1}.size = hiddenSize1;
finalNetwork.layers{2}.size = hiddenSize1;



% Set the size of the third layer to the same as the layer in finalSoftmax
finalNetwork.layers{3}.size = 10;

% Set the transfer function for the first layer to the same as in
% autoencHid1
finalNetwork.layers{1}.transferFcn = layer1.layers{1}.transferFcn;%'satlin';
finalNetwork.layers{2}.transferFcn = layer2.layers{1}.transferFcn;%satlin



% Set the transfer function for the third layer to the same as in
% finalSoftmax
finalNetwork.layers{3}.transferFcn = 'softmax';

% Use all of the data for training
finalNetwork.divideFcn = 'dividetrain';


% Copy the weights and biases from the three networks that have already
% been trained
finalNetwork.IW{1,1} = layer1.IW{1,1};
finalNetwork.b{1} = layer1.b{1,1};

finalNetwork.LW{2,1} = layer2.IW{1,1};    
finalNetwork.b{2} = layer2.b{1,1};



finalNetwork.LW{3,2} = finalSoftmax.IW{1,1};    
finalNetwork.b{3} = finalSoftmax.b{1,1};


% Use the cross-entropy performance function
finalNetwork.performFcn = 'crossentropy';

% You can experiment by changing the number of training epochs and the
% training function
finalNetwork.trainFcn = 'trainscg';
finalNetwork.trainParam.epochs = 350;
finalNetwork.trainParam.min_grad=0.0000000000000001;

%%
% You can view a diagram of the multilayer network with the |view| command.
view(finalNetwork);

%%
% With the full deep network formed, you can compute the results on the
% test set. Before you can do this, you have to reshape the test images
% into a matrix, as was done for the training set.

% Load the test images
[xTestImages, tTest] = digittest_dataset;

% Turn the test images into vectors and put them in a matrix
xTest = zeros(inputSize, numel(xTestImages));
for i = 1:numel(xTestImages)
    xTest(:,i) = xTestImages{i}(:);
end

%%
% You can visualize the results with a confusion matrix. The numbers in the
% bottom right hand square of the matrix will give the overall accuracy.

y = finalNetwork(xTest);
plotconfusion(tTest,y);

%% Fine tuning the Deep Neural Network
% The results for the deep neural network can be improved by performing
% backpropagation on the whole multilayer network. This process is often
% referred to as fine tuning.
%
% You fine tune the network by retraining it on the training data in a
% supervised fashion. You then view the results again using a confusion
% matrix.

finalNetwork = train(finalNetwork,xTrain,tTrain,'useGPU','yes','showResources','yes');
y = finalNetwork(xTest);
plotconfusion(tTest,y);


%% Summary
% This example showed how to train a deep neural network to classify digits
% in images using the Neural Network Toolbox(TM). The steps that have been
% outlined could be applied to other similar problems such as classifying
% images of letters, or even small images of objects of a specific
% category.