I am working on a project with the idea to cluster the sound waves of key strokes on a computer. So far what I have done was recorded about 50 keystrokes per key (only have done 1 - 10 so far), found their peaks and isolated the waveforms, then I created a chroma vector as the Feature Vector and run k-means on the resulting feature matrix.

After some very minor filtering I was able to get an accuracy of about 90% (taking accuracy as the mode cluster label for a group of keys as the true value, how many are the true value / total values). However, when I try to essentially classify new data it is far from accurate.

My initial thoughts as to why this probably wont work:

  1. The difference in any audio feature between keystrokes is minimal
  2. Many many more samples are required
  3. Clustering is not the best approach here (I don't have any formal reasoning here but I would guess a supervised alg would work better).
  4. The pre-processing I'm doing is not right. The only things I have done were normalize the audio files and use a smoothing function on the waveforms (no frequency analysis here!).

Any suggestions are appreciated.

  • $\begingroup$ You want to classify keystroke sound to particular key? What is your validation methodology? $\endgroup$ – Piotr Rarus - Reinstate Monica Dec 4 '19 at 8:35
  • $\begingroup$ Yes but I want to do so using unsupervised clustering techniques such as k-means or spectral clustering. Is there a way to use the existing key labels (this key is an "a") to guide the unsupervised clustering (so a semi-supervised clustering per se)? $\endgroup$ – joshy.poo Dec 5 '19 at 16:56
  • $\begingroup$ Do even think this is possible? For me most of the keys sounds the same, except maybe for space and return. $\endgroup$ – Piotr Rarus - Reinstate Monica Dec 5 '19 at 18:02

Always use a supervised algorithm when you have labeled data for your problem. Why would you ignore the labels, your most valuable bit of information?

To improve quality, you most likely need to improve your features.

  • $\begingroup$ Yes but I'm looking to see how well I can push clustering. $\endgroup$ – joshy.poo Dec 5 '19 at 13:42

I agree with @Anony-Mouse. Use Supervised learning and try LSTM, CNN for classifications if you can. Clustering is not the best approach for the Labelled data.

  • $\begingroup$ The whole point of this was to see how well clustering can perform not get the best results. Is there a way I can "cheat" and use the existing labels to guide where the centroids of k-means end for example (semi supervised)? $\endgroup$ – joshy.poo Dec 5 '19 at 16:55
  • 1
    $\begingroup$ Well, you can compute the centroid of your labeled partitions, and then you'll see that k-means has no chance to get your data right, because your data is not k well-separated signals + i.i.d. Gaussian noise. $\endgroup$ – Has QUIT--Anony-Mousse Dec 6 '19 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.