Skip to content
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

Samanthacampo/kmeans++ #34

Merged
merged 7 commits into from
Sep 3, 2020
Merged

Conversation

samanthacampo
Copy link
Contributor

Add kmeans++ centroid initialization option to kmeans.

Copy link
Member

@Craigacp Craigacp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few small changes, mostly documentation.

@@ -259,17 +286,16 @@ public int getInvocationCount() {
}

/**
* Initialisation method called at the start of each train call.
* Initialisation method called at the start of each train call when
* using uniform centroid initialisation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should say "Centroids are initialised using a uniform random sample from the feature domain" somewhere in the javadoc.


// go through every vector and see if the min distance to the
// newest centroid is smaller than previous min distance for vec
double tempDistance;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to define tempDistance outside the for loop. Better to keep it inside so the compiler doesn't think it actually lives any longer.

@@ -54,6 +55,9 @@ public String getOptionsDescription() {
public int iterations = 10;
@Option(charName='d',longName="distance",usage="Distance function to use in the e step. Defaults to EUCLIDEAN.")
public Distance distance = Distance.EUCLIDEAN;
@Option(charName='i',longName="initialisation",usage="Type of initialisation to use for centroids. Defaults " +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There already is a i argument, so this options class is invalid, could you change it to something else?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, there's no need to put the default into the usage string, I updated the options code to print that automatically. While you're in here could you remove the default bit from the other usage strings? I missed that in the docs pass I did.

Copy link
Member

@Craigacp Craigacp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Craigacp Craigacp merged commit f1e301f into oracle:main Sep 3, 2020
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.

2 participants