您好,欢迎来到二三娱乐。
搜索
您的当前位置:首页A tutorial on using the rminer R

A tutorial on using the rminer R

来源:二三娱乐

数据挖掘

这是一个数据挖掘的常规流程:

  1. 业务理解 :背景是什么,问题的目的是什么
  2. 数据理解 :有哪些数据,那些数据相关,数据是否充分,数据对不对
  3. 数据预处理:数据的清洗,数据的转换,包括特征的选择
  4. 建立模型:建立分类模型,回归模型
  5. 评估模型:模型效果如何,ks ,auc
  6. 模型部署,使用建立好的模型


    image.png

数据处理

输出数据的行列

# simple show rows x columns function
nelems=function(d) paste(nrow(d),"x",ncol(d))

缺失值处理

# 1.直接删除
bank4=na.omit(bank3)

# 2.用平均值填充
bank5=imputation("value",bank3,"age",Value=meanage)

# 3.substitute NA values by the values found in most similar case (1-nearestneighbor):
bank6=imputation("hotdeck",bank3,"age")

建模

fit函数:训练模型,调参数
predict: 函数,进行预测
mining :根据验证方法和运行次数执行几次拟合并预测执行。

library(rminer)
# ctree
B2=fit(schoolsup~.,math[,c(inputs,bout)],model="ctree")
# rpart 
B1=fit(schoolsup~.,math[,c(inputs,bout)],model="rpart")

B3=fit(schoolsup~.,math[,c(inputs,bout)],model="mlpe") 

B4=fit(schoolsup~.,math[,c(inputs,bout)],model="ksvm")

C3=fit(Mjob~.,cmath,model="randomForest")

你修改model就好了

评估

B1=fit(schoolsup~.,math[,c(inputs,bout)],model="rpart")
test <- math[,c(inputs,bout)]
y <- test$schoolsup.1
P1=predict(B1,test)

m=mmetric(y,P1,metric=c("ALL"))

这样就会得出所有的指标

如何查看model有哪些模型:

  • naive most common class (classification) or mean output value (regression)

分享资料:

本文如未解决您的问题请添加抖音号:51dongshi(抖音搜索懂视),直接咨询即可。

热门图文

Copyright © 2019-2025 yule263.com 版权所有 湘ICP备2023023988号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务