- moved Rbm:prob() to Matutils::prob()

- Matutils::Normalize uses prob()
This commit is contained in:
2024-01-29 13:04:13 +01:00
parent fe8142627d
commit c0445f3bf8
5 changed files with 13 additions and 13 deletions
+7 -2
View File
@@ -56,6 +56,11 @@ namespace Matutils
#endif
}
inline arma::mat prob(const arma::mat &src)
{
return 1 / (1 + (arma::exp(-src)));
}
inline arma::mat normalize(const arma::mat& src)
{
std::cout << "Normalizing Training Data ..." << std::endl;
@@ -63,7 +68,7 @@ namespace Matutils
// Dim = 0: Normalize over training all training pattern
// Dim = 1: Normalize over single training pattern
double k = 1;
size_t dim = 0;
size_t dim = 1;
arma::mat mean = arma::mean(src, dim);
arma::mat stddev = arma::stddev(src, 0, dim);
@@ -85,7 +90,7 @@ namespace Matutils
arma::mat y = xn/(std_mat + 1e-9);
std::cout << "mean" << " : " << std::endl << arma::mean(y, dim) << std::endl;
std::cout << "stddev" << ": " << std::endl << arma::stddev(y, 0, dim) << std::endl;
return y;
return prob(y);
}
inline arma::mat char2vec(char c, size_t len)