Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishak798 authored May 20, 2023
1 parent 2304bc3 commit 9edc167
Show file tree
Hide file tree
Showing 3 changed files with 16,687 additions and 0 deletions.
69 changes: 69 additions & 0 deletions helloworld.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 13,
"id": "52c7eaaf",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.0"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"from sklearn.tree import DecisionTreeClassifier\n",
"from sklearn.model_selection import train_test_split\n",
"from sklearn.metrics import accuracy_score\n",
"\n",
"music_data = pd.read_csv('music.csv')\n",
"X= music_data.drop(columns=['genre'])\n",
"y= music_data['genre']\n",
"X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.2)\n",
"\n",
"model= DecisionTreeClassifier()\n",
"model.fit(X_train,y_train)\n",
"predictions= model.predict(X_test)\n",
"\n",
"score= accuracy_score(y_test,predictions)\n",
"score\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "51dfaedf",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
19 changes: 19 additions & 0 deletions music.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
age,gender,genre
20,1,HipHop
23,1,HipHop
25,1,HipHop
26,1,Jazz
29,1,Jazz
30,1,Jazz
31,1,Classical
33,1,Classical
37,1,Classical
20,0,Dance
21,0,Dance
25,0,Dance
26,0,Acoustic
27,0,Acoustic
30,0,Acoustic
31,0,Classical
34,0,Classical
35,0,Classical
Loading

0 comments on commit 9edc167

Please sign in to comment.