Anne

Anne.github.io


  • Home

  • About

  • Tags

  • Categories

  • Archives

knn

Posted on 2017-09-24 | In Machine Learning

寻找与这个待分类的样本在特征空间中距离最近的K个已标记的样本作为参考,来帮助我们做出分类决策

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 17 21:27:03 2017
@author: aa
"""
from sklearn.datasets import load_iris
iris=load_iris()
print(iris.data.shape)
#(150L, 4L)
#print iris.DESCR
from sklearn.cross_validation import train_test_split
# train_test_split 用于数据分割
X_train,X_test,y_train,y_test=train_test_split(iris.data,iris.target,test_size=0.25,random_state=33)
# 采样25%作为测试集
from sklearn.preprocessing import StandardScaler
# 导入数据标准化模块
from sklearn.neighbors import KNeighborsClassifier
ss=StandardScaler()
X_train=ss.fit_transform(X_train)
X_test=ss.fit_transform(X_test)
# 标准化 训练和测试数据
knc=KNeighborsClassifier()
knc.fit(X_train,y_train)
y_predict=knc.predict(X_test)
print 'The accuracy of K-Nearest Neighor Classifier is',knc.score(X_test,y_test)
# 模型自带的评估函数进行准确率测评
# 0.710526315789
from sklearn.metrics import classification_report
print classification_report(y_test,y_predict,target_names=iris.target_names)
# classification_report对预测结果进行更详细的分析
# precision recall f1-score support
#
# setosa 1.00 1.00 1.00 8
# versicolor 0.50 1.00 0.67 11
# virginica 1.00 0.42 0.59 19
#avg / total 0.86 0.71 0.70 38
Read more »

希望的天空

Posted on 2017-09-24 | In BOOM

这个世界从来都是有经纬度的,不会因为你的忍让而缩水,也不会因为你的强悍而膨胀,你要懂得游刃有余,最好的方式是,内心柔软而有原则,身披铠甲而有温度

在这个时代,文化成了一个看似非常喧嚣但其实非常沉默的事情

当一个人把他的精力和时间从关注外界转向关注自身的成长时,才能拥有更高的境界

工欲善其事,必先利其器

只有将时间花在磨练自己,从身体,精神,心智到待人处世四个层面,才能增进个人产能,累积其他修养的本钱

^*^

Read more »

你这样的春天

Posted on 2017-09-23 | In BOOM

美国埃默里大学教授马可说过一句话:

一个人成熟的标志之一,就是明白每天发生在我们身边99%的事情,对于我们和别人而言,都是毫无意义的

女孩的成熟

一个成熟的人,都会判断和摒弃那些和自己无关的事,过着真正简单的生活

对他人的私事不关心不介入,允许他人的道德观,生活方式和自己的不同,将消除世上90%以上的烦恼。 不要随意介入别人的生活–这就是一种成熟

简单,直接,通透,随性。返璞归真,让生命回归到最舒服、属于自己的状态,专注而极致地想做自己想做的事,过自己想过的生活。这才是简单成熟的人生。做回自己,去关心那些,真正让自己欢喜和舒服的事,取悦自己,生活才能美好起来,生命才能自由起来。

Girl,请经常问自己:和我有什么关系

Read more »

Hello World

Posted on 2017-03-12 | In za
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. Quick StartCreate a new post1$ hexo new "My New Post" More info: Writing Run server1$ hexo server More info: Server Generate static files1$ hexo generate More info: Generating Deploy to remote sites1$ hexo deploy More info: Deployment
Read more »
1…1314
Anne_ZAJ

Anne_ZAJ

boom pow

134 posts
14 categories
17 tags
0%
© 2019 Anne_ZAJ
Powered by Hexo
|
Theme — NexT.Pisces v5.1.3