Loading src/descriptor_identifier/model/ModelClassifier.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -100,6 +100,7 @@ ModelClassifier::ModelClassifier(std::string prop_label, void ModelClassifier::set_n_misclassified() { // Objects needed to calculate the number of points in the overlapping regions of the convex hulls set_train_test_error(); std::vector<bool> train_misclassified(_n_samp_train); Loading Loading @@ -404,7 +405,6 @@ std::string ModelClassifier::error_summary_string(std::vector<double> prop, } case LOSS_TYPE::SILHOUETTE_SCORE: { std::cout << "HERE HERE " << (*_loss)(_feats) << std::endl; error_stream << "Sil Score Loss : " << (*_loss)(_feats); break; } Loading src/loss_function/LossFunctionCalinskiHarabasz.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -101,7 +101,7 @@ double LossFunctionCalinskiHarabasz::operator()(const std::vector<int>& inds) double LossFunctionCalinskiHarabasz::operator()(const std::vector<model_node_ptr>& feats) { populate_from_feats(feats); return compute_CH(); return -1.0 * compute_CH(); } double LossFunctionCalinskiHarabasz::compute_w() Loading src/loss_function/LossFunctionClustering.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -145,6 +145,7 @@ void LossFunctionClustering::populate_from_inds(const std::vector<int>& inds) } void LossFunctionClustering::populate_from_feats(const std::vector<model_node_ptr>& feats) { for (int f = 0; f < feats.size(); f++) { dcopy_(_n_samp, feats[f]->svm_value().data(), 1, &_a[f], _n_feat); Loading @@ -154,12 +155,13 @@ void LossFunctionClustering::populate_from_feats(const std::vector<model_node_pt int test_start = 0; for (int i = 0; i < _n_task; i++) { std::vector<double*> train_ptrs(_n_feat); std::vector<double*> test_ptrs(_n_feat); for (int j = 0; j < _n_feat; j++) std::vector<double*> train_ptrs(feats.size()); std::vector<double*> test_ptrs(feats.size()); for (int j = 0; j < feats.size(); j++) { test_ptrs[j] = feats[j]->test_value_ptr() + test_start; train_ptrs[j] = feats[j]->value_ptr() + train_start; test_ptrs[j] = feats[j]->test_value_ptr() + train_start; } _svm[i]->train(train_ptrs); Loading tests/googletest/loss_function/test_silhouette_score_loss.cc +1 −1 Original line number Diff line number Diff line Loading @@ -194,7 +194,7 @@ TEST_F(LossFunctionSilhouetteScoreTests, ManualDeterminationFeats) double silhouette_score = loss(_model_phi); double sil_score = loss_copy({0,1}); EXPECT_NEAR(sil_score, -0.187931, 0.0001); EXPECT_NEAR(sil_score, 0.187931, 0.0001); EXPECT_NEAR(silhouette_score,0.466666, 0.0001); } Loading Loading
src/descriptor_identifier/model/ModelClassifier.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -100,6 +100,7 @@ ModelClassifier::ModelClassifier(std::string prop_label, void ModelClassifier::set_n_misclassified() { // Objects needed to calculate the number of points in the overlapping regions of the convex hulls set_train_test_error(); std::vector<bool> train_misclassified(_n_samp_train); Loading Loading @@ -404,7 +405,6 @@ std::string ModelClassifier::error_summary_string(std::vector<double> prop, } case LOSS_TYPE::SILHOUETTE_SCORE: { std::cout << "HERE HERE " << (*_loss)(_feats) << std::endl; error_stream << "Sil Score Loss : " << (*_loss)(_feats); break; } Loading
src/loss_function/LossFunctionCalinskiHarabasz.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -101,7 +101,7 @@ double LossFunctionCalinskiHarabasz::operator()(const std::vector<int>& inds) double LossFunctionCalinskiHarabasz::operator()(const std::vector<model_node_ptr>& feats) { populate_from_feats(feats); return compute_CH(); return -1.0 * compute_CH(); } double LossFunctionCalinskiHarabasz::compute_w() Loading
src/loss_function/LossFunctionClustering.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -145,6 +145,7 @@ void LossFunctionClustering::populate_from_inds(const std::vector<int>& inds) } void LossFunctionClustering::populate_from_feats(const std::vector<model_node_ptr>& feats) { for (int f = 0; f < feats.size(); f++) { dcopy_(_n_samp, feats[f]->svm_value().data(), 1, &_a[f], _n_feat); Loading @@ -154,12 +155,13 @@ void LossFunctionClustering::populate_from_feats(const std::vector<model_node_pt int test_start = 0; for (int i = 0; i < _n_task; i++) { std::vector<double*> train_ptrs(_n_feat); std::vector<double*> test_ptrs(_n_feat); for (int j = 0; j < _n_feat; j++) std::vector<double*> train_ptrs(feats.size()); std::vector<double*> test_ptrs(feats.size()); for (int j = 0; j < feats.size(); j++) { test_ptrs[j] = feats[j]->test_value_ptr() + test_start; train_ptrs[j] = feats[j]->value_ptr() + train_start; test_ptrs[j] = feats[j]->test_value_ptr() + train_start; } _svm[i]->train(train_ptrs); Loading
tests/googletest/loss_function/test_silhouette_score_loss.cc +1 −1 Original line number Diff line number Diff line Loading @@ -194,7 +194,7 @@ TEST_F(LossFunctionSilhouetteScoreTests, ManualDeterminationFeats) double silhouette_score = loss(_model_phi); double sil_score = loss_copy({0,1}); EXPECT_NEAR(sil_score, -0.187931, 0.0001); EXPECT_NEAR(sil_score, 0.187931, 0.0001); EXPECT_NEAR(silhouette_score,0.466666, 0.0001); } Loading