From 626de7d19e77c7329c663a980495bfd52616f90d Mon Sep 17 00:00:00 2001 From: Xun Li Date: Mon, 3 Dec 2018 16:31:40 -0700 Subject: [PATCH] report weights for geometric centroids #1760 --- DialogTools/AbstractClusterDlg.cpp | 24 ++++++++++++++++++++++++ DialogTools/KMeansDlg.cpp | 13 +++++++++++++ Weights/DistUtils.cpp | 1 + 3 files changed, 38 insertions(+) diff --git a/DialogTools/AbstractClusterDlg.cpp b/DialogTools/AbstractClusterDlg.cpp index c3d67f258..1ad086458 100644 --- a/DialogTools/AbstractClusterDlg.cpp +++ b/DialogTools/AbstractClusterDlg.cpp @@ -737,6 +737,30 @@ double AbstractClusterDlg::CreateSummary(const vector >& solution, c if (isolated.size()>0) summary << _("Number of not clustered observations: ") << isolated.size() << "\n"; summary << _printConfiguration(); + + // auto weighting + if (m_use_centroids->IsChecked()) { + wxString w_val = m_wc_txt->GetValue(); + double w_valf = 0; + if (w_val.ToDouble(&w_valf)) { + double w_valf_vars = 1 - w_valf; + w_valf = w_valf * 0.5; + w_valf_vars = w_valf_vars / (columns - 2); + + summary << _("Use geometric centroids (weighting): \n"); + for (int i=0; iGetValue(); + long value_ncluster; + if (str_ncluster.ToLong(&value_ncluster)) { + ncluster = value_ncluster; + } + if (ncluster < 2 || ncluster > num_obs) { + wxString err_msg = _("Please enter a valid number of clusters."); + wxMessageDialog dlg(NULL, err_msg, _("Error"), wxOK | wxICON_ERROR); + dlg.ShowModal(); + return; + } + double mid = left + delta /2.0; // assume left is always not contiguity and right is always contiguity diff --git a/Weights/DistUtils.cpp b/Weights/DistUtils.cpp index 40389a06d..68dce194e 100644 --- a/Weights/DistUtils.cpp +++ b/Weights/DistUtils.cpp @@ -43,6 +43,7 @@ DistUtils::~DistUtils() delete kdTree; } } + double DistUtils::GetMinThreshold() { double max_1nn_dist = 0;