double GHybridNonlinearPCA::predict(size_t item, size_t user)
{
//The user and item are reversed (the item is the user and user is the item)
//If the user is new
if(user >= m_pUsers->rows() || item >= m_items)
return 0.0;
Thank you! I have integrated these fixes into the tree. (I modified it slightly to use GTEMPBUF, which uses alloca, because it is faster than allocating on the heap.)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The major problem is regarding to array size in the GRecommander.cpp such as
Error 14 error C2057: expected constant expression d:\amber\wrokspace\waffles\waffles-code-0f8e1ebd0992c6f12b4fc1f8438a9acc7aaee049\src\gclasses\grecommender.cpp 1396 1 GClasses
the following version works, just a work around
double GHybridNonlinearPCA::predict(size_t item, size_t user)
{
//The user and item are reversed (the item is the user and user is the item)
//If the user is new
if(user >= m_pUsers->rows() || item >= m_items)
return 0.0;
/// Commentted out portion is for returning a weighted average instead of a weighted mode
// double sum =0;
// double denom = 0;
// double prediction = (m_pMaxs[item] - m_pMins[item]) * m_pModel->forwardPropSingleOutput(m_pUsers->row(neighbor), item) + m_pMins[item];
if(prediction > m_pMaxs[item])
prediction = m_pMaxs[item];
if(prediction < m_pMins[item])
prediction = m_pMins[item];
counts[(size_t) (prediction * 2)] += m_pRatingCount[neighbor];
}
i++;
/
if(m_pRatingCount[neighbor] > 50)
{
sum+=prediction * m_pRatingCount[neighbor];
denom+=m_pRatingCount[neighbor];
}
/
}
// return sum / denom;
}
Thank you! I have integrated these fixes into the tree. (I modified it slightly to use GTEMPBUF, which uses alloca, because it is faster than allocating on the heap.)