00001 /* GUINeuralNet.h 00002 * 00003 * Copyright (C) 2003 -- Sebastian Nowozin 00004 * 00005 * Handle the entire GUI related stuff of the neural network. 00006 */ 00007 00008 #ifndef GUINEURALNET_H 00009 #define GUINEURALNET_H 00010 00011 #include <neuralnet/PerceptronNetwork.h> 00012 00013 #include <qwidget.h> 00014 #include <qpainter.h> 00015 #include <qsize.h> 00016 #include <qcolor.h> 00017 00018 #include <vector> 00019 00020 00027 class 00028 WeightMatrix : public QWidget 00029 { 00030 Q_OBJECT 00031 00032 public: 00039 WeightMatrix (QWidget *parent = 0, const char *name = 0); 00040 00043 ~WeightMatrix (void); 00044 00049 void setNet (PerceptronNetwork * net); 00050 00055 void setLayerNum (unsigned int layernum); 00056 00061 unsigned int getLayerMax (void) const; 00062 00063 00064 public slots: 00065 /* no slots needed? */ 00066 00067 protected: 00070 void paintEvent (QPaintEvent *); 00071 00072 private: 00075 unsigned int weight_fromcount; 00076 00079 unsigned int weight_tocount; 00080 00083 unsigned int layernum; 00084 00088 unsigned int x_needed; 00089 00093 unsigned int y_needed; 00094 00097 PerceptronNetwork * net; 00098 00102 vector<double> thetas; 00103 00106 double theta_min; 00107 00110 double theta_max; 00111 00114 double theta_mid; 00115 00118 double theta_rng; 00119 00123 vector<vector<double> > weights; 00124 00127 double weight_min; 00128 00131 double weight_max; 00132 00135 double weight_mid; 00136 00139 double weight_rng; 00140 00144 QPainter * painter; 00145 00152 void paintSquare (unsigned int wx, unsigned int wy, const QColor& col); 00153 00156 unsigned int margin_up; 00157 00160 unsigned int margin_down; 00161 00164 unsigned int margin_left; 00165 00168 unsigned int margin_right; 00169 00172 int x_box; 00173 00176 int y_box; 00177 00180 int square_size_x; 00181 00184 int square_size_y; 00185 }; 00186 00187 #endif 00188 00189