English 中文(简体)
总结马特拉布的一个内库网络
原标题:Equation that compute a Neural Network in Matlab

我创建了一个神经网络。 原文:


    load dati.mat;
    inputs=dati(:,1:8) ;
    targets=dati(:,9) ;
    hiddenLayerSize = 10;
    net = patternnet(hiddenLayerSize);
    net.inputs{1}.processFcns = { removeconstantrows , mapminmax ,  mapstd , processpca };
    net.outputs{2}.processFcns = { removeconstantrows , mapminmax ,  mapstd , processpca };

    net = struct(net);
    net.inputs{1}.processParams{2}.ymin = 0;
    net.inputs{1}.processParams{4}.maxfrac = 0.02;
    net.outputs{2}.processParams{4}.maxfrac = 0.02;
    net.outputs{2}.processParams{2}.ymin = 0;
    net = network(net);

    net.divideFcn =  divideind ;  
    net.divideMode =  sample ;  % Divide up every sample
    net.divideParam.trainInd = 1:428;
    net.divideParam.valInd = 429:520;
    net.divideParam.testInd = 521:612;
    net.trainFcn =  trainscg ;  % Scaled conjugate gradient backpropagation
    net.performFcn =  mse ;  % Mean squared error
    net.plotFcns = { plotperform , plottrainstate , ploterrhist ,  plotregression ,  plotconfusion ,  plotroc };
    net=init(net);
    net.trainParam.max_fail=20;

    [net,tr] = train(net,inputs,targets);

    outputs = net(inputs);
    errors = gsubtract(targets,outputs);
    performance = perform(net,targets,outputs)

Now I want to save the weights and biases of the network and write the equation. I had saved the weights and biases:


    W1=net.IW{1,1};
    W2=net.LW{2,1};
    b1=net.b{1,1};
    b2=net.b{2,1};

So, I ve done the data preprocessing and I wrote the following equation


    max_range=0;
    [y,ps]=removeconstantrows(input, max_range);

    ymin=0;
    ymax=1;
    [y,ps2]=mapminmax(y,ymin,ymax);

    ymean=0;
    ystd=1;
    y=mapstd(x,ymean,ystd);

    maxfrac=0.02;
    y=processpca(y,maxfrac);

    in=y ;

    uscita=tansig(W2*(tansig(W1*in+b1))+b2);

But with the same input input=[1:8] I get different results. why? What s wrong? Help me please! It s important!

I use Matlab R2010B

问题回答

它看上去的是预处理投入,而不是处理后产出。 员额处理采用“逆向”处理表。 (指标是预先处理,因此产出得到逆转处理)。

2. 公式

uscita=tansig(W2*(tansig(W1*in+b1))+b2); 

是错误的。 为什么要写两个<代码>tansig? 页: 1





相关问题
php - regex hostname extraction

I have been looking around for a regex expression that will spit out just the stackoverflow part and no www. or .com etc. All I could find was to check if the url s were valid... I have used php s ...

Linq Query Expression reuse

Post Edited Would this be possible ? Have a query expression that is precompiled i.e private static Func<SmwrDataContext, int, IQueryable<Xyz>> _validXyzs = CompiledQuery.Compile((...

JSP EL (Expression Language) causing problems in Eclipse

My system: Ubuntu 9.10. Eclipse 3.5.1 with Java EE 1.2.1 (manual install - NOT from synaptic). Web Developer Tools 3.1.1 I ve recently adopted someone else s code (a Dynamic Web Project), and run ...

Scripting After Effects

I need to learn Affect Effect expressions and scripting fast. Can you recommend any resources on this topic? I ve got a pretty knowledge of other scripting concept and languages like javascript. I ...

Embed a JQuery expression inside a css file?

As the question implies, can I add a JQuery script inside an css file as an expression? Or something like: .parent{ background-color: pink; position:relative; width: 100%; } .child{ ...

Boolean Expression Evaluation in Java

I m looking for a relatively simpler (when compared with writing a parser) way to evaluate boolean expressions in Java, and I do not want to use the JEP library. I have a String expression like: (x &...

Are these jQuery expressions equivalent?

I m wondering if these two expressions are equivalent, because if they are, it would make this much easier. $( div , this).filter( :not(.trigger) )... $( div:not([class*=trigger]) , this)... (this ...

Editing a xaml icons or images

Is it possible to edit a xaml icons or images in the expression design or using other tools? Is it possible to import a xaml images (that e.g you have exported) in the expression designer for editing?...

热门标签