25 lines
687 B
C++
25 lines
687 B
C++
#ifndef CORE_H
|
|
#define CORE_H
|
|
|
|
#include "typedef.hpp"
|
|
#include <vector>
|
|
#include <cmath>
|
|
|
|
class NeuralNetwork {
|
|
private:
|
|
int numLayers;
|
|
std::vector<int> sizes;
|
|
std::vector<std::vector<std::vector<double>>> weights;
|
|
std::vector<std::vector<double>> biases;
|
|
std::vector<std::vector<double>> outputs;
|
|
|
|
double sigmoid(double x) { return 1.0 / (1.0 + exp(-x)); }
|
|
double sigmoidDeriv(double x) { return x * (1.0 - x); }
|
|
|
|
public:
|
|
NeuralNetwork(LayerStructure_t layers[], int count);
|
|
std::vector<double> feedForward(const std::vector<double>& input);
|
|
double train(const std::vector<double>& input, const std::vector<double>& target, double lr);
|
|
};
|
|
|
|
#endif |