Skip to content

Commit

Permalink
Added random diff generation
Browse files Browse the repository at this point in the history
  • Loading branch information
FuexFollets committed Feb 8, 2024
1 parent c0c3a3a commit 83192ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/lexocraft/neural_network/neural_network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ namespace lc {
return input;
}

NeuralNetwork::NeuralNetworkDiff NeuralNetwork::random_diff() const noexcept {
return NeuralNetworkDiff(layer_sizes);
}

float NeuralNetwork::sigmoid_abs(float value) {
return 0.5F + value / (2 * (1 + std::abs(value)));
}
Expand Down
3 changes: 2 additions & 1 deletion src/lexocraft/neural_network/neural_network.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include <filesystem>
#include <vector>

#include <Eigen/Core>
#include <cereal/cereal.hpp>
#include <cereal/types/vector.hpp>
#include <Eigen/Core>

#include <lexocraft/cereal_eigen.hpp>

Expand Down Expand Up @@ -84,6 +84,7 @@ namespace lc {
void train(float cost);

[[nodiscard]] Eigen::VectorXf compute(Eigen::VectorXf input) const noexcept;
[[nodiscard]] NeuralNetworkDiff random_diff() const noexcept;

void save_file(const std::filesystem::path& filepath) const;

Expand Down

0 comments on commit 83192ec

Please sign in to comment.