-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KMeans Sparse Init Update #2796
Closed
md-shafiul-alam
wants to merge
7
commits into
uxlfoundation:main
from
md-shafiul-alam:dev/kmeans-sparse-init-bug-fix
+24
−4
Closed
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2f52a21
bug fix in kmeans sparse init
md-shafiul-alam eee6863
format and error fix
md-shafiul-alam 328407d
align trial_count computation
md-shafiul-alam 137dee4
address review
md-shafiul-alam bc5138b
add comment and refactor
md-shafiul-alam a5891d0
update comments
md-shafiul-alam d7c2333
update comments
md-shafiul-alam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,8 @@ | |
* limitations under the License. | ||
*******************************************************************************/ | ||
|
||
#include <cmath> | ||
|
||
#include <daal/src/algorithms/kmeans/kmeans_init_kernel.h> | ||
|
||
#include "oneapi/dal/algo/kmeans_init/backend/cpu/compute_kernel.hpp" | ||
|
@@ -43,9 +45,17 @@ static compute_result<Task> call_daal_kernel(const context_cpu& ctx, | |
const std::int64_t column_count = data.get_column_count(); | ||
const std::int64_t cluster_count = desc.get_cluster_count(); | ||
|
||
std::int64_t trial_count = desc.get_local_trials_count(); | ||
if (trial_count == -1) | ||
{ | ||
const auto additional = std::log(cluster_count); | ||
trial_count = 2 + std::int64_t(additional); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add the comment describing the logic behind this. Maybe the link to Sklearn docs. |
||
|
||
daal_kmeans_init::Parameter par(dal::detail::integral_cast<std::size_t>(cluster_count), | ||
0, | ||
dal::detail::integral_cast<std::size_t>(desc.get_seed())); | ||
par.nTrials = trial_count; | ||
|
||
const auto daal_data = interop::convert_to_daal_table<Float>(data); | ||
const std::size_t len_input = 1; | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the description to updateMinDistForITrials function.
I understand that it was not there before, but I hope that by adding couple of comments at a time we can make oneDAL's code more readable.