{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-10-18T10:24:15.411458Z","iopub.execute_input":"2023-10-18T10:24:15.412001Z","iopub.status.idle":"2023-10-18T10:24:23.736328Z","shell.execute_reply.started":"2023-10-18T10:24:15.411939Z","shell.execute_reply":"2023-10-18T10:24:23.735097Z"},"jupyter":{"source_hidden":true,"outputs_hidden":true},"collapsed":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Basic Operations\nimport pandas as pd,numpy as np,matplotlib.pyplot as plt,seaborn as sns\nimport glob,os\nimport plotly.express as px\n# Audio Files\nimport librosa\nimport io\nimport IPython.display as ipd\n# Modelling\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.preprocessing import LabelEncoder\nimport tensorflow as tf\nfrom tensorflow import keras\nfrom keras.layers import Dense, Dropout, Flatten, Conv2D, Input, MaxPooling2D,BatchNormalization,GRU,Flatten\nfrom keras.models import Model\n","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:23.738582Z","iopub.execute_input":"2023-10-18T10:24:23.739299Z","iopub.status.idle":"2023-10-18T10:24:23.747803Z","shell.execute_reply.started":"2023-10-18T10:24:23.739257Z","shell.execute_reply":"2023-10-18T10:24:23.746193Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Explatory Data Analysis","metadata":{}},{"cell_type":"code","source":"metadata = pd.read_csv('/kaggle/input/birdclef-2023/train_metadata.csv')\ntaxonomy=pd.read_csv(\"/kaggle/input/birdclef-2023/eBird_Taxonomy_v2021.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:23.749193Z","iopub.execute_input":"2023-10-18T10:24:23.749923Z","iopub.status.idle":"2023-10-18T10:24:23.921134Z","shell.execute_reply.started":"2023-10-18T10:24:23.749892Z","shell.execute_reply":"2023-10-18T10:24:23.919966Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"metadata.head()","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:23.924051Z","iopub.execute_input":"2023-10-18T10:24:23.925069Z","iopub.status.idle":"2023-10-18T10:24:23.942825Z","shell.execute_reply.started":"2023-10-18T10:24:23.925025Z","shell.execute_reply":"2023-10-18T10:24:23.941854Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(metadata)","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:23.944424Z","iopub.execute_input":"2023-10-18T10:24:23.944855Z","iopub.status.idle":"2023-10-18T10:24:23.951161Z","shell.execute_reply.started":"2023-10-18T10:24:23.944825Z","shell.execute_reply":"2023-10-18T10:24:23.950349Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"taxonomy.head()","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:23.952428Z","iopub.execute_input":"2023-10-18T10:24:23.953454Z","iopub.status.idle":"2023-10-18T10:24:23.974594Z","shell.execute_reply.started":"2023-10-18T10:24:23.953424Z","shell.execute_reply":"2023-10-18T10:24:23.973198Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"metadata.primary_label.nunique()   #primary_labels belong to audios","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:23.976182Z","iopub.execute_input":"2023-10-18T10:24:23.976605Z","iopub.status.idle":"2023-10-18T10:24:23.991903Z","shell.execute_reply.started":"2023-10-18T10:24:23.976567Z","shell.execute_reply":"2023-10-18T10:24:23.990624Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Geographic plot with perfect library plotly.express \nfig = px.scatter_geo(metadata ,lat='latitude',lon='longitude', hover_name=\"common_name\")\nfig.update_layout(title = 'World map', title_x=0.5)\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:23.993593Z","iopub.execute_input":"2023-10-18T10:24:23.994939Z","iopub.status.idle":"2023-10-18T10:24:24.096324Z","shell.execute_reply.started":"2023-10-18T10:24:23.994895Z","shell.execute_reply":"2023-10-18T10:24:24.095090Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"birds=metadata.primary_label.unique()\nbirds\n","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:24.097539Z","iopub.execute_input":"2023-10-18T10:24:24.097850Z","iopub.status.idle":"2023-10-18T10:24:24.106693Z","shell.execute_reply.started":"2023-10-18T10:24:24.097826Z","shell.execute_reply":"2023-10-18T10:24:24.105330Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(f\"There is {len(metadata)} audio files and {len(birds)} bird types in our data\")","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:24.110910Z","iopub.execute_input":"2023-10-18T10:24:24.111376Z","iopub.status.idle":"2023-10-18T10:24:24.123228Z","shell.execute_reply.started":"2023-10-18T10:24:24.111329Z","shell.execute_reply":"2023-10-18T10:24:24.121800Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Plot the durations of records of abethr1\npath=\"/kaggle/input/birdclef-2023/train_audio\"\ndurations=[]\nx=glob.glob(os.path.join(path,\"abethr1\",\"*\"))\nfor path in x:\n    samples, sample_rate=librosa.load(path, sr = 16000)\n    durations.append(len(samples)/sample_rate)\n    \nplt.plot(np.array(durations),\"go--\", linewidth=2, markersize=12,alpha=.5)\nplt.xlabel(\"sample\")\nplt.ylabel(\"durations[in sec]\")\nplt.grid()","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:24.125213Z","iopub.execute_input":"2023-10-18T10:24:24.125656Z","iopub.status.idle":"2023-10-18T10:24:25.083574Z","shell.execute_reply.started":"2023-10-18T10:24:24.125616Z","shell.execute_reply":"2023-10-18T10:24:25.081952Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Plot the durations of records of abhori1\npath=\"/kaggle/input/birdclef-2023/train_audio\"\ndurations=[]\nx=glob.glob(os.path.join(path,\"abhori1\",\"*\"))\nfor path in x:\n    samples, sample_rate=librosa.load(path, sr = 16000)\n    durations.append(len(samples)/sample_rate)\n    \nplt.plot(np.array(durations),\"go--\", linewidth=2, markersize=12,alpha=.5)\nplt.xlabel(\"sample\")\nplt.ylabel(\"durations[in sec]\")\nplt.grid()","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:25.085384Z","iopub.execute_input":"2023-10-18T10:24:25.085993Z","iopub.status.idle":"2023-10-18T10:24:33.711117Z","shell.execute_reply.started":"2023-10-18T10:24:25.085959Z","shell.execute_reply":"2023-10-18T10:24:33.709288Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Functions For Data Loading,","metadata":{}},{"cell_type":"code","source":"def load_data(path,birds):\n    \"\"\"returns paths data with their labels\"\"\"\n    labels=[]\n    paths=[]\n    for label in birds:\n        x=glob.glob(os.path.join(path,label,\"*\"))\n        for pat in x:\n            paths.append(pat)\n            labels.append(label)\n    return labels,paths","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:33.713182Z","iopub.execute_input":"2023-10-18T10:24:33.713629Z","iopub.status.idle":"2023-10-18T10:24:33.722337Z","shell.execute_reply.started":"2023-10-18T10:24:33.713599Z","shell.execute_reply":"2023-10-18T10:24:33.720872Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# We use this function not only obtaining audio files but also resampled form for further process\ndef path_to_samples(labels,data_path,sample_rate=16000,duration=10):\n    \"\"\"Receives path ways and returns as audio samples in a specified length and frequency\n       duration: time length in seconds\n    \"\"\"\n    data_audio=[]\n    lab=[]\n    \n    for i,path in enumerate(data_path):\n        audio_length=np.zeros(sample_rate*duration)\n        samples, sample_rate=librosa.load(path, sr = sample_rate) #reads the audio file in the sample rate\n        if len(samples)<len(audio_length):  \n            audio_length+=np.concatenate((samples,samples,audio_length))[:len(audio_length)] #equalize the lengths by taking triple \n        \n        if len(samples)>= sample_rate*duration:\n            audio_length=samples[:sample_rate*duration] # leaves out the samples left whose duration records are more than sample_rate*duration\n            \n        if len(audio_length)==(sample_rate*duration): # for being sure\n            data_audio.append(audio_length)\n            lab.append(labels[i])\n        if i > 10:    # restriction for the data size to compute\n            continue\n    return lab,data_audio","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:33.723684Z","iopub.execute_input":"2023-10-18T10:24:33.724937Z","iopub.status.idle":"2023-10-18T10:24:33.749372Z","shell.execute_reply.started":"2023-10-18T10:24:33.724875Z","shell.execute_reply":"2023-10-18T10:24:33.747875Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Have all paths to audio files\npath=\"/kaggle/input/birdclef-2023/train_audio\"\nmetadata[\"filename\"]=path+\"/\"+metadata[\"filename\"]","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:33.751067Z","iopub.execute_input":"2023-10-18T10:24:33.751412Z","iopub.status.idle":"2023-10-18T10:24:33.769349Z","shell.execute_reply.started":"2023-10-18T10:24:33.751385Z","shell.execute_reply":"2023-10-18T10:24:33.768217Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# We take 8 birds for memory not being enough\nlabels,paths=load_data(\"/kaggle/input/birdclef-2023/train_audio\",birds[:8])","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:33.771106Z","iopub.execute_input":"2023-10-18T10:24:33.771757Z","iopub.status.idle":"2023-10-18T10:24:33.787159Z","shell.execute_reply.started":"2023-10-18T10:24:33.771682Z","shell.execute_reply":"2023-10-18T10:24:33.785775Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"labels,data_audio=path_to_samples(labels,data_path=paths,sample_rate=16000,duration=5) # 5 seconds records","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:33.788976Z","iopub.execute_input":"2023-10-18T10:24:33.789398Z","iopub.status.idle":"2023-10-18T10:24:53.078438Z","shell.execute_reply.started":"2023-10-18T10:24:33.789367Z","shell.execute_reply":"2023-10-18T10:24:53.077054Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(f\"Our train data lengths are {len(labels)} for labels and {len(data_audio)} for audio files\")","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:53.079795Z","iopub.execute_input":"2023-10-18T10:24:53.080108Z","iopub.status.idle":"2023-10-18T10:24:53.087248Z","shell.execute_reply.started":"2023-10-18T10:24:53.080081Z","shell.execute_reply":"2023-10-18T10:24:53.086086Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Let's see an example from the data we got\nth=np.random.randint(0,len(labels))\nsamples, sample_rate=data_audio[th], 16000\nplt.figure(figsize=(14, 8))\nlibrosa.display.waveshow(y=samples, sr=sample_rate)\nplt.xlabel(\"Time [in Sec]\")\nplt.title(f'For Bird Type {labels[th]} Call Waveform[16 kHz]');","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:53.088427Z","iopub.execute_input":"2023-10-18T10:24:53.088761Z","iopub.status.idle":"2023-10-18T10:24:53.873228Z","shell.execute_reply.started":"2023-10-18T10:24:53.088726Z","shell.execute_reply":"2023-10-18T10:24:53.872165Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Now we can go through the spectograms\nA spectrogram is usually depicted as a heat map, i.e., as an image with the intensity shown by varying the color or brightness.It is a visual way of representing the signal strength.","metadata":{}},{"cell_type":"code","source":"th=np.random.randint(0,len(data_audio))\nS=librosa.feature.melspectrogram(y=data_audio[th], sr=16000)\nlibrosa.display.specshow(librosa.power_to_db(S, ref=np.max), x_axis='time',\n                         y_axis='mel', sr=16000,\n                         fmax=8000)\nplt.colorbar(format='%+2.0f dB')\nplt.title('Mel-frequency spectrogram')\nplt.show()\n\nlibrosa.display.waveshow(y=data_audio[th], sr=16000)\nplt.title(\"Waveform[16 kHz]\")\nplt.show()\n;","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:53.874960Z","iopub.execute_input":"2023-10-18T10:24:53.876180Z","iopub.status.idle":"2023-10-18T10:24:54.819122Z","shell.execute_reply.started":"2023-10-18T10:24:53.876136Z","shell.execute_reply":"2023-10-18T10:24:54.817441Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Preprocessing the Datas","metadata":{}},{"cell_type":"code","source":"def get_spectrograms_stereo(audio_data,sr=16000):\n    data_spec=[]\n    for audio_wave in audio_data: \n        mel_spectrogram = librosa.feature.melspectrogram(y=audio_wave, sr=sr)\n        data_spec.append(mel_spectrogram)\n    return data_spec","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:54.821432Z","iopub.execute_input":"2023-10-18T10:24:54.822217Z","iopub.status.idle":"2023-10-18T10:24:54.829974Z","shell.execute_reply.started":"2023-10-18T10:24:54.822177Z","shell.execute_reply":"2023-10-18T10:24:54.828600Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data_audio=get_spectrograms_stereo(data_audio,sr=16000)","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:24:54.831537Z","iopub.execute_input":"2023-10-18T10:24:54.831921Z","iopub.status.idle":"2023-10-18T10:25:02.587855Z","shell.execute_reply.started":"2023-10-18T10:24:54.831894Z","shell.execute_reply":"2023-10-18T10:25:02.586299Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X,y=data_audio,labels\nX=np.array(X)\ny=np.array(y)","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:25:02.590266Z","iopub.execute_input":"2023-10-18T10:25:02.591276Z","iopub.status.idle":"2023-10-18T10:25:02.645742Z","shell.execute_reply.started":"2023-10-18T10:25:02.591219Z","shell.execute_reply":"2023-10-18T10:25:02.644261Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X=X.reshape((*X.shape,1))\nle=LabelEncoder()\ny=le.fit_transform(y)","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:25:02.648287Z","iopub.execute_input":"2023-10-18T10:25:02.649400Z","iopub.status.idle":"2023-10-18T10:25:02.657621Z","shell.execute_reply.started":"2023-10-18T10:25:02.649345Z","shell.execute_reply":"2023-10-18T10:25:02.656200Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(le.classes_)","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:25:02.660056Z","iopub.execute_input":"2023-10-18T10:25:02.661124Z","iopub.status.idle":"2023-10-18T10:25:02.673974Z","shell.execute_reply.started":"2023-10-18T10:25:02.661068Z","shell.execute_reply":"2023-10-18T10:25:02.672403Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Splitting to train and test datas\nX_train,X_test,y_train,y_test=train_test_split(X,y,random_state=1989,test_size=.2)","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:25:02.675917Z","iopub.execute_input":"2023-10-18T10:25:02.676604Z","iopub.status.idle":"2023-10-18T10:25:02.727675Z","shell.execute_reply.started":"2023-10-18T10:25:02.676544Z","shell.execute_reply":"2023-10-18T10:25:02.726922Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(X_train.shape,y_train.shape)\nprint(X_test.shape,y_test.shape)","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:25:02.728921Z","iopub.execute_input":"2023-10-18T10:25:02.729485Z","iopub.status.idle":"2023-10-18T10:25:02.735784Z","shell.execute_reply.started":"2023-10-18T10:25:02.729457Z","shell.execute_reply":"2023-10-18T10:25:02.734572Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Modelling","metadata":{}},{"cell_type":"code","source":"X_train.shape[1:]","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:25:02.741381Z","iopub.execute_input":"2023-10-18T10:25:02.742346Z","iopub.status.idle":"2023-10-18T10:25:02.751547Z","shell.execute_reply.started":"2023-10-18T10:25:02.742314Z","shell.execute_reply":"2023-10-18T10:25:02.750793Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"input_shape=(X_train.shape[1:])\ninputs=Input(shape=input_shape)\nx=BatchNormalization()(inputs)\nx=Conv2D(filters=30,kernel_size=16, activation='relu')(x)\nx=MaxPooling2D(3)(x)\nx=Conv2D(filters=60,kernel_size=16, activation='relu')(x)\nx=MaxPooling2D(3)(x)\n#x=GRU(30)(x)\nx=Dense(len(birds[:8])/2, activation='relu')(x)\nx=Flatten()(x)\noutputs=Dense(len(birds[:8]), activation='softmax')(x)\nmodel=Model(inputs=inputs,outputs=outputs)\nmodel.summary()","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:25:02.752627Z","iopub.execute_input":"2023-10-18T10:25:02.752934Z","iopub.status.idle":"2023-10-18T10:25:02.889821Z","shell.execute_reply.started":"2023-10-18T10:25:02.752911Z","shell.execute_reply":"2023-10-18T10:25:02.888121Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.compile(loss='sparse_categorical_crossentropy',optimizer='adam',metrics=['accuracy'])","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:25:02.892118Z","iopub.execute_input":"2023-10-18T10:25:02.893038Z","iopub.status.idle":"2023-10-18T10:25:02.908348Z","shell.execute_reply.started":"2023-10-18T10:25:02.892992Z","shell.execute_reply":"2023-10-18T10:25:02.906962Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"history=model.fit(X_train,y_train,epochs=25, batch_size=15, validation_data=(X_test,y_test),verbose=1)","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:25:02.909517Z","iopub.execute_input":"2023-10-18T10:25:02.909892Z","iopub.status.idle":"2023-10-18T10:34:26.010781Z","shell.execute_reply.started":"2023-10-18T10:25:02.909840Z","shell.execute_reply":"2023-10-18T10:34:26.009290Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Model Performance On The Plot","metadata":{}},{"cell_type":"code","source":"plt.plot(history.history[\"loss\"],label='train')\nplt.plot(history.history[\"val_loss\"],label='validation')\nplt.title(\"Loss Performance\")\nplt.xlabel(\"Epoch\")\nplt.legend()\nplt.show()\n\nplt.plot(history.history[\"accuracy\"],label='train')\nplt.plot(history.history[\"val_accuracy\"],label='validation')\nplt.title(\"Accuracy Performance\")\nplt.xlabel(\"Epoch\")\nplt.legend()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:34:26.012076Z","iopub.execute_input":"2023-10-18T10:34:26.012380Z","iopub.status.idle":"2023-10-18T10:34:26.593122Z","shell.execute_reply.started":"2023-10-18T10:34:26.012356Z","shell.execute_reply":"2023-10-18T10:34:26.591868Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Define a Function For Prediction","metadata":{}},{"cell_type":"code","source":"def predict(specfile):\n    prob=model.predict(specfile.reshape(X_train[:1].shape))\n    pred_indice=np.argmax(prob,axis=-1)\n    return le.classes_[pred_indice]","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:34:26.594425Z","iopub.execute_input":"2023-10-18T10:34:26.594774Z","iopub.status.idle":"2023-10-18T10:34:26.601212Z","shell.execute_reply.started":"2023-10-18T10:34:26.594741Z","shell.execute_reply":"2023-10-18T10:34:26.599521Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"th=np.random.randint(0,len(X_test)-1)\npred=predict(X_test[th])\nprint(\"Audio prediction:\",pred[0])\nprint(\"Audio actual:\",le.classes_[y_test[th]])","metadata":{"execution":{"iopub.status.busy":"2023-10-18T10:34:26.602672Z","iopub.execute_input":"2023-10-18T10:34:26.603112Z","iopub.status.idle":"2023-10-18T10:34:26.813216Z","shell.execute_reply.started":"2023-10-18T10:34:26.603067Z","shell.execute_reply":"2023-10-18T10:34:26.811828Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}