Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
You are right. It's in the kata description: "if you have trouble discerning if the particular sequence of 1's is a dot or a dash, assume it's a dot".
I use my own implementation of k-mean with 0s and 1s together. in case of equal distances, the algorithm assign the value to smaller centroid (does this satisfy 'if you have trouble discernin if the particular ...'?).
The algorithm works fine except last two tests and I think I still have problem with initial centroids. Any hint about initialization?
Thanks... :) I hope you will try the 6x6!
Try now. :)
Why do you use k-means separately for 0's and 1's? The logic determining their lenths is the same, as described in the kata.
The input (after you cut extra 0's at the ends) consists of something that's approximately 1 in length, also maybe something that's approximately 3 in length, and also maybe something that's approximately 7 in length. That should be the basis of your k-means.
When this kata was created, scipy was not available here on CodeWars, so there was no any "version" of k-means available, so I had to create an implementation of my own, and it was a kind of a point.
Are you using both 0-token and 1-token lengths in calculating the statistics?
Also it's maybe worth quoting the kata description: "if you have trouble discerning if the particular sequence of 1's is a dot or a dash, assume it's a dot".