Skip to content

Add absolute tolerance to KMeans algorithm#1993

Merged
mwetter merged 6 commits intomasterfrom
issue1985_divisionByZeroKMeans
Apr 2, 2025
Merged

Add absolute tolerance to KMeans algorithm#1993
mwetter merged 6 commits intomasterfrom
issue1985_divisionByZeroKMeans

Conversation

@MassimoCimmino
Copy link
Copy Markdown
Contributor

@MassimoCimmino MassimoCimmino commented Mar 18, 2025

This closes #1985 and #1976.

I did not add any test since the issue occured in the already-implemented cases. Issue #1976 was caused by an error in the initialization of centroid positions.

@MassimoCimmino MassimoCimmino marked this pull request as draft March 18, 2025 14:58
@MassimoCimmino MassimoCimmino marked this pull request as ready for review March 18, 2025 16:15
@mwetter
Copy link
Copy Markdown
Contributor

mwetter commented Mar 25, 2025

@MassimoCimmino : Thanks for the changes. The verification fails due to a change in result of 0.4 K in one model, and in IBPSA.Utilities.Clustering.Validation.KMeans_1d, the returned clustering is different from the expected labelsExp. Can you please review and update as needed.

@MassimoCimmino
Copy link
Copy Markdown
Contributor Author

I updated labelsExp in IBPSA.Utilities.Clustering.Validation.KMeans_1d, IBPSA.Utilities.Clustering.Validation.KMeans_2d and IBPSA.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.ClusterBoreholes_100boreholes. The changes to IBPSA.Utilities.Clustering.KMeans enables the algorithm to find clusters with lower inertia. The difference in clusters in IBPSA.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.Validation.ClusterBoreholes_100boreholes would also explain the new results from the other models which use the same borefield geometry. I updated the results there also.

@mwetter mwetter merged commit 34a6573 into master Apr 2, 2025
3 checks passed
@mwetter mwetter deleted the issue1985_divisionByZeroKMeans branch April 2, 2025 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Division by zero in Clustering KMeans function

2 participants