机器学习——岭回归

机器学习——岭回归
         分别使用岭回归和Lasso解决上面回归问题当回归存在多重共线性的时候,可以使用最小二乘,岭回归,Lasso回归, 但当X的秩不存在的时候或变量的数量少于样本的数量是,作为无偏差估计的最小二乘就不适用,岭回归和Lasso回归更合适。过程:1、加载数据做中心化后做线性回归:     可以看到线性回归方程很不显著,存在多重共线性,下面做多……继续阅读 »

Haran 8年前 (2016-09-17) 4640浏览 0评论1个赞

Python中做聚类分析

Python中做聚类分析
数据集 ex14.csv 是关于中国各个省份的三项指标数值。请根据这些指标数值,将各个省份分为3类,并尝试归纳出各个类别的特点查看数据图形分布:# coding=utf-8import osimport pandas as pdfrom sklearn.cluster import AgglomerativeClusteringfr……继续阅读 »

Haran 8年前 (2016-09-07) 10299浏览 0评论7个赞

Python中做分类分析(KNN,Bayes,DecisionTree,SVM)

Python中做分类分析(KNN,Bayes,DecisionTree,SVM)

Warning: preg_replace(): Compilation failed: missing closing parenthesis at offset 59 in /www/wwwroot/ichdata/wp-content/themes/git/include/seo.php on line 109

Warning: preg_replace(): Compilation failed: missing closing parenthesis at offset 49 in /www/wwwroot/ichdata/wp-content/themes/git/include/seo.php on line 110

Warning: preg_replace(): Compilation failed: missing closing parenthesis at offset 59 in /www/wwwroot/ichdata/wp-content/themes/git/include/seo.php on line 111

Warning: preg_replace(): Compilation failed: unmatched closing parenthesis at offset 19 in /www/wwwroot/ichdata/wp-content/themes/git/include/seo.php on line 109

Warning: preg_replace(): Compilation failed: unmatched closing parenthesis at offset 16 in /www/wwwroot/ichdata/wp-content/themes/git/include/seo.php on line 110

Warning: preg_replace(): Compilation failed: unmatched closing parenthesis at offset 19 in /www/wwwroot/ichdata/wp-content/themes/git/include/seo.php on line 111
……继续阅读 »

Haran 8年前 (2016-08-28) 5721浏览 0评论2个赞

Python中做广义线性模型

Python中做广义线性模型
data2 是关于重伤病人的一些基本资料。自变量X是病人的住院天数,因变量Y是病人出院后长期恢复的预后指数,指数数值越大表示预后结局越好。尝试对数据拟合合适的线性或非线性模型过程:1、通过散点图可以判断可能可以使用的模型有:线性回归,对数,指数和冥指数回归# -*- coding: utf-8 -*-import pandas as pdfr……继续阅读 »

Haran 8年前 (2016-08-10) 6576浏览 0评论0个赞

机器学习——线性回归

机器学习——线性回归
回归建模的主要流程:1、描述性统计:对数据有个概览2、异常缺失值处理3、多重共线性检验:kappa(cor(),exact=TRUE)4、相关性分析:筛选自变量5、参数计算方法:最小二乘法,岭回归6、检验:拟合度检验:R^2模型显著性检验:F检验的P-value参数检验:T检验的P-value残差正太性检验:shapiro.test残差……继续阅读 »

Haran 8年前 (2016-08-09) 5908浏览 0评论0个赞

Python中做logistic回归模型

Python中做logistic回归模型
data1 是40名癌症病人的一些生存资料,其中,X1表示生活行动能力评分(1~100),X2表示病人的年龄,X3表示由诊断到直入研究时间(月);X4表示肿瘤类型,X5把ISO两种疗法(“1”是常规,“0”是试验新疗法);Y表示病人生存时间(“0”表示生存时间小于200天,“1”表示生存时间大于或等于200天)试建立Y关于X1~X5的logistic回归模……继续阅读 »

Haran 8年前 (2016-06-10) 7199浏览 0评论0个赞