⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newarchff.m

📁 bnn神经网络
💻 M
字号:
function NetArch = newarchff(neuron_num , input_num , input_type , neuron_type , weight_type , delay_type)
% NEWARCHFF     Create multilayer feedforward architecture for Biological
%               Neural Network (BNN)
% 
%   Version:    1.0
%   ----------------------------------
%   Amir Reza Saffari Azar, August 2004
%   amir@ymer.org
%   http://www.ymer.org
%   http://ee.sut.ac.ir/faculty/saffari/main.index

switch nargin
    case 6              % all arguments
        % nothing to do
        
    case 5
        delay_type  = 'zero';
        
    case 4
        delay_type  = 'zero';
        weight_type = 'random';
        
    case 3
        delay_type  = 'zero';
        weight_type = 'random';
        neuron_type = sign(randn(neuron_num , 1));
        
    case 2
        delay_type  = 'zero';
        weight_type = 'random';
        neuron_type = sign(randn(neuron_num , 1));
        input_type  = ones(input_num , 1);
                
    case 1
        delay_type  = 'zero';
        weight_type = 'random';
        input_num   = round(10*rand) + 1;
        neuron_type = sign(randn(neuron_num , 1));
        input_type  = ones(input_num , 1);
        
    case 0
        delay_type  = 'zero';
        weight_type = 'random';
        input_num   = round(10*rand) + 1;
        neuron_num  = round(10*rand) + 1;
        neuron_type = sign(randn(neuron_num , 1));
        input_type  = ones(input_num , 1);
        
end

total_neuron_num    = sum(neuron_num);
NetArch             = newarchfc(total_neuron_num , input_num , input_type , neuron_type , weight_type , delay_type);

%---modifying neuron weight and delay
layer_num   = length(neuron_num);

for k = 1:layer_num
    layer_neuron_num    = neuron_num(k);
    
    if k == 1
        row_index   = 1:layer_neuron_num;
        
        NetArch.NeuronWeight(row_index , :) = 0;
        NetArch.NeuronDelay(row_index , :)  = 0;
    else
        pre_layer_neuron_num        = neuron_num(k - 1);
        total_pre_layer_neuron_num  = sum(neuron_num(1:k - 1));
        
        row_index   = total_pre_layer_neuron_num + 1:total_pre_layer_neuron_num + layer_neuron_num;
        col_index   = [1:total_pre_layer_neuron_num - pre_layer_neuron_num , ...
            total_pre_layer_neuron_num + 1:total_neuron_num];
        
        NetArch.NeuronWeight(row_index , col_index)    = 0;
        NetArch.NeuronDelay(row_index , col_index)     = 0;
    end
end

%---modifying input weight and delay
NetArch.InputWeight(neuron_num(1) + 1:end , :) = 0;
NetArch.InputDelay(neuron_num(1) + 1:end , :)  = 0;

return

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -