classdef perceptrons
    %UNTITLED2 Summary of this class goes here
    %   Detailed explanation goes here
    
    properties
        layers;
        w;
        nL;
        a; 
        gW;
    end
    
    methods
        function obj=perceptrons(layers,w,nL)
        % layers include input, hidden and output layers
            obj.w=w;
            obj.nL=nL;
            obj.layers=layers;
        end 
        function obj=ff(obj,x)

            [n d]=size(x);
            a{1}=x;
            for i=1:obj.layers-1
                h{i}=[a{i} ones(n,1)]*obj.w{i};
                switch obj.nL{i}
                    case 'sigmoid'
                    case 'tanh'
                        a{i+1}=tanh(h{i});
                    case 'linear'
                        a{i+1}=h{i};
                    case 'softmax'
                    case 'threshold'
                end %switch
            end
            obj.a=a;
        end
        function [u v]=uv(obj,x)
                % calculate u{n} and v{n} for all n 
                % by flowchart 2
                % x: a batch of input data
                
        end
        function obj=cal_gW(obj,x)
            [u v]=obj.uv(obj,x)
            % x : single data
            % flowchart 3
        end
        function gradient_check(obj,x)
            % x : single data
            % flow chart 4a and 4b
    end
    
end

