-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from Az-r-ow/callbacks
ModelCheckpoint Callback
- Loading branch information
Showing
17 changed files
with
410 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,23 @@ | ||
#include "main.hpp" | ||
|
||
using namespace NeuralNet; | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
|
||
Eigen::MatrixXd m(2, 2); | ||
|
||
m << -4, 0, | ||
-1, -4; | ||
|
||
Eigen::MatrixXd m2 = m.cwiseAbs(); | ||
|
||
std::cout << m2 << "\n"; | ||
// Network network; | ||
// std::shared_ptr<Optimizer> AdamOptimizer = std::make_shared<Adam>(1); | ||
|
||
// std::shared_ptr<Layer> layer1 = std::make_shared<Dense>(3, ACTIVATION::SIGMOID, WEIGHT_INIT::GLOROT); | ||
// std::shared_ptr<Layer> layer2 = std::make_shared<Dense>(2, ACTIVATION::SIGMOID, WEIGHT_INIT::HE); | ||
// std::shared_ptr<Layer> layerOuput = std::make_shared<Dense>(2, ACTIVATION::SIGMOID, WEIGHT_INIT::GLOROT); | ||
|
||
// network.addLayer(layer1); | ||
// network.addLayer(layer2); | ||
// network.addLayer(layerOuput); | ||
|
||
// std::shared_ptr<Layer> l = network.getLayer(1); | ||
// std::cout << "fetched layer from network : " << l->getNumNeurons() << "\n"; | ||
// network.setup(AdamOptimizer); | ||
|
||
// network.setup(AdamOptimizer, LOSS::QUADRATIC); | ||
|
||
// std::cout << "num of layers : " << network.getNumLayers() << "\n"; | ||
#include <iostream> | ||
#include <string> | ||
|
||
// std::cout | ||
// << "Input Dense before training : " | ||
// << "\n"; | ||
// layer1->printWeights(); | ||
// layer1->printOutputs(); | ||
|
||
// std::cout << "Dense 2 before training : " | ||
// << "\n"; | ||
// layer2->printWeights(); | ||
// layer2->printOutputs(); | ||
|
||
// std::cout << "Output Dense before training : " | ||
// << "\n"; | ||
// layerOuput->printWeights(); | ||
// layerOuput->printOutputs(); | ||
|
||
// // training the network | ||
// std::vector<std::vector<double>> inputs; | ||
// inputs.push_back(randDVector(layer1->getNumNeurons(), -1, 1)); | ||
// inputs.push_back(randDVector(layer1->getNumNeurons(), -1, 1)); | ||
// std::vector<double> labels = {1, 1}; | ||
|
||
// TrainingData tr_data(inputs, labels); | ||
// tr_data.batch(1); | ||
|
||
// network.train(tr_data); | ||
|
||
// std::shared_ptr<Layer> input = network.getLayer(0); | ||
// std::shared_ptr<Layer> test = network.getLayer(1); | ||
// std::shared_ptr<Layer> test2 = network.getLayer(2); | ||
|
||
// std::cout << "Input Dense after training : " | ||
// << "\n"; | ||
// input->printWeights(); | ||
// input->printOutputs(); | ||
|
||
// std::cout << "Dense 2 after training : " | ||
// << "\n"; | ||
// test->printWeights(); | ||
// test->printOutputs(); | ||
|
||
// std::cout << "Output Dense after training : " | ||
// << "\n"; | ||
// test2->printWeights(); | ||
// test2->printOutputs(); | ||
using namespace NeuralNet; | ||
|
||
// std::vector<double> data = {1, 2, 3, 4, 5, 6, 7, 8}; | ||
int main(int argc, char *argv[]) { | ||
std::string fileName = "test.cpp"; | ||
std::string folderPath = "build/"; | ||
|
||
// Tensor t(data); | ||
std::string filepath = constructFilePath(folderPath, fileName); | ||
|
||
// t.batch(2); | ||
std::cout << "Constructed file path : " << filepath << "\n"; | ||
|
||
// std::vector<std::vector<double>> batch = t.getBatchedData(); | ||
Network test; | ||
|
||
// std::cout << "Num batches : " << batch.size() << "\n"; | ||
std::unique_ptr<Network> ptr = std::make_unique<Network>(); | ||
|
||
// TrainingData td(data, data); | ||
decltype(*ptr) obj = *ptr; | ||
|
||
// td.batch(2); | ||
std::cout << "Type of obj: " << typeid(obj).name() << std::endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
#pragma once | ||
|
||
#include <cereal/archives/binary.hpp> | ||
#include <fstream> | ||
#include <iostream> | ||
|
||
#include "src/NeuralNet/Network.hpp" | ||
#include "src/NeuralNet/data/Tensor.hpp" | ||
#include "src/NeuralNet/layers/Dense.hpp" | ||
#include "src/NeuralNet/layers/Layer.hpp" | ||
#include "src/NeuralNet/utils/Functions.hpp" | ||
#include "src/NeuralNet/optimizers/optimizers.hpp" | ||
#include "src/NeuralNet/data/Tensor.hpp" | ||
#include <fstream> | ||
#include <cereal/archives/binary.hpp> | ||
#include "src/NeuralNet/utils/Functions.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.