1、首先下载安装weka

http://www.cs.waikato.ac.nz/ml/weka/downloading.html

2、打开weka,选择第一项Explorer

3、准备数据集文件,在weka中,一般数据文件为:xxx.arff,比如我编辑一个文件叫做tumor.arff,文件的内容为:

@RELATION tumor

@ATTRIBUTE size NUMERIC
@ATTRIBUTE 'Class' {'1','0'}

@DATA
0.0,'0'
0.1,'0'
0.7,'1'
1.0,'0'
1.1,'0'
1.3,'0'
1.4,'1'
1.7,'1'
2.1,'1'
2.2,'1'

稍微解释一下数据,size属性表示tumor的大小,被单引号括起来的Class应该是weka中的保留字,专门表示类别。

4、加载数据。在主界面的Preprocess选项卡下,点Open file,然后选择第三步中准备好的数据文件:tumor.arff

在这个界面下,可以看到关于数据的一些统计信息,以及一些图形化的显示,同学们可以自己探索。

6、切换到主界面的Classify选项卡,点击Choose,在functions分支下面选择Logistic。

Test options选择Use training set,然后点击Start即可

7、再给出一组测试数据:

@RELATION tumor
@ATTRIBUTE x1 NUMERIC
@ATTRIBUTE x2 NUMERIC
@ATTRIBUTE 'Class' {'1','0'}

@DATA
0.0 2.9 '0'
1 1.9 '0'
2.0 0.9 '0'
3.0 -0.1 '0'
4.0 -1.1 '0'
0.0 2.5 '0'
1 1.5 '0'
2.0 0.5 '0'
3.0 -0.5 '0'
4.0 -1.5 '0'
0.0 2.0 '0'
1 1 '0'
2.0 0.0 '0'
3.0 -1 '0'
4.0 -2.0 '0'
0.0 1 '0'
1 0.0 '0'
2.0 -1 '0'
3.0 -2.0 '0'
4.0 -3.0 '0'
0.2 2.9 '1'
1.2 1.9 '1'
2.2 0.9 '1'
3.2 -0.1 '1'
4.2 -1.1 '1'
1.2 2.9 '1'
2.2 1.9 '1'
3.2 0.9 '1'
4.2 -0.1 '1'
5.2 -1.1 '1'
2.2 2.9 '1'
3.2 1.9 '1'
4.2 0.9 '1'
5.2 -0.1 '1'
6.2 -1.1 '1'
3.0 0.2 '0'
1 2.3 '0'
1 1.8 '1'
2.0 0.8 '1'

weka训练结果:

训练出来的模型是:h(x)=1/(1+exp(-(-13.9827+4.6001*x1+4.6302*x2)))

用weka来做Logistic Regression的更多相关文章

  1. 逻辑回归 Logistic Regression

    逻辑回归(Logistic Regression)是广义线性回归的一种.逻辑回归是用来做分类任务的常用算法.分类任务的目标是找一个函数,把观测值匹配到相关的类和标签上.比如一个人有没有病,又因为噪声的 ...

  2. Logistic Regression - Formula Deduction

    Sigmoid Function \[ \sigma(z)=\frac{1}{1+e^{(-z)}} \] feature: axial symmetry: \[ \sigma(z)+ \sigma( ...

  3. Stanford机器学习笔记-2.Logistic Regression

    Content: 2 Logistic Regression. 2.1 Classification. 2.2 Hypothesis representation. 2.2.1 Interpretin ...

  4. Logistic Regression vs Decision Trees vs SVM: Part II

    This is the 2nd part of the series. Read the first part here: Logistic Regression Vs Decision Trees ...

  5. Logistic Regression Vs Decision Trees Vs SVM: Part I

    Classification is one of the major problems that we solve while working on standard business problem ...

  6. Logistic Regression逻辑回归

    参考自: http://blog.sina.com.cn/s/blog_74cf26810100ypzf.html http://blog.sina.com.cn/s/blog_64ecfc2f010 ...

  7. 在opencv3中实现机器学习之:利用逻辑斯谛回归(logistic regression)分类

    logistic regression,注意这个单词logistic ,并不是逻辑(logic)的意思,音译过来应该是逻辑斯谛回归,或者直接叫logistic回归,并不是什么逻辑回归.大部分人都叫成逻 ...

  8. Stanford机器学习---第三讲. 逻辑回归和过拟合问题的解决 logistic Regression & Regularization

    原文:http://blog.csdn.net/abcjennifer/article/details/7716281 本栏目(Machine learning)包括单参数的线性回归.多参数的线性回归 ...

  9. Coursera台大机器学习课程笔记9 -- Logistic Regression

    如果只想得到某种概率,而不是简单的分类,那么该如何做呢?在误差衡量问题上,如何选取误差函数这段很有意思. 接下来是如何最小化Ein,由于Ein是可凸优化的,所以采用的是梯度下降法:只要达到谷底,就找到 ...

随机推荐

  1. php 批量导入数据的一种思维

    <?php $str="风湿免疫科 消化内科 内分泌科 神经内科 感染内科 心血管内科放疗中心";$arr=explode(' ',$str);$sql="&quo ...

  2. 使用HttpUtils 上传视频文件

    private void shangchuan(){                 //文件的路径        //File file=new File(path);        File fi ...

  3. [转]JSONObject与JSONArray的使用

    http://www.cnblogs.com/xwdreamer/archive/2011/12/16/2296904.html 参考文献: http://blog.csdn.net/huangwuy ...

  4. AI 人工智能 探索 (九)

    链接:http://pan.baidu.com/s/1c0AM3g0 密码:uccw 今天补充 创建物体 移动物体 ,当点击创建后 ,会出来一个 上图的 ui,他跟随 物体,当你把物体拖动到 指定的地 ...

  5. HDU2579--Dating with girls(2)--(DFS, 判重)

    Dating with girls(2) Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Oth ...

  6. FZU 2140 Forever 0.5(将圆离散化)

    主要就是将圆离散化,剩下的都好办 #include<iostream> #include<cstdio> #include<cstring> #include< ...

  7. Git学习 -- 标签管理

    新建标签 git tag <tagname>   默认为HEAD,也可以指定一个commit id eg.   git tag v0.9  git tag v1.0 31aa59c git ...

  8. Stem Cell 华人科学家

    Jianping Fu 密歇根大学机械工程系生物医学工程专业 PhD, Massachusetts Institute of Technology, 2007MS, University of Cal ...

  9. GIT问题,error:src refspec master does not match any

    将本地GIT版本库PUSH到一个GITHUB上一个空的版本库时可能会出现如下错误error:src refspec master does not match any原因: 本地版本库为空, 空目录不 ...

  10. JSP内置对象--application对象(getRealPath(),getAttributeNames(),getContextPath())

    application对象是javax.servlet.ServletContext接口的实例化对象.是整个servlet的上下文,代表了整个web容器的操作. 常用方法: 1.java.lang.S ...