當前位置:編程學習大全網 - 源碼下載 - matlab中init函數的用法?

matlab中init函數的用法?

功能

在matlab中init 用於初始化神經網絡

語法

net = init(net)

性質

init(net)根據最新的網絡初始化函數返回神經網絡的權值和誤差,其結果由net.initFcn,和參數值,net.initparam影響。

示例

在這裏,我們創建壹個雙輸入(範圍在0到1,和-2到2)單神經元感知器。而壹旦建立了模型我們就可以得到其權值和閾值。

net = newp([0 1;-2 2],1);

net.iw{1,1}

net.b{1}

對感知器進行訓練,改變其權值和閾值。

P = [0 1 0 1; 0 0 1 1];

T = [0 0 0 1];

net = train(net,P,T);

net.iw{1,1}

net.b{1}

重新將權值和閾值初始化。

net = init(net);

net.iw{1,1}

net.b{1}

上面最後的命令已經將權值和閾值重新歸零,這就是 init函數在感知器中的應用。

說明

init函數根據參數值net.initParam調用net.initFcn對權值和閾值進行初始化。通常情況下,net.initfcn設置為'initlay',根據其net.layers{i}.initFcn.初始化每壹層的權值和閾值。反向傳播網絡(BP網絡),將net.layers{i}.initFcn 設置為“initnw',使用Nguyen-Widrow 方法初始化第i層的權值和閾值。其他類型的網絡,將net.layers{i}.initFcn 設置為 'initwb',用其自帶的初始化函數初始化權值和閾值。最常見的權值的初始化結果是隨機數,隨機產生於-1到1之間。

英文help為:

在MATLAB中神經網絡的初始化

BP神經網絡的知識表示和構建

matlab中神經網絡的init函數

2010-01-11 15:31:45| 分類: 神經網絡 | 標簽:matlab 神經網絡 init |字號大中小 訂閱

init

Initialize a neural network

Syntax

net = init(net)

Description

init(net) returns neural network net with weight and bias values updated according to the network initialization function, indicated by net.initFcn, and the parameter values, indicated by net.initParam.

Examples

Here a perceptron is created with a two-element input (with ranges of 0 to 1, and -2 to 2) and 1 neuron. Once it is created we can display the neuron's weights and bias.

net = newp([0 1;-2 2],1);

net.iw{1,1}

net.b{1}

Training the perceptron alters its weight and bias values.

P = [0 1 0 1; 0 0 1 1];

T = [0 0 0 1];

net = train(net,P,T);

net.iw{1,1}

net.b{1}

init reinitializes those weight and bias values. net = init(net);

net.iw{1,1}

net.b{1}

The weights and biases are zeros again, which are the initial values used by perceptron networks (see newp).

Algorithm

init calls net.initFcn to initialize the weight and bias values according to the parameter values net.initParam.

Typically, net.initFcn is set to 'initlay' which initializes each layer's weights and biases according to its net.layers{i}.initFcn.

Backpropagation networks have net.layers{i}.initFcn set to 'initnw', which calculates the weight and bias values for layer i using the Nguyen-Widrow initialization method.

Other networks have net.layers{i}.initFcn set to 'initwb', which initializes each weight and bias with its own initialization function. The most common weight and bias initialization function is rands, which generates random values between -1 and 1.

  • 上一篇:戰鬥之心源代碼
  • 下一篇:求助,有關圖像去霧的問題
  • copyright 2024編程學習大全網