Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
KNN-homework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
20200116044
KNN-homework
Commits
2bac3a77
Commit
2bac3a77
authored
Mar 11, 2020
by
20200116044
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
KNN_image_classification-ML homework.ipynb
parent
4e2bd16c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
65 deletions
+14
-65
KNN_image_classification-ML homework.ipynb
+14
-61
a.txt
+0
-4
No files found.
KNN_image_classification-ML homework.ipynb
View file @
2bac3a77
...
...
@@ -44,7 +44,7 @@
},
{
"cell_type": "code",
"execution_count":
36
,
"execution_count":
1
,
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -105,14 +105,18 @@
},
{
"cell_type": "code",
"execution_count":
38
,
"execution_count":
2
,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Clear previously loaded data.\n"
"ename": "NameError",
"evalue": "name 'load_CIFAR10' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-2-4bfb0ecadd12>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 11\u001b[0m \u001b[1;32mpass\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 12\u001b[0m \u001b[1;31m## TODO: 请根据load_CIFAR10()函数将原始CIFAR-10数据load进来.\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 13\u001b[1;33m \u001b[0mX_train\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0my_train\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mX_test\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0my_test\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mload_CIFAR10\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcifar10_dir\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[1;31mNameError\u001b[0m: name 'load_CIFAR10' is not defined"
]
}
],
...
...
@@ -650,62 +654,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"结果: K=3时 \n",
" precision recall f1-score support\n",
"\n",
" airplane 0.35 0.42 0.38 196\n",
" automobile 0.67 0.15 0.24 198\n",
" bird 0.18 0.26 0.21 195\n",
" cat 0.24 0.19 0.21 199\n",
" deer 0.21 0.47 0.29 198\n",
" dog 0.29 0.18 0.23 185\n",
" frog 0.29 0.29 0.29 216\n",
" horse 0.40 0.17 0.23 193\n",
" ship 0.36 0.61 0.45 217\n",
" truck 0.56 0.17 0.26 203\n",
"\n",
"avg / total 0.36 0.29 0.28 2000\n",
"——————————————————————————————————\n",
"K=5时\n",
" precision recall f1-score support\n",
"\n",
" airplane 0.38 0.45 0.41 196\n",
" automobile 0.66 0.10 0.17 198\n",
" bird 0.19 0.29 0.23 195\n",
" cat 0.25 0.17 0.20 199\n",
" deer 0.20 0.48 0.29 198\n",
" dog 0.30 0.17 0.21 185\n",
" frog 0.32 0.29 0.30 216\n",
" horse 0.42 0.17 0.24 193\n",
" ship 0.35 0.65 0.46 217\n",
" truck 0.66 0.17 0.27 203\n",
"\n",
"avg / total 0.37 0.30 0.28 2000\n",
"———————————————————————————————————\n",
"K=10时\n",
" precision recall f1-score support\n",
"\n",
" airplane 0.38 0.40 0.39 196\n",
" automobile 0.72 0.09 0.16 198\n",
" bird 0.18 0.29 0.22 195\n",
" cat 0.24 0.12 0.16 199\n",
" deer 0.18 0.47 0.26 198\n",
" dog 0.42 0.18 0.26 185\n",
" frog 0.31 0.31 0.31 216\n",
" horse 0.56 0.17 0.26 193\n",
" ship 0.34 0.70 0.45 217\n",
" truck 0.66 0.16 0.26 203\n",
"\n",
"avg / total 0.40 0.29 0.28 2000\n",
"总结:K取3,5,10时,精确度有略微提高,但召回率和F1值没有明显提升。"
"总结:\n",
" 1、K值分别取3,5,10时,recall(召回率)和F1值是没有明显变化的,有略微变化的体现在precision;\n",
" 2、调用classify分类函数计算时耗时感觉比较长,是否还存在优化的空间?\n",
" 3、用KD树能否实现这一过程呢?区别又在什么地方?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
...
...
a.txt
deleted
100644 → 0
View file @
4e2bd16c
hello!
hey!
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment