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

📄 cpnet.h

📁 神经网络:用感知规则进行感知。。来自网上的代码
💻 H
字号:
// Perceptron Neural Network Class
// Artificial Neural Net: Perceptron Using Perceptron Learning Rule

#ifndef CPNET_H
#define CPNET_H

#include <cstdio>
#include <conio.h>
#include <windows.h>
#include <iostream>
#include <ctime>
using std::cout;
using std::endl;
using std::cin;

class CPnet {
    public:
        CPnet();
		~CPnet();
		void CPMenu(void); // creates a menu for the program
		void CreateNet(void); // function for creating Neural Net
		void SaveNet(void); // function for saving Neural Net to a file
		void LoadNet(void); // function for loading Neural Net from file
		void TrainNetwork(void); // function for training Neural Net
		void TestNetwork(void); // function for testing Neral Net
		void SelectiveTest(int pattern_num ); // performs selective patterns test
		void Train(); // function for training Neural Net
		void Run(); // function for testing Neral Net
		bool fExist( char* filepath ); // checks if a given filename exist
		float ComputeWeightedSum(float *Input); // compute weighted sum
		void RandomizeWeights(); // initialise weight vector with random values
		void ComputeAverageError(); // computes average error
		void NormalizeInput(); // normalize the input vector
		void NormalizeTarget(); // normalize the target vector
		void DeNormalizeInput(); // denormalize input vector
		void DeNormalizeTarget(); // denormalize input vector
		void UpdateScreen(); // function for updating the screen
		void SaveCurrentData(); // saves current net data
	private:
		char *szNeuralNetName; // name or complete path for the Neural Net
		float LEARNING_RATE; // learning rate for the Neural Net
		int CPN_ITER;  // number of epochs or training sessions for the Neural Net
		float *Input; // input vector
		float *Output; // output vector
		float *input; // temporary input vector
		float *delta; // delta
		float *Target; // target vector
		float *Weight; // weight vector
		float threshold; // threshold
		int input_num; // number of inputs
		int neuron_num; // number of neurons
		int target_num; // number of targets
		int total_input_num; // total number of inputs
		float fAverageError; // variable for average error
		float Max; // greatest input value
		float MaxT; // greatest target value
		bool bNeuralNetCreated;
		bool bNeuralNetTrained;
		bool bNeuralNetSaved;
		bool bNeuralNetLoaded;
		bool bNewModifications;
};


#endif






⌨️ 快捷键说明

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