- add Rbm::normalize()

- normalize of training data

git-svn-id: http://moon:8086/svn/software/trunk/projects/Rbm@660 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2019-11-11 21:08:48 +00:00
parent 9593aea278
commit f610d2930e
5 changed files with 21 additions and 3 deletions
+12
View File
@@ -243,6 +243,18 @@ arma::mat Rbm::toVisibleProbs(const arma::mat &hidden) const
return probsLogistic(toVisibleState(hidden));
}
arma::mat Rbm::normalize(const arma::mat& src)
{
double mean = arma::accu(src)/src.n_elem;
arma::mat x = src - mean;
arma::mat x2 = x % x;
double stddev = sqrt(arma::accu(x2)/x2.n_elem);
std::cout << "mean" << " : " << std::endl << mean << std::endl;
std::cout << "stddev" << ": " << std::endl << stddev << std::endl;
return x/stddev;
}
void Rbm::uniform(arma::mat& srcDst, double stdDev, double mu)
{
#if 1