-
Notifications
You must be signed in to change notification settings - Fork 177
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
Conversation
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.
Few small changes, mostly documentation.
Clustering/KMeans/src/main/java/org/tribuo/clustering/kmeans/KMeansTrainer.java
Show resolved
Hide resolved
@@ -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. |
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.
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; |
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.
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.
Clustering/KMeans/src/main/java/org/tribuo/clustering/kmeans/KMeansTrainer.java
Show resolved
Hide resolved
@@ -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 " + |
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.
There already is a i
argument, so this options class is invalid, could you change it to something else?
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.
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.
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.
LGTM
Add kmeans++ centroid initialization option to kmeans.