Veri Kümesi İncelemesi:

Veri kümesi, 400 örnekten ve her bir örnek için 50 özellikten oluşuyor. Örnekler, dört sınıfa (mutlu, üzgün, kızgın, rahat) ait. Her sınıfta eşit sayıda (100) örnek bulunuyor. Özellikler, akustik ve müzikal özellikler içeriyor. Bu özellikler arasında RMS enerji, düşük enerji, titreşim, tempo, MFCC (Mel-Frekans Kepstral Katsayıları), pürüzlülük, sıfır geçiş oranı, saldırı süresi, roll-off ve kromoğraf gibi çeşitli parametreler yer alıyor.

Uygun Tahmin Yöntemlerinin Değerlendirilmesi:

  1. Veri Ön İşleme ve Özellik Seçimi:
  2. Sınıflandırma Yöntemleri:
  3. Model Değerlendirme:

Model Eğitim ve Değerlendirme Adımları:

  1. Veri Kümesini Eğitim ve Test Setlerine Ayırma:
  2. Model Eğitim:
  3. Model Değerlendirme:

Şimdi bu adımları uygulayalım ve en iyi sonuçları elde edelim. İlk adım olarak, veri kümesini eğitim ve test setlerine böleceğiz ve ardından farklı sınıflandırma yöntemlerini uygulayacağız.

import pandas as pd

# Load the dataset to understand its structure and contents
file_path = '/mnt/data/Acoustic Features.csv'
data = pd.read_csv(file_path)

# Display the first few rows of the dataset and its summary
data_info = data.info()
data_head = data.head()

data_info, data_head

STDOUT/STDERR
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 400 entries, 0 to 399
Data columns (total 51 columns):
 #   Column                                          Non-Null Count  Dtype  
---  ------                                          --------------  -----  
 0   Class                                           400 non-null    object 
 1   _RMSenergy_Mean                                 400 non-null    float64
 2   _Lowenergy_Mean                                 400 non-null    float64
 3   _Fluctuation_Mean                               400 non-null    float64
 4   _Tempo_Mean                                     400 non-null    float64
 5   _MFCC_Mean_1                                    400 non-null    float64
 6   _MFCC_Mean_2                                    400 non-null    float64
 7   _MFCC_Mean_3                                    400 non-null    float64
 8   _MFCC_Mean_4                                    400 non-null    float64
 9   _MFCC_Mean_5                                    400 non-null    float64
 10  _MFCC_Mean_6                                    400 non-null    float64
 11  _MFCC_Mean_7                                    400 non-null    float64
 12  _MFCC_Mean_8                                    400 non-null    float64
 13  _MFCC_Mean_9                                    400 non-null    float64
 14  _MFCC_Mean_10                                   400 non-null    float64
 15  _MFCC_Mean_11                                   400 non-null    float64
 16  _MFCC_Mean_12                                   400 non-null    float64
 17  _MFCC_Mean_13                                   400 non-null    float64
 18  _Roughness_Mean                                 400 non-null    float64
 19  _Roughness_Slope                                400 non-null    float64
 20  _Zero-crossingrate_Mean                         400 non-null    float64
 21  _AttackTime_Mean                                400 non-null    float64
 22  _AttackTime_Slope                               400 non-null    float64
 23  _Rolloff_Mean                                   400 non-null    float64
 24  _Eventdensity_Mean                              400 non-null    float64
 25  _Pulseclarity_Mean                              400 non-null    float64
 26  _Brightness_Mean                                400 non-null    float64
 27  _Spectralcentroid_Mean                          400 non-null    float64
 28  _Spectralspread_Mean                            400 non-null    float64
 29  _Spectralskewness_Mean                          400 non-null    float64
 30  _Spectralkurtosis_Mean                          400 non-null    float64
 31  _Spectralflatness_Mean                          400 non-null    float64
 32  _EntropyofSpectrum_Mean                         400 non-null    float64
 33  _Chromagram_Mean_1                              400 non-null    float64
 34  _Chromagram_Mean_2                              400 non-null    float64
 35  _Chromagram_Mean_3                              400 non-null    float64
 36  _Chromagram_Mean_4                              400 non-null    float64
 37  _Chromagram_Mean_5                              400 non-null    float64
 38  _Chromagram_Mean_6                              400 non-null    float64
 39  _Chromagram_Mean_7                              400 non-null    float64
 40  _Chromagram_Mean_8                              400 non-null    float64
 41  _Chromagram_Mean_9                              400 non-null    float64
 42  _Chromagram_Mean_10                             400 non-null    float64
 43  _Chromagram_Mean_11                             400 non-null    float64
 44  _Chromagram_Mean_12                             400 non-null    float64
 45  _HarmonicChangeDetectionFunction_Mean           400 non-null    float64
 46  _HarmonicChangeDetectionFunction_Std            400 non-null    float64
 47  _HarmonicChangeDetectionFunction_Slope          400 non-null    float64
 48  _HarmonicChangeDetectionFunction_PeriodFreq     400 non-null    float64
 49  _HarmonicChangeDetectionFunction_PeriodAmp      400 non-null    float64
 50  _HarmonicChangeDetectionFunction_PeriodEntropy  400 non-null    float64
dtypes: float64(50), object(1)
memory usage: 159.5+ KB
Sonuç
(None,
    Class  _RMSenergy_Mean  _Lowenergy_Mean  _Fluctuation_Mean  _Tempo_Mean  \\
 0  relax            0.052            0.591              9.136      130.043   
 1  relax            0.125            0.439              6.680      142.240   
 2  relax            0.046            0.639             10.578      188.154   
 3  relax            0.135            0.603             10.442       65.991   
 4  relax            0.066            0.591              9.769       88.890   
 
    _MFCC_Mean_1  _MFCC_Mean_2  _MFCC_Mean_3  _MFCC_Mean_4  _MFCC_Mean_5  ...  \\
 0         3.997         0.363         0.887         0.078         0.221  ...   
 1         4.058         0.516         0.785         0.397         0.556  ...   
 2         2.775         0.903         0.502         0.329         0.287  ...   
 3         2.841         1.552         0.612         0.351         0.011  ...   
 4         3.217         0.228         0.814         0.096         0.434  ...   
 
    _Chromagram_Mean_9  _Chromagram_Mean_10  _Chromagram_Mean_11  \\
 0               0.426                1.000                0.008   
 1               0.002                1.000                0.000   
 2               0.184                0.746                0.016   
 3               0.038                1.000                0.161   
 4               0.004                0.404                1.000   
 
    _Chromagram_Mean_12  _HarmonicChangeDetectionFunction_Mean  \\
 0                0.101                                  0.316   
 1                0.984                                  0.285   
 2                1.000                                  0.413   
 3                0.757                                  0.422   
 4                0.001                                  0.345   
 
    _HarmonicChangeDetectionFunction_Std  \\
 0                                 0.261   
 1                                 0.211   
 2                                 0.299   
 3                                 0.265   
 4                                 0.261   
 
    _HarmonicChangeDetectionFunction_Slope  \\
 0                                   0.018   
 1                                  -0.082   
 2                                   0.134   
 3                                   0.042   
 4                                   0.089   
 
    _HarmonicChangeDetectionFunction_PeriodFreq  \\
 0                                        1.035   
 1                                        3.364   
 2                                        1.682   
 3                                        0.354   
 4                                        0.748   
 
    _HarmonicChangeDetectionFunction_PeriodAmp  \\
 0                                       0.593   
 1                                       0.702   
 2                                       0.692   
 3                                       0.743   
 4                                       0.674   
 
    _HarmonicChangeDetectionFunction_PeriodEntropy  
 0                                           0.970  
 1                                           0.967  
 2                                           0.963  
 3                                           0.968  
 4                                           0.957  
 
 [5 rows x 51 columns])

Model Performans Değerlendirmesi:

Eğitilen modellerin test setindeki doğruluk oranları aşağıdaki gibidir:

  1. Support Vector Machine (SVM): %81.25
  2. Random Forest: %80.00
  3. Neural Network: %77.50
  4. Naive Bayes: %76.25
  5. Logistic Regression: %75.00
  6. K-Nearest Neighbors (KNN): %62.50