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

📄 neuron.cpp

📁 该程序是在vc环境下编写的bp神经网络c++类库
💻 CPP
字号:



#include "stdAfx.h"
#include "neuron.h"



/*
                                                    ANN neuron link
                                                                                                                              */
//////////////////////////////////////////////////constructor/destructor////////////////////////////////////////////////////////
ANLink::ANLink(ANeuron *pinn, ANeuron *poutn, float in, float w, float add) : dwprv(0.0f)
{
        pinput_neuron = pinn;           //this neuron
        poutput_neuron  = poutn;        //out neuron

        ival = in;	                //input val
        this->w = w;                    //weight

        iadd = add;
}
ANLink::~ANLink()
{
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////








/*
                                                     ANN neuron
                                                                                                                              */
//////////////////////////////////////////////////constructor/destructor////////////////////////////////////////////////////////
ANeuron::ANeuron(): oval(0), delta(0), function(LINEAR)
{
}
ANeuron::~ANeuron()
{
        for (int i = 0; i < get_input_links_number(); i++)   //delete input links
                delete inputs[i];
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////add input link//////////////////////////////////////////////////
void ANeuron::add_bias()
{        
        inputs.push_back(new ANLink(this));
}
void ANeuron::add_input(ANeuron *poutn)       //add input link
{
        //poutn - N from previous layer
        ANLink *plnk = new ANLink(this, poutn); 
        inputs.push_back(plnk);
        if (poutn)                 
                poutn->outputs.push_back(plnk);        
}
///////////////////////////////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

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