1
$\begingroup$

I need some help regarding my final year project. I am fairly new to machine learning and I have tried a lot to understand how to train a model using logistic regression.


I have two datasets of audio clips of 5 seconds each, one of the babies crying voices and one of baby 'not crying'.


I want to train the model using logistic regression on google colab. Now I have been successful converting the audio clips to spectrogram images. But I am stuck in training the model because I am unable to understand how to train the model (the code is very complex where ever I have seen it up till now).


What I want is to train the model using logistic regression, and get 100 weights at the output. Then what will happen is that I will record baby crying audio using Arduino. Then I will get 100 data points from newly recorded audio.


Then the previous and new 100 weights will be multiplied one to one. and then added. and then a sigmoid function will be run on it(all of this calculation after getting 100 weights, will not happen in google colab but in Arduino).


And then if the output value is greater than 0.5, it means that baby is crying (which means that the newly recorded audio is of the baby crying) and if the value is less than 0.5, it means the baby is not crying. Now the 100 data points from the Arduino recording, have a range of 0 to 1. It will be good if the 100 weights of the trained model also lie between 0 to 1.


Any help regarding the code or links to a good tutorial video on logistic regression will be much appreciated.

$\endgroup$
4
  • $\begingroup$ Is your dataset files .wav format? $\endgroup$ – AIFahim Feb 28 at 14:40
  • $\begingroup$ @Fahim No, the file is mp3 format. $\endgroup$ – Muhammad Waqar Anwar Feb 28 at 14:58
  • $\begingroup$ Have you got your answer? $\endgroup$ – AIFahim Feb 28 at 18:58
  • $\begingroup$ I added the logistic regression tutorial in the answer from where I learned. You may mark the Answer as accepted then. $\endgroup$ – AIFahim Mar 2 at 16:16
1
$\begingroup$

As your context, You convert your audio clips to spectrogram images. The spectrogram is a visual representation of the spectrum of frequencies of sound.
Now you need to Extract Features from your dataset. There are many feature extraction technique for audio data (See this blog for knowledge).
The state of the art features extraction is now using: MFCC — Mel-Frequency Cepstral Coefficients.
By using librosa library we can easily implement the MFCC.
Here are some resources for MFCC :

After you extract features (Converted into MFCC), Then you need fit them into the Logistic Regression Model as you wanted. I share some resources which experiment with MFCC Features and Logistic Regression:

And for learn logistic regression, you may follow Machine Learning By Stanford, Coursera or follow this from youtube.

$\endgroup$
1
  • $\begingroup$ @alFahim thanks alot for the information. The problem that has arised is that MFCC outputs a single value for each audio file. But what is needed are 100 weights from the trained model through logistic regression. 100 datapoints will be taken from audio recording from arduino. and 100 weights which are with respect to time will be taken from trained model. then multiplication from 100 to 100 will happen one on one. then we will add the resultant 100 numbers and then sigmoid function will be applied on it. if value is greater than 0.5 then baby is crying. Hence kindly have a look on how can one $\endgroup$ – Muhammad Waqar Anwar Mar 5 at 19:14

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.