MCPcopy Create free account
hub / github.com/davisking/dlib / mlp_kernel_1

Method mlp_kernel_1

dlib/mlp/mlp_kernel_1.h:57–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55 public:
56
57 mlp_kernel_1 (
58 long nodes_in_input_layer,
59 long nodes_in_first_hidden_layer,
60 long nodes_in_second_hidden_layer = 0,
61 long nodes_in_output_layer = 1,
62 double alpha_ = 0.1,
63 double momentum_ = 0.8
64 ) :
65 input_nodes(nodes_in_input_layer),
66 first_hidden_nodes(nodes_in_first_hidden_layer),
67 second_hidden_nodes(nodes_in_second_hidden_layer),
68 output_nodes(nodes_in_output_layer),
69 alpha(alpha_),
70 momentum(momentum_)
71 {
72
73 // seed the random number generator
74 std::ostringstream sout;
75 sout << time(0);
76 rand_nums.set_seed(sout.str());
77
78 w1.set_size(first_hidden_nodes+1, input_nodes+1);
79 w1m.set_size(first_hidden_nodes+1, input_nodes+1);
80 z.set_size(input_nodes+1,1);
81
82 if (second_hidden_nodes != 0)
83 {
84 w2.set_size(second_hidden_nodes+1, first_hidden_nodes+1);
85 w3.set_size(output_nodes, second_hidden_nodes+1);
86
87 w2m.set_size(second_hidden_nodes+1, first_hidden_nodes+1);
88 w3m.set_size(output_nodes, second_hidden_nodes+1);
89 }
90 else
91 {
92 w3.set_size(output_nodes, first_hidden_nodes+1);
93
94 w3m.set_size(output_nodes, first_hidden_nodes+1);
95 }
96
97 reset();
98 }
99
100 virtual ~mlp_kernel_1 (
101 ) {}

Callers

nothing calls this directly

Calls 4

resetFunction · 0.85
set_seedMethod · 0.45
strMethod · 0.45
set_sizeMethod · 0.45

Tested by

no test coverage detected