-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
420 lines (411 loc) · 11.1 KB
/
main.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
// FannToolExpanded, GUI tool for ANN by using FANN library
// Copyright (C) 2020
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// Based on the FanTool Programmed by BlueKid http://derindelimavi.blogspot.com/ [email protected]
// generated by Fast Light User Interface Designer (fluid) version 1.0300
#ifndef main_h
#define main_h
#include <FL/Fl.H>
#include <string>
#include <math.h>
#include <deque>
#include "Fl_PlotXY.H"
#include "DataProcess.h"
#include <FL/fl_ask.H>
#include <FL/Fl_File_Chooser.H>
#include <FL/Fl_Native_File_Chooser.H>
#include <FL/Fl_Float_Input.H>
#include <FL/Fl_Chart.H>
#include <FL/filename.H>
#include <stdio.h>
#include <fann.h>
enum SelectType {Open,Save};
enum FileType {Data,Log,RawData,Network};
#include <FL/Fl_Double_Window.H>
extern Fl_Double_Window *window_main;
#include <FL/Fl_Menu_Bar.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Input.H>
extern Fl_Input *DataFile;
extern Fl_Input *TestFile;
#include <FL/Fl_Repeat_Button.H>
#include <FL/Fl_Value_Output.H>
extern Fl_Value_Output *Input;
extern Fl_Value_Output *Output;
#include <FL/Fl_Spinner.H>
extern Fl_Spinner *Layer;
extern Fl_Spinner *Hid1;
extern Fl_Spinner *Hid2;
extern Fl_Spinner *Hid3;
#include <FL/Fl_Choice.H>
extern Fl_Choice *Method;
extern Fl_Choice *HiddenActivationF;
extern Fl_Choice *OutputActivationF;
extern Fl_Choice *StopFunction;
#include <FL/Fl_Value_Input.H>
extern Fl_Value_Input *EReports;
extern Fl_Value_Input *MaxEpoch;
#include <FL/Fl_Tabs.H>
extern Fl_Tabs *Tabs;
extern Fl_Group *LogG;
#include <FL/Fl_Browser.H>
extern Fl_Browser *Out;
extern Fl_Group *GraphG;
extern Fl_PlotXY *Graph;
extern Fl_Value_Output *Ep;
extern Fl_Value_Output *Mse;
extern Fl_Spinner *nVData;
extern Fl_Value_Output *BitFailOut;
extern Fl_Value_Output *TestMse;
extern Fl_Value_Input *DesiredError;
extern Fl_Value_Input *BitFail;
extern Fl_Choice *ErrorFunction;
extern Fl_Value_Input *HiddenStepness;
extern Fl_Value_Input *OutputStepness;
extern Fl_Value_Input *DecayFactor;
extern Fl_Value_Input *MuFactor;
extern Fl_Value_Input *IncreaseFactor;
extern Fl_Value_Input *DecreaseFactor;
extern Fl_Value_Input *DeltaMin;
extern Fl_Value_Input *DeltaMax;
#include <FL/Fl_Counter.H>
extern Fl_Counter *ConnectionRate;
extern Fl_Counter *Momentum;
#include <FL/Fl_Check_Button.H>
extern Fl_Check_Button *Shuffle;
extern Fl_Check_Button *InitWghts;
extern Fl_Check_Button *OverTraining;
extern Fl_Spinner *LearningRate;
extern Fl_Value_Input *OutputChange;
extern Fl_Value_Input *OutputStag;
extern Fl_Value_Input *CandidateChange;
extern Fl_Value_Input *CandidateStag;
extern Fl_Value_Input *WeighMultiplier;
extern Fl_Value_Input *CandidateLimit;
extern Fl_Value_Input *MaxOutEpoch;
extern Fl_Value_Input *MaxCasndidatetEpoch;
extern Fl_Value_Input *NumCandidateGroups;
extern Fl_Value_Input *MaxCascade;
#include <FL/Fl_Button.H>
extern Fl_Button *But_Alg;
extern Fl_Button *But_Act;
#include <FL/Fl_Menu_Button.H>
extern Fl_Menu_Button *But_Trn;
extern Fl_Button *But_Test;
extern Fl_Menu_Button *But_Run;
extern Fl_Button *Stop;
extern Fl_Menu_Item menu_[];
void cb_Ok(Fl_Return_Button*o, void*w);
inline void Refresh();
void FillMethods();
void FillActivationF();
fann_type * GetWeigths(struct fann *ann);
void SetWeights(struct fann *ann,fann_type *w);
fann_type ExamineTrain(struct fann *ann,fann_train_enum tal,fann_activationfunc_enum hact,fann_activationfunc_enum oact,fann_train_data *TrainData);
int FANN_API LogOut(struct fann *ann, struct fann_train_data *train,unsigned int max_epochs, unsigned int epochs_between_reports,float desired_error, unsigned int epochs);
int FANN_API CascadeLogOut(struct fann *ann, struct fann_train_data *train,unsigned int max_epochs, unsigned int epochs_between_reports,float desired_error, unsigned int epochs);
int FANN_API DrawGraph(float epochs, float TrainMSE, float TestMSE,unsigned int newBitFail);
void SetHiddens();
void InactImg(Fl_Widget* o);
class FannTool {
public:
struct fann *ysa;
fann_type *result;
fann_type *data;
bool working;
bool stop;
bool overtraining;
fann_train_data *TrainData;
fann_train_data *TestData;
FannTool();
void OptimumAlgorithm();
void OptimumActivations();
void TrainNormal();
void TrainCascade();
void Test();
void Run();
void RunNormal();
void RunwithFile();
void RunAsTS();
void RunAsClassifier();
void ClearLog();
void SaveLog();
void LoadLog();
void StopProcess();
void About();
void Help();
void DataProcessing();
void LoadTrainData();
void LoadTestData();
void SetFineTuning();
void SetCascadeTuning();
void NeuralNetworkInfo();
private:
void CreateDesiredANN();
void ActivateStop();
void DeactivateStop();
void SaveANN();
void ClearTrainingMemory();
public:
int GetClass(int i);
int GetPredictionClass();
};
#include <FL/Fl_Scroll.H>
#include <FL/Fl_Return_Button.H>
extern void cb_Ok(Fl_Return_Button*, void*);
class GetInputs {
public:
struct fann *ann;
int ninputs, noutputs;
bool tseries;
private:
fann_type *data,*result;
public:
GetInputs(bool ts=false);
Fl_Double_Window *window;
Fl_Scroll *Grid;
Fl_Return_Button *Ok;
Fl_Scroll *GridOut;
private:
void cb_Run_i(Fl_Button*, void*);
static void cb_Run(Fl_Button*, void*);
public:
Fl_Spinner *kere;
void show(struct fann *iann);
void hide();
void Run();
void RunTS();
};
#include <FL/Fl_Box.H>
#include <FL/Fl_Output.H>
class NetInfo {
vector<double> weights;
public:
struct fann *ann;
NetInfo();
Fl_Double_Window *window;
Fl_Return_Button *Ok;
Fl_Value_Output *Input;
Fl_Browser *Hidden;
Fl_Value_Output *Output;
Fl_Output *NType;
Fl_Output *Alg;
Fl_Output *Err;
Fl_Output *Stop;
Fl_Choice *WLabel;
private:
void cb_WLabel_i(Fl_Choice*, void*);
static void cb_WLabel(Fl_Choice*, void*);
public:
Fl_Value_Output *WValue;
void show(struct fann *iann);
void hide();
};
#include <FL/Fl_Help_View.H>
class AboutDlg {
public:
AboutDlg();
Fl_Double_Window *window;
Fl_Return_Button *Ok;
Fl_Help_View *Help;
private:
void cb_8_i(Fl_Button*, void*);
static void cb_8(Fl_Button*, void*);
public:
void show();
void hide();
};
#include <FL/Fl_Round_Button.H>
class SaveDlg {
public:
SaveDlg();
Fl_Double_Window *window;
Fl_Return_Button *Ok;
Fl_Round_Button *Latest;
Fl_Round_Button *ANN0;
Fl_Round_Button *ANN1;
Fl_Round_Button *ANN2;
Fl_Group *OCS1;
Fl_Group *OCS2;
private:
void cb_Save1_i(Fl_Button*, void*);
static void cb_Save1(Fl_Button*, void*);
public:
void show();
void hide();
~SaveDlg();
};
#include <FL/Fl_Value_Slider.H>
class NDPDlg {
public:
NDPDlg(char * FileName);
Fl_Double_Window *window;
Fl_Return_Button *Ok;
private:
void cb_Ok_i(Fl_Return_Button*, void*);
static void cb_Ok(Fl_Return_Button*, void*);
public:
Fl_Output *RawFile;
Fl_Value_Output *nDataPoint;
Fl_Value_Output *nInput;
Fl_Counter *nOutput;
private:
void cb_nOutput_i(Fl_Counter*, void*);
static void cb_nOutput(Fl_Counter*, void*);
public:
Fl_Button *Wbt;
private:
void cb_Wbt_i(Fl_Button*, void*);
static void cb_Wbt(Fl_Button*, void*);
public:
Fl_Value_Slider *rTrain;
private:
void cb_rTrain_i(Fl_Value_Slider*, void*);
static void cb_rTrain(Fl_Value_Slider*, void*);
public:
Fl_Value_Slider *rTest;
private:
void cb_rTest_i(Fl_Value_Slider*, void*);
static void cb_rTest(Fl_Value_Slider*, void*);
public:
Fl_Check_Button *shuffle;
Fl_Input *fName;
Fl_Check_Button *Scale_D;
Fl_Counter *Item;
private:
void cb_Item_i(Fl_Counter*, void*);
static void cb_Item(Fl_Counter*, void*);
public:
Fl_Chart *Chart;
Fl_Value_Slider *MinV;
private:
void cb_MinV_i(Fl_Value_Slider*, void*);
static void cb_MinV(Fl_Value_Slider*, void*);
public:
Fl_Value_Slider *MaxV;
private:
void cb_MaxV_i(Fl_Value_Slider*, void*);
static void cb_MaxV(Fl_Value_Slider*, void*);
public:
Fl_Check_Button *Scale_I;
private:
void cb_Scale_I_i(Fl_Check_Button*, void*);
static void cb_Scale_I(Fl_Check_Button*, void*);
public:
Fl_Value_Input *Min;
private:
void cb_Min_i(Fl_Value_Input*, void*);
static void cb_Min(Fl_Value_Input*, void*);
public:
Fl_Value_Input *Max;
private:
void cb_Max_i(Fl_Value_Input*, void*);
static void cb_Max(Fl_Value_Input*, void*);
public:
void show();
void hide();
void GetItemData();
};
#include <FL/Fl_Light_Button.H>
class TDPDlg {
public:
TDPDlg(char * FileName);
Fl_Double_Window *window;
Fl_Return_Button *Ok;
private:
void cb_Ok1_i(Fl_Return_Button*, void*);
static void cb_Ok1(Fl_Return_Button*, void*);
public:
Fl_Output *RawFile;
Fl_Value_Output *nDataPoint;
Fl_Counter *nInput;
private:
void cb_nInput_i(Fl_Counter*, void*);
static void cb_nInput(Fl_Counter*, void*);
public:
Fl_Button *Wbt;
private:
void cb_Wbt1_i(Fl_Button*, void*);
static void cb_Wbt1(Fl_Button*, void*);
public:
Fl_Value_Slider *rTrain;
private:
void cb_rTrain1_i(Fl_Value_Slider*, void*);
static void cb_rTrain1(Fl_Value_Slider*, void*);
public:
Fl_Value_Slider *rTest;
private:
void cb_rTest1_i(Fl_Value_Slider*, void*);
static void cb_rTest1(Fl_Value_Slider*, void*);
public:
Fl_Check_Button *Shuffle;
private:
void cb_Shuffle_i(Fl_Check_Button*, void*);
static void cb_Shuffle(Fl_Check_Button*, void*);
public:
Fl_Input *fName;
Fl_Check_Button *Scale_D;
private:
void cb_Scale_D_i(Fl_Check_Button*, void*);
static void cb_Scale_D(Fl_Check_Button*, void*);
public:
Fl_Group *Gr;
Fl_Value_Input *Min;
private:
void cb_Min1_i(Fl_Value_Input*, void*);
static void cb_Min1(Fl_Value_Input*, void*);
public:
Fl_Value_Input *Max;
private:
void cb_Max1_i(Fl_Value_Input*, void*);
static void cb_Max1(Fl_Value_Input*, void*);
public:
Fl_Chart *Chart;
Fl_Value_Slider *MinV;
private:
void cb_MinV1_i(Fl_Value_Slider*, void*);
static void cb_MinV1(Fl_Value_Slider*, void*);
public:
Fl_Value_Slider *MaxV;
private:
void cb_MaxV1_i(Fl_Value_Slider*, void*);
static void cb_MaxV1(Fl_Value_Slider*, void*);
public:
Fl_Light_Button *Hist;
private:
void cb_Hist_i(Fl_Light_Button*, void*);
static void cb_Hist(Fl_Light_Button*, void*);
void cb_Time_i(Fl_Light_Button*, void*);
static void cb_Time(Fl_Light_Button*, void*);
public:
void show();
void hide();
void DrawGraph();
};
const char * OpenLink(Fl_Widget *w, const char *uri);
void Exit_CB(Fl_Widget*o, void*w);
extern Fl_Double_Window *splash;
#include <FL/Fl_Slider.H>
extern Fl_Slider *wait;
extern Fl_Return_Button *Ok;
extern Fl_Check_Button *nowait;
extern Fl_Browser *DMesg;
void splashScreen(int sec);
void fl_center(Fl_Double_Window*win);
char * FileSelect(char *Msg,FileType f,SelectType s=Open);
void mDonation();
#endif