Answers.Body: <p>By beginner-friendly, I'm assuming you mean straightforward to implement and get up and running with results using existing libraries. For better or worse, this is a bit different in my mind to having an underlying concept that is mathematically accessible and understandable to beginners (who may wish to try to implement it from scratch). Apologies if I've got this wrong.</p>
  <p>To this end, I would suggest exploring decision trees and random forest classifier. These algorithms (and others with similar syntax) are in the Scikit-learn Python library. There is online documentation, and numerous online tutorials for applying these methods targeting all levels of understanding. For example:</p>
  <ul>
  <li><a href="https://scikit-learn.org/1.5/modules/generated/sklearn.ensemble.RandomForestClassifier.html" rel="nofollow noreferrer">Scikit Learn documentation for random forest</a>,</li>
  <li><a href="https://www.kaggle.com/code/prashant111/random-forest-classifier-tutorial" rel="nofollow noreferrer">Kaggle random forest tutorial</a></li>
  <li><a href="https://www.datacamp.com/tutorial/random-forests-classifier-python" rel="nofollow noreferrer">Datacamp random forest tutorial</a></li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-11-17T06:44:07.470Z
Answers.Text: Oh great, thanks! what about unsupervised classification methods?
Answers.UserDisplayName: lframond
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-11-18T01:57:52.393Z
Answers.Text: A bit of a stretch answer with my limited experience with unsupervised classification methods: I've found non-linear multi-dimensional scaling useful to cluster features measured from small data (n=10^4). T-SNE may also be used to cluster spectrograms directly (see for example Jamie Macaulay's SoundSort: https://wildlabs.net/discussion/machine-learning-detect-fish-bomb-blasts). UMAP is another similar concept with a different underlying implementation. And of course transformers are all the rage these days (e.g. https://arxiv.org/html/2406.01253v1) so maybe worth checking out animal2vec etc.
Answers.UserDisplayName: Brian Miller
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-11-05T02:20:10.670Z
Answers.LastActivityDate: 2024-11-05T02:20:10.670Z
Answers.UserDisplayName: Brian Miller
Answers.Body: <p>Since the duration of your syllables are highly variable (from 7 to ~500 milliseconds), and low SNR, I would suggest reducing the spectrogram representation down to just a spectrum representation for each audio clip -- i.e. reducing the time-frequency representation down to just frequency, by taking the mean or the sum across time.</p>
  <p>I wouldn't normally recommend this, but the short durations and variable durations may make it a difficult task, and perhaps the spectrum alone is relatively robust and informative.</p>
  <p>The spectrum would give you, for example, 512 magnitude values (one for each frequency bin) which you can then treat as &quot;features&quot; in the same way as your simple acoustic parameters. A random forest algorithm (try <a href="https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html" rel="nofollow noreferrer">scikit-learn</a> or <a href="https://xgboost.readthedocs.io/en/stable/index.html" rel="nofollow noreferrer">XGBoost</a>) might be able to handle these features well, and also to combine them with your simple features.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-11-27T15:48:19.087Z
Answers.LastActivityDate: 2024-11-27T15:48:19.087Z
Answers.UserDisplayName: Dan Stowell
Body: <p>What would be a beginner-friendly algorithm (in python) to classify bird song syllables that can vary in duration by two orders of magnitude, and which SNR is not that good?</p>
  <p>I have a growing database of sound snippets containing bird song syllables. I have calculated &quot;simple&quot; acoustic parameters so far (peak frequency, min-max frequency, duration etc.) and I was hoping to also assign a syllable &quot;type&quot;. I have looked at different things but got very confused with the many options... Any help would be welcome!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-11-26T09:54:01.327Z
Comments.Text: Hi - interesting question. "Two orders of magnitude" seems to be a challenging part of your question. So, for example, ranging from 0.1 seconds to 10 seconds? The longer recordings are really individual syllables, or are they maybe much longer sequences? I'm wondering whether you really want to classify the whole of the longest recordings into just one label each.
Comments.UserDisplayName: Dan Stowell
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-11-27T13:33:05.523Z
Comments.Text: Hi, thanks for your reply, yes the duration of the syllables vary from 7 to ~500 milliseconds. The long syllables are actual unique syllables (like a very long trill for example) but maybe we can label all trills the same I guess?
Comments.UserDisplayName: lframond
Tags: <bird><python><classification><algorithm>
Title: automatic classification of calls of different durations
ThreadText: # automatic classification of calls of different durations
  
  (Asked by: username_0 on 2024-11-04)
  
  What would be a beginner-friendly algorithm (in python) to classify bird song syllables that can vary in duration by two orders of magnitude, and which SNR is not that good?
  
  I have a growing database of sound snippets containing bird song syllables. I have calculated "simple" acoustic parameters so far (peak frequency, min-max frequency, duration etc.) and I was hoping to also assign a syllable "type". I have looked at different things but got very confused with the many options... Any help would be welcome!
  
  **Tags:** bird, python, classification, algorithm
  
  > **Comments:**
  > **username_1**: Hi - interesting question. "Two orders of magnitude" seems to be a challenging part of your question. So, for example, ranging from 0.1 seconds to 10 seconds? The longer recordings are really individual syllables, or are they maybe much longer sequences? I'm wondering whether you really want to classify the whole of the longest recordings into just one label each.  
  > **username_0**: Hi, thanks for your reply, yes the duration of the syllables vary from 7 to ~500 milliseconds. The long syllables are actual unique syllables (like a very long trill for example) but maybe we can label all trills the same I guess?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2024-11-05. Score: 3
  
  By beginner-friendly, I'm assuming you mean straightforward to implement and get up and running with results using existing libraries. For better or worse, this is a bit different in my mind to having an underlying concept that is mathematically accessible and understandable to beginners (who may wish to try to implement it from scratch). Apologies if I've got this wrong.
  
  To this end, I would suggest exploring decision trees and random forest classifier. These algorithms (and others with similar syntax) are in the Scikit-learn Python library. There is online documentation, and numerous online tutorials for applying these methods targeting all levels of understanding. For example:
  
  * [Scikit Learn documentation for random forest](https://scikit-learn.org/1.5/modules/generated/sklearn.ensemble.RandomForestClassifier.html),
  * [Kaggle random forest tutorial](https://www.kaggle.com/code/prashant111/random-forest-classifier-tutorial)
  * [Datacamp random forest tutorial](https://www.datacamp.com/tutorial/random-forests-classifier-python)
  
  > **Comments:**
  > **username_0**: Oh great, thanks! what about unsupervised classification methods?  
  > **username_2**: A bit of a stretch answer with my limited experience with unsupervised classification methods: I've found non-linear multi-dimensional scaling useful to cluster features measured from small data (n=10^4). T-SNE may also be used to cluster spectrograms directly (see for example Jamie Macaulay's SoundSort: https://wildlabs.net/discussion/machine-learning-detect-fish-bomb-blasts). UMAP is another similar concept with a different underlying implementation. And of course transformers are all the rage these days (e.g. https://arxiv.org/html/2406.01253v1) so maybe worth checking out animal2vec etc.  
  
  ---
  
  ### Answer by username_1 on 2024-11-27. Score: 2
  
  Since the duration of your syllables are highly variable (from 7 to ~500 milliseconds), and low SNR, I would suggest reducing the spectrogram representation down to just a spectrum representation for each audio clip -- i.e. reducing the time-frequency representation down to just frequency, by taking the mean or the sum across time.
  
  I wouldn't normally recommend this, but the short durations and variable durations may make it a difficult task, and perhaps the spectrum alone is relatively robust and informative.
  
  The spectrum would give you, for example, 512 magnitude values (one for each frequency bin) which you can then treat as "features" in the same way as your simple acoustic parameters. A random forest algorithm (try [scikit-learn](https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html) or [XGBoost](https://xgboost.readthedocs.io/en/stable/index.html)) might be able to handle these features well, and also to combine them with your simple features.
  
  
  ---
  
  