-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHMC_BNN_adept.cpp
More file actions
39 lines (34 loc) · 930 Bytes
/
HMC_BNN_adept.cpp
File metadata and controls
39 lines (34 loc) · 930 Bytes
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
#include <iostream>
#include <math.h>
#include <random>
#include "adept.h"
#include "BNN.h"
// Provide function prototype for "algorithm"; see algorithm.cpp for
// the contents of the function
#include "algorithm.h"
int
main(int argc, char** argv)
{
int N = 300;
int L = 20;
int nOut = 50;
int nRep = 10;
int nBurn = 30;
int H = 4; /// number of hidden nodes
int in = 2; /// number of inputs
int np = 1+H*(2+in);
std::vector<HMC_type> data(N*in,1.0);
std::vector<HMC_type> weights(np,1.0);
std::vector<HMC_type> targets(N,1.0);
std::default_random_engine generator;
std::uniform_real_distribution<double> distribution(0.0,1.0);
for(int i=0;i<N;i++){
for(int j=0;j<in;j++){
data[i*in+j] = distribution(generator);
}
targets[i] = sin(data[i*in])*cos(data[i*in+1]);
}
BNN HMC_BNN(L, nOut, nRep, nBurn, H, in, data, weights, targets, "test.out");
HMC_BNN.run();
return 0;
}