Ad
  • Custom User Avatar

    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".

  • Custom User Avatar

    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?

  • Default User Avatar

    Thanks... :) I hope you will try the 6x6!

  • Custom User Avatar
  • Custom User Avatar

    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.

  • Custom User Avatar

    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".