//ADEED_BY_TS bool operator==(const FeatureStats& f1, const FeatureStats& f2) { size_t size = f1.size(); if (size != f2.size()) return false; for (size_t k=0; k < size; k++) { if (f1.get(k) != f2.get(k)) return false; } return true; }
void FeatureStats::Copy(const FeatureStats &stats) { m_available_size = stats.available(); m_entries = stats.size(); m_array = new FeatureStatsType[m_available_size]; memcpy(m_array, stats.getArray(), GetArraySizeWithBytes()); m_map = stats.getSparse(); }
void Data::outputSample( ostream &out, const FeatureStats &f1, const FeatureStats &f2 ) { // difference in score in regular features for(unsigned int j=0; j<f1.size(); j++) if (abs(f1.get(j)-f2.get(j)) > 0.00001) out << " F" << j << " " << (f1.get(j)-f2.get(j)); if (!hasSparseFeatures()) return; out << " "; // sparse features const SparseVector &s1 = f1.getSparse(); const SparseVector &s2 = f2.getSparse(); SparseVector diff = s1 - s2; diff.write(out); }