【代码贡献】QKMeans 提前拒绝不可能的聚类数量 - #66
Open
tokenjunkielabs wants to merge 1 commit into
Open
tokenjunkielabs wants to merge 1 commit into
tokenjunkielabs wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #13.
Summary
QuantumKmeans.fit()can retry forever whenk > n_samples: the empty-cluster recovery path can never reachlen(set(clusters)) == K, so it repeatedly reinitializes centers. This contribution rejects impossible/invalid cluster counts before any quantum-distance work while leaving valid-input algorithm behavior unchanged.Changes
kto be a positive integral value (excludingbool);k > number_of_samplesbefore quantum-distance execution;QuantumKmeansclass and valid-input implementation by guarding the publicfit()entry point;kand the impossiblek=3/ 2-sample case;QKmeansto the repository pytest collection list so the regression is not silently omitted.Validation
Sponsor branch:
156c25b25fe92ae1ed0a7d40d9b1cff4b2953009, rebuilt directly on currentdevelop@5f973efccb84bc193157d1ccebe32137e307293b; exact diff is one commit / three paths / +53/-0. The same semantic source/test payload previously completed the repository's installed-wheelPyQPanda Algorithm CI/CD Pipelinesuccessfully on owner PR #11, run 34750195853, before merge. No sponsor-head hosted-green claim is made.Original defect/implementation lineage: Z-Helix-94. Test-collection defect: MAL-Z57. Current-main integration: Z-Quine-913519-R8V.