Deep Learning Visualizer
Interactive visualization of basic applications of deep learning
Loading...
Searching...
No Matches
network.h
Go to the documentation of this file.
1#pragma once
2
5#include <filesystem>
6#include <vector>
7
8#include <Eigen/Core>
9
10#include "models/data_point.h"
11#include "models/layer.h"
12
13namespace models {
14
15class network {
16public:
17 void to_file(const std::filesystem::path &file_path);
18
19protected:
20 explicit network(const std::vector<int> &layer_sizes);
21
22 explicit network(const std::filesystem::path &file_path);
23
29 void initialize_weights();
30
38 float backpropagate(const std::vector<models::data_point> &training_batch);
39
40 void set_input(const Eigen::VectorXf &input);
41 void update();
42
43 [[nodiscard]] const Eigen::VectorXf &output() const;
44
45private:
46 float backpropagate_once(const models::data_point &data_point);
47
48 void initialize_layers(const std::vector<int> &layer_sizes);
49
50 std::vector<layer> layers_;
51 std::vector<layer> gradient_layers_;
52 std::vector<layer> gradient_sum_layers_;
53};
54
55} // namespace models
Definition network.h:15
void initialize_weights()
Randomly initializes weights between each neuron using He initialization.
Definition network.cpp:98
float backpropagate(const std::vector< models::data_point > &training_batch)
Performs a single backprogatation step with a list of training data.
Definition network.cpp:109
A lightweight wrapper struct with a reference to an input and output row.
Definition data_point.h:12