- assign training data with context
- calculate context on demand if empty git-svn-id: http://moon:8086/svn/software/trunk/projects/Rbm@773 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
+6
-6
@@ -40,15 +40,15 @@ public:
|
||||
{
|
||||
if (m_numContext)
|
||||
{
|
||||
arma::mat c_states = arma::zeros(batch.n_rows, m_numContext);
|
||||
m_context = arma::zeros(batch.n_rows, m_numContext);
|
||||
arma::mat ctx = arma::zeros(1, m_numContext);
|
||||
for (int i=1; i < batch.n_rows; i++)
|
||||
{
|
||||
arma::mat h = prob(v_to_h(arma::join_rows(batch.row(i-1), ctx)));
|
||||
ctx = h;
|
||||
c_states.row(i) = ctx;
|
||||
m_context.row(i) = ctx;
|
||||
}
|
||||
arma::mat batch_with_ctx = arma::join_rows(batch, c_states);
|
||||
arma::mat batch_with_ctx = arma::join_rows(batch, m_context);
|
||||
Rbm::setBatch(trainingData(batch_with_ctx));
|
||||
}
|
||||
else
|
||||
@@ -123,11 +123,11 @@ public:
|
||||
return vc.submat(0, numVisible() - m_numContext, 0, numVisible() - 1);
|
||||
}
|
||||
|
||||
arma::mat to_vc(const arma::mat &v, const arma::mat &c) const
|
||||
const arma::mat& context() const
|
||||
{
|
||||
return arma::join_rows(v, c);
|
||||
return m_context;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
std::string m_name;
|
||||
|
||||
Reference in New Issue
Block a user