Scheduler
polynomialNetworkTest.cpp
Go to the documentation of this file.
1 
10 #include <gtest/gtest.h>
12 
13 TEST(PolynomialNetworkTest, TestGetOutput)
14 {
15  size_t I = 2;
16  size_t O = 1;
17  size_t H = 3;
18  Mdp::PolynomialNetwork pol(nullptr, I, O, H);
19  auto inputWeights = std::vector<std::vector<double>>(I+1, std::vector<double>(H));
20  auto outputWeights = std::vector<std::vector<double>>(H, std::vector<double>(O));
21  inputWeights[0][0] = 1.0;
22  inputWeights[0][1] = 1.0;
23  inputWeights[0][2] = 1.0;
24  inputWeights[1][0] = 1.0;
25  inputWeights[1][1] = 1.0;
26  inputWeights[1][2] = 1.0;
27  inputWeights[2][0] = 1.0;
28  inputWeights[2][1] = 1.0;
29  inputWeights[2][2] = 1.0;
30 
31  outputWeights[0][0] = 1.0;
32  outputWeights[1][0] = 1.0;
33  outputWeights[2][0] = 1.0;
34 
35  pol.initializeWeights(inputWeights, outputWeights);
36 
37  std::vector<double> input{4.0, 5.0};
38 
39  std::vector<double> out = pol.getOutput(input);
40  double actualOutput = out[0];
41  std::vector<double> hidden = std::vector<double>(H, 0.0);
42 
43  double expectedOutput = 1.0 + 10.0 + 100.0;
44  EXPECT_DOUBLE_EQ(expectedOutput, actualOutput);
45 }
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
56 
void initializeWeights(std::vector< std::vector< double >> inputWeights, std::vector< std::vector< double >> outputWeights)
TEST(PolynomialNetworkTest, TestGetOutput)
const double pol
std::vector< double > getOutput(std::vector< double > input) override