-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetwork.h
More file actions
86 lines (67 loc) · 2.59 KB
/
Network.h
File metadata and controls
86 lines (67 loc) · 2.59 KB
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
/*
* Network.h
*
* Copyright 2018 OFTNAI. All rights reserved.
*
*/
#ifndef NETWORK_H
#define NETWORK_H
// Forward declarations
class HiddenNeuron;
class BinaryWrite;
class HiddenRegion;
class InputRegion;
// Includes
#include "InputRegion.h"
#include "Param.h"
#include <vector>
#include "Utilities.h"
#include <gsl/gsl_cdf.h>
#include <gsl/gsl_randist.h>
using std::vector;
class Network {
private:
// Output FILE types
enum OUTPUT_FILE {
OF_REGIONAL = 0, //
OF_REGION_NEURONAL = 1, //
OF_REGION_SYNAPTIC = 2, //
OF_SINGLE_CELLS = 3 //
};
// Outputing
void outputHistory(const char * outputDirectory, bool isTraining);
void openHistoryFile(BinaryWrite & file, const char * outputDirectory, const char * filename, bool isTraining, OUTPUT_FILE fileType);
void outputRegionHistory(const char * outputDirectory, bool isTraining);
void outputNeuronHistoryData(const char * outputDirectory, bool isTraining, DATA data);
void outputSingleUnits(const char * outputDirectory);
void outputSynapticHistory(const char * outputDirectory);
// Utility functions
void buildESPathway();
void setupAfferentSynapsesV2();
void setupAfferentSynapsesForV3AndAbove(u_short esPathwayIndex);
void normalize(HiddenNeuron * n);
bool verbose;
Param p;
public:
vector<HiddenRegion> ESPathway;
InputRegion area7a;
gsl_rng * rngController;
// dnavarro2016 convergence
vector<vector<Synapse>> previous_epoch_synapses;
// Build new network based on these parameters
Network(const char * parameterFile, bool verbose);
// Load network from weight file
Network(const char * dataFile, const char * parameterFile, bool verbose, const char * inputWeightFile, bool isTraining);
// Destructor, frees ESPathway and rngController
~Network();
// Run based on parameter file supplied in constructor, argument is file list
// isTraining = true means that we apply learning rule in param file and run the number of epochs in the param file
// isTraining = false means that we have no learning and only run ONE epoch
void run(const char * outputDirectory, bool isTraining, int numberOfThreads, bool xgrid);
u_short runContinous(const char * outputDirectory, bool isTraining, bool xgrid);
// Save final weights of network
// dnavarro2016 convergence
int outputConvergence();
void outputFinalNetwork(const char * outputWeightFile);
};
#endif // NETWORK_H