edit chatbot and core

This commit is contained in:
2026-04-29 02:05:59 +07:00
parent 224a6444ef
commit 0a7974260d
9 changed files with 326 additions and 105 deletions
+7 -10
View File
@@ -4,25 +4,22 @@
#include "typedef.h"
#include <vector>
#include <cmath>
#include <iostream>
#include <cstdlib>
class NeuralNetwork {
private:
int numLayers;
std::vector<int> layerSizes;
std::vector<std::vector<std::vector<double>>> weights; // weights[layer][to_node][from_node]
std::vector<std::vector<double>> biases; // biases[layer][node]
std::vector<std::vector<double>> outputs; // Храним выходы слоев для backprop
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 sigmoidDerivative(double x) { return x * (1.0 - x); }
double sigmoidDeriv(double x) { return x * (1.0 - x); }
public:
NeuralNetwork(LayerStructure_t layers[], int count);
std::vector<double> feedForward(std::vector<double> input);
void train(std::vector<double> input, std::vector<double> target, double learningRate);
std::vector<double> feedForward(const std::vector<double>& input);
double train(const std::vector<double>& input, const std::vector<double>& target, double lr);
};
#endif