Improved status

git-svn-id: http://moon:8086/svn/software/trunk/projects/Rbm@562 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2019-10-21 22:13:49 +00:00
parent 188a467a73
commit 09963e2b63
3 changed files with 71 additions and 41 deletions
+24 -2
View File
@@ -1,8 +1,28 @@
#include <streambuf>
#include <cstdio>
#include <cmath>
#include <armadillo>
#include "Rbm.hpp"
class RbmListener : public Rbm::IListener
{
public:
RbmListener() {}
virtual ~RbmListener() {}
bool onProgress(const Rbm::Status &status)
{
std::cout << "Progress : " << 100*status.progress << " %" << std::endl;
std::cout << "epoch : " << status.epoch << std::endl;
std::cout << "trainingSizeRemain: " << status.trainingSizeRemain << std::endl;
std::cout << "error (per mini batch) = " << status.err << std::endl;
std::cout << "L1 = " << status.L1 << std::endl;
std::cout << "L2 = " << status.L2 << std::endl;
return true;
}
};
int main()
{
printf("Hallo, Welt!\n");
@@ -31,10 +51,12 @@ int main()
printf("Z.n_elem = %d\n", (int)Z.n_elem);
// +------>
RbmListener statusDisplay;
Rbm::Params params;
Rbm rbm(28*28, 64);
arma::mat batch = arma::randu(1000, 28*28);
rbm.train(batch, 1000, 100, params, nullptr);
arma::mat batch = arma::randu(100, 28*28);
rbm.train(batch, 100, 10, params, &statusDisplay);
// arma::mat v = arma::randu(28*28, 1);
// arma::mat h = rbm.toHidden(v);