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

📄 neuronview.h

📁 神经网络中的多层感知器的BP(反向传播)学习算法
💻 H
字号:
#if !defined(AFX_NEURONVIEW_H__79BCA457_EBE2_40AB_9F64_FCF1E213BAA9__INCLUDED_)
#define AFX_NEURONVIEW_H__79BCA457_EBE2_40AB_9F64_FCF1E213BAA9__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// NeuronView.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CNeuronView window

class CPointf
{
public:
    CPointf(){x = 0.0; y = 0.0;}
    CPointf(double xval, double yval):x(xval), y(yval){}
    double x;
    double y;
};

class CWeightsListener
{
public:
    virtual void OnWeightsNotify(double *pdbWeights, int num) = 0;
};

class CMouseListener
{
public:
    virtual void LButtonDown(CPointf *pointf) = 0;
};

class CNeuronView : public CStatic
{
// Construction
public:
	CNeuronView();

// Attributes
public:

// Operations
public:
    /* converting between math point and client point */
    void MPtoLP(CRect& rect, CPointf *pointf, CPoint *point);
    void LPtoMP(CRect& rect, CPoint *point, CPointf *pointf);

    /* redraw the window */
    void Redraw();

    /* set the weights listener, which will receive the notification
       when weights changed */
    void SetWeightsListener(CWeightsListener *listener);
    void SetMouseListener(CMouseListener *listener);
    void WeightsNotify();
    void DrawLine(CDC& dc, CRect& rect, double w1, double w2, double b);
    void DrawCoordinate(CDC& dc, CRect& rect);
    
    void ResetNeuron(double dbLearnRate, double dbActiveLvl, double dbMomentum);
    void BeginAdjust();
    void EndAdjust();

    /* x, y is in math coordinate */
    void AddPoint(const CPointf *pPointf, int iPointClass);
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CNeuronView)
	protected:
	virtual void PreSubclassWindow();
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CNeuronView();
private:
    vector<CPointf> m_vecPoint;
    vector<int> m_vecPointClass;
    int m_iCurrentPoint;
    NeuralNetwork *m_pNeuralNetWork;
    //Neuron *m_pNeuron;

    BOOL m_bOver;
    HCURSOR m_hCursor;
    UINT m_uiTimerID;
    UINT m_uiTimeout;
    CMouseListener *m_pMouseListener;
    CWeightsListener *m_pWeightsListener;

    // Generated message map functions
protected:
	//{{AFX_MSG(CNeuronView)
	afx_msg void OnPaint();
	afx_msg LRESULT OnMouseLeave(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnMouseHover(WPARAM wParam, LPARAM lParam);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_NEURONVIEW_H__79BCA457_EBE2_40AB_9F64_FCF1E213BAA9__INCLUDED_)

⌨️ 快捷键说明

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