- 阅读权限
- 255
- 威望
- 7 级
- 论坛币
- 144575308 个
- 通用积分
- 68.9538
- 学术水平
- 37 点
- 热心指数
- 38 点
- 信用等级
- 25 点
- 经验
- 31240 点
- 帖子
- 1873
- 精华
- 1
- 在线时间
- 802 小时
- 注册时间
- 2005-1-3
- 最后登录
- 2024-10-15
|
- Generating error/classification-confusion
- matrices
- > cp <- read.csv("college-perf.csv")
- > cp$Perf <- ordered(cp$Perf, levels =
- + c("Low", "Medium", "High"))
- > cp$Pred <- ordered(cp$Pred, levels =
- + c("Low", "Medium", "High"))
- 1. First create and display a two-way table based on the actual and predicted values:
- > tab <- table(cp$Perf, cp$Pred,
- + dnn = c("Actual", "Predicted"))
- > tab
- 2. Display the raw numbers as proportions or percentages. To get overall table-level
- proportions use:
- > prop.table(tab)
- 3. We often find it more convenient to interpret row-wise or column-wise percentages.
- To get row-wise percentages rounded to one decimal place, you can pass a second
- argument as 1:
- > round(prop.table(tab, 1)*100, 1)
复制代码
|
|