def create_fft(fn)sample_ratex scipy io wavfile read(fnfft_features abs(scipy fft( )[: ]base_fnext os path splitext(fndata_fn base_fn fftnp save(data_fnfft_featureswe save the data using numpy' save(functionwhich always appends npy to the filename we only have to do this once for every wave file needed for training or predicting the corresponding fft reading function is read_fft()def read_fft(genre_listbase_dir=genre_dir) [ [for labelgenre in enumerate(genre_list)genre_dir os path join(base_dirgenre"fft npy"file_list glob glob(genre_dirfor fn in file_listfft_features np load(fnx append(fft_features[: ] append(labelreturn np array( )np array(yin our scrambled music directorywe expect the following music genresgenre_list ["classical""jazz""country""pop""rock""metal"training the classifier let us use the logistic regression classifierwhich has already served us well in the on sentiment analysis the added difficulty is that we are now faced with multiclass classification problemwhereas up to now we have had to discriminate only between two classes one aspect that which is surprising the first time one switches from binary to multiclass classification is the evaluation of accuracy rates in binary classification problemswe have learned that an accuracy of percent is the worst case as it could have been achieved by mere random guessing in multiclass settings percent can already be very good with our six genresfor instancerandom guessing would result in only percent (equal class sizes assumed