{"cells":[{"metadata":{},"cell_type":"markdown","source":"# Analysis of each column in the training data\n","execution_count":null},{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"from plotly.subplots import make_subplots \nimport plotly.graph_objects as go\nimport matplotlib.pyplot as plt\nimport IPython.display as ipd\nimport plotly.express as px\nimport librosa.display\nimport pandas as pd\nimport numpy as  np\nimport librosa\nimport warnings\nimport IPython\nimport os\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"os.listdir('../input/birdsong-recognition')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"warnings.filterwarnings(action='ignore')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train = pd.read_csv('../input/birdsong-recognition/train.csv',)\ntrain.head()\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.shape","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.isnull().sum()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"col=train.columns\ncol","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# no.of examples for each type of bird","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"print(train['ebird_code'].value_counts().max())\nprint(train['ebird_code'].value_counts().min())","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"plt.figure(figsize=(10, 6))\ntrain['ebird_code'].value_counts().plot(kind='hist',bins=100)\nplt.grid()\nplt.xlabel('no.of.examples')\nplt.ylabel('no.of.species')\nplt.show()\n\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.ebird_code.value_counts()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* it clearly shows that maximum of bird classes have above 80 examples each","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# range of ratings","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"ratings=train.rating.unique().tolist()\nratings.sort()\nratings","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"plt.figure(figsize=(10, 6))\nplt.hist(train.rating,rwidth=0.9)\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* more than half of the training examples have more than four rating","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# playbak used","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train['playback_used'].fillna('Not Defined',inplace=True)\ntrain.playback_used.value_counts()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* the act of reproducing a sound or video recording, especially in order to check a recording that is newly made.","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# channels","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.channels.value_counts()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* mono audio channel: Mono signals are recorded and played back using a single audio channel.\n* stereo audio signal: tereo sounds are recorded and played back using two audio channels.","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# date","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.date","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"plt.figure(figsize=(20, 8))\ntrain.date.value_counts().sort_index().plot()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"\n\ntrain['date'].sort_values()[15:30].values\n\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"\n\n# Convert string to datetime64\ntrain['date'] = train['date'].apply(pd.to_datetime,format='%Y-%m-%d', errors='coerce')\n#train.set_index('date',inplace=True)\ntrain['date'].value_counts().plot(figsize=(12,8))\n\n","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* we can clearly identify that there are errors in the dates given ,so they need to be corrected  ","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# pitch","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.pitch.value_counts()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* the quality of a sound governed by the rate of vibrations producing it; the degree of highness or lowness of a tone.","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# duration","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.duration.mode()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.duration.median()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"plt.figure(figsize=(20, 8))\ntrain.duration.value_counts().sort_index().plot()\nplt.xlabel('duration')\nplt.ylabel('no.of.examples')\nplt.grid()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# file name","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.filename.nunique()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.filename.head()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* file name is same as id so no analysis is needed","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# speed","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.speed.value_counts()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# bird species","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.species.nunique()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.species.value_counts()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* species is the name of the bird ","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# number of notes","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.number_of_notes.value_counts()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.number_of_notes.value_counts().plot()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* a single note is a single chirp made by the bird , it is directly related to the duration of the video","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# title","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.title","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* bird id+ bird name+ scientific name","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# Secondary_labels","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.secondary_labels[0]","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* other birds which are present in the audio file","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# bird_seen","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.bird_seen.isnull().sum()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train['bird_seen'].fillna('Not Defined',inplace=True)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.bird_seen.value_counts()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* weather the bird was seen while the recording","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# Scientific_name (sci_name)","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.sci_name.nunique()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.sci_name.value_counts()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* birds have scientific name apart from the name used to refer generally","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# location","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.location.nunique()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.location.value_counts().sort_values()[6334:6349].plot(kind='barh')\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# latitiude","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.latitude.nunique()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.latitude.sample(10)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* latitude of the place where audio is recorded","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# sampling rate","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.sampling_rate.value_counts()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* Sampling rate or sampling frequency defines the number of samples per second (or per other unit) taken from a continuous signal to make a discrete or digital signal.","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# type","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.type.nunique()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.type.value_counts()[0:30]","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* type is what are the components involving in the recording like, type of the bird, type of the disturbance in the background","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# elevation","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.elevation","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df=pd.DataFrame()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df[['height','measurement','none']]= train.elevation.str.split(\" \",expand=True,)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df.height.sample(20)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# description","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.description.head(20)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# bitrate_of_mp3","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"* Bitrate refers to the number of bits—or the amount of data—that are processed over a certain amount of time. In audio, this usually means kilobits per second.","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.bitrate_of_mp3.value_counts().index","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# file type","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.file_type.value_counts()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* mp3 - MP3 (MPEG-1 Audio Layer-3) is a standard technology and format for compressing a sound sequence into a very small file while preserving the original level of sound quality when it is played.\n* wav - Waveform Audio File Format is an audio file format standard, developed by IBM and Microsoft, for storing an audio bitstream on PCs.\n* aac - Advanced Audio Coding (AAC) is an audio coding standard for lossy digital audio compression. Designed to be the successor of the MP3 format, AAC generally achieves higher sound quality than MP3 at the same bit rate. \n* mp2 - MP2 is an audio file format used with MPEG Audio Stream. MP2 files are compressed with MPEG Audio Layer-2 compression to reduce the size. ... MP2 format is still used for audio and video files, the . MP3 format has become more common.","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# volume","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.volume.value_counts()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* this column specifies if thee volume of the audio file is amplified","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# background","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.background.isnull().sum()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.background.nunique()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.background.value_counts()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* the noices in the background other than the bird that the file is about","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# xc_id","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.xc_id.nunique()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.xc_id.head(20)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* id of the bird in the official site","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# url","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.url.nunique()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.url.head()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# country","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.country.value_counts()[0:10].plot(kind='barh')\nplt.xlabel('no.of.examples')\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* the country the bird is generally seen","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# author","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.author.nunique()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"plt.figure(figsize=(12, 8))\ntrain.author.value_counts()[0:20].plot(kind='barh')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# primary label","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.primary_label.nunique()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.primary_label","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* combination of general name and scientific name","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# longitude","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.longitude.nunique()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.longitude.sample(10)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* longitude of the place where the audio file is recorded","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# length","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.length","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* the length of chirp made by a bird","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.length.value_counts()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# time","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.time.nunique()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.duration.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.time.head()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* length of each recording","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# recordist","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.recordist.nunique()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.recordist.value_counts()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* the person who recored the audio","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"plt.figure(figsize=(12, 8))\ntrain.recordist.value_counts()[0:20].plot(kind='barh')\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# license","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"train.license.nunique()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train.license.value_counts()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"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":4,"nbformat_minor":4}