📄 chopfield.h
字号:
#ifndef _HOPFIELD_H_
#define _HOPFIELD_H_
#include <fstream.h>
#include <time.h>
#include <stdlib.h>
#define NUMDATA 3
#define RESX 16
#define RESY 16
#define ELEMENTS RESX * RESY
#define _binary(x) ((x == -1) ? false : true)
#define _bipolar(x) ((x) ? 1 : -1)
typedef int(*_callback)(int, int);
class CHopfield {
public:
CHopfield();
~CHopfield();
bool ReadData(char *); // Read the data.
void Run(int); // Run the net.
void Train() { TrainNet(); }// Train the net.
void GetOutput(bool *, int);// Get the output.
// Sets the callback function. See Generation5
// at http://library.advanced.org/18242/hir.shtml
void SetCallback(_callback);
protected:
// The inputs.
int m_iInputs[NUMDATA][ELEMENTS];
int *m_piOutputs; // The outputs.
int *m_piThresholds; // The thresholds.
int **m_hiWeights; // The weights.
void TrainNet(); // Train the network.
void RunNet(); // Run the network.
void AdvanceNet(); // Advance the net.
bool AdvanceNeuron(int); // Advance a neuron.
_callback ImageAltered; // Callback function.
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -