开始尝试用weka工具来做一些小示例,但是发现输出结果里有很多不了解的地方,比如这样的输出代表什么意思,完全看不明白。
1、mean absolute errorMAE={|p1-a1|+....+|pn-an|}/n. But what is the difference of predicted values pi and actual value ai in classification? 分类问题时,对于每一个instance,如何计算其error呢?发现一篇不错的文章,http://weka.8497.n7.nabble.com/Mean-absolute-error-in-classification-td9440.html。但是还是担心如果链接失效了,以我的记性那是肯定记不住了。把他的意思简单说一下。
it's not too hard to replicate this using the GUI: go to "More options..." in the Classfy tab and then configure the "Output predictions" to generate a CSV table like below.
大佬生成的像下面这样:
inst#,actual,predicted,error,distribution,,
1,3:Iris-virginica,3:Iris-virginica,,0,0.02439024390243902464,0.975609756097561
for the instance 1, the distribution given by Weka is: 0 0.02439024390243902464 0.975609756097561 (note that it adds up to 1; the order is the same as the order of the labels: first = Setosa, second = Versicolor & third = Virginica)
I personally think that "distribution" it's a very vague name. I would rather call them something like prediction scores maybe, 【我感觉他的理解很透彻,有时候分布函数给人很高大上的感觉,但是你如果说这是一个对预测的信心值,打分值,那比较好理解多了】as distribution can be many things in this context (for example, the actual distribution of classes in the dataset). Anyway, in the case of this instance, the error is very simple to calculate.
First, the Expected distribution for the instance would be: 0 0 1. Since it's an instance of Iris virginica. Then the error is:
abs(0 - 0)/3 + abs(0.02439024390243902464 - 0)/3 + abs(0.975609756097561 - 1)/3 = 0.01626016
Repeating this for all the instances and summing up, I get 5.246992, which divided by 150 is 0.0349799, and that's the same answer I get with Weka.
2、correlation coefficient
When two sets of data are strongly linked together we say they have a High Correlation。
相关性是说两者有联系,比如气温和冰淇淋销售额成在额定温度内存在正比关系,但是超过一定温度后,销售额又下降,呈曲线,相关性表述的是线性而无法描述曲线。同时两者的联系也不一定是因果关系,比如墨镜的销售额和冰淇淋的销售额存在正比关系,但仅仅是数值上的关系。
3、choose the model with bigger correlation and smaller error estimates
下午看了一阵子coursera上Introduction to Data Science in Python的课程,主要介绍pandas的用法,看完记住的甚少,关于missing value的填补他也介绍了方法fillna,如forward fill 和backward fill,不太明白为什么要排序,以后要是用到这些功能的时候再来回看课程我觉得效率会高些。
函数名后直接加?可以显示帮助。
shift + command +4截屏