-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Krishna Chaitanya S. Balaga
authored and
Krishna Chaitanya S. Balaga
committed
Jun 24, 2017
1 parent
76f9a53
commit af49e0d
Showing
6 changed files
with
1,149 additions
and
46 deletions.
There are no files selected for viewing
291 changes: 291 additions & 0 deletions
291
.ipynb_checkpoints/classification simple-checkpoint.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
142 changes: 142 additions & 0 deletions
142
.ipynb_checkpoints/classification-12Liner-checkpoint.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": true, | ||
"deletable": true, | ||
"editable": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"!pip install scikit-learn==0.18" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": { | ||
"collapsed": true, | ||
"deletable": true, | ||
"editable": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import pandas\n", | ||
"from sklearn.neighbors import KNeighborsClassifier" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": { | ||
"collapsed": true, | ||
"deletable": true, | ||
"editable": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"url = \"https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data\"\n", | ||
"names = ['sepal-length', 'sepal-width', 'petal-length', 'petal-width', 'class']\n", | ||
"dataset = pandas.read_csv(url, names=names)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": { | ||
"collapsed": true, | ||
"deletable": true, | ||
"editable": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"array = dataset.values\n", | ||
"X = array[:,0:4]\n", | ||
"Y = array[:,4]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": { | ||
"collapsed": false, | ||
"deletable": true, | ||
"editable": true | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"KNeighborsClassifier(algorithm='auto', leaf_size=30, metric='minkowski',\n", | ||
" metric_params=None, n_jobs=1, n_neighbors=5, p=2,\n", | ||
" weights='uniform')" | ||
] | ||
}, | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"knn = KNeighborsClassifier()\n", | ||
"knn.fit(X, Y)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"metadata": { | ||
"collapsed": false, | ||
"deletable": true, | ||
"editable": true | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"['Iris-versicolor']\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"predictions = knn.predict([[6.4,3.2,4.5,1.5]])\n", | ||
"print(predictions)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": true, | ||
"deletable": true, | ||
"editable": true | ||
}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"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.6.1" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
Oops, something went wrong.