天池龙珠-数据挖掘训练营01赛题理解学习笔记

本学习笔记为阿里云天池龙珠计划Docker训练营的学习内容,学习链接为:https://tianchi.aliyun.com/specials/activity/promotion/aicampdm

一、学习知识点概要

  • 评价指标

二、学习内容

  1. 数据来源
    Ebay
    数量超过 370,000,包含 20 列变量信息
    数字脱敏处理,都为label encoding形式

  2. 比赛目标
    价格预测
    评价标准MAE(Mean Absolute Error)在这里插入图片描述

  3. 评价指标:
    分类算法常见的评估指标如下:

- 二类分类器/分类算法

True\Pred10
1TPFN
0FPTN

A c c u r a c y = T P T P + F P + T N Accuracy = \frac{TP}{TP+FP+TN} Accuracy=TP+FP+TNTP

P r e c i s i o n = T P T P + F P Precision = \frac{TP}{TP+FP} Precision=TP+FPTP

R e c a l l = T P T P + T N Recall = \frac{TP}{TP+TN} Recall=TP+TNTP

F 1 − S c o r e = 2 ∗ P r e c i s i o n ∗ R e c a l l P r e c i s i o n + R e c a l l F_1-Score = 2*\frac{Precision*Recall}{Precision+Recall} F1Score=2Precision+RecallPrecisionRecall

F β − S c o r e = ( 1 + β 2 ) ∗ P r e c i s i o n ∗ R e c a l l β 2 P r e c i s i o n + R e c a l l F_\beta-Score = (1+\beta^2)*\frac{Precision*Recall}{\beta^2Precision+Recall} FβScore=(1+β2)β2Precision+RecallPrecisionRecall

ROC-AUC曲线 | PRC曲线

-多类分类器/分类算法

评价指标主要有accuracy,
[宏平均和微平均,F-score]。

## accuracy
import numpy as np
from sklearn.metrics import accuracy_score
y_pred = [0, 1, 0, 1]
y_true = [0, 1, 1, 1]
print('ACC:',accuracy_score(y_true, y_pred))
## Precision,Recall,F1-score
from sklearn import metrics
y_pred = [0, 1, 0, 0]
y_true = [0, 1, 0, 1]
print('Precision',metrics.precision_score(y_true, y_pred))
print('Recall',metrics.recall_score(y_true, y_pred))
print('F1-score:',metrics.f1_score(y_true, y_pred))
## AUC
import numpy as np
from sklearn.metrics import roc_auc_score
y_true = np.array([0, 0, 1, 1])
y_scores = np.array([0.1, 0.4, 0.35, 0.8])
print('AUC socre:',roc_auc_score(y_true, y_scores))

- 回归预测类
常见的评估指标如下:
平均绝对误差(Mean Absolute Error,MAE),
M A E = ∑ i = 1 N ∣ y i − y i ^ ∣ N MAE = \frac{\sum_{i=1}^N|y_i-\hat{y_i}|}{N} MAE=Ni=1Nyiyi^
平均绝对百分误差(Mean Absolute Percentage Error,MAPE),
M A P E = ∑ i = 1 N ∣ y i − y i ^ ∣ y i N MAPE = \frac{\sum_{i=1}^N\frac{|y_i-\hat{y_i}|}{y_i}}{N} MAPE=Ni=1Nyiyiyi^

均方误差(Mean Squared Error,MSE),
M S E = ∑ i = 1 N ( y i − y i ^ ) 2 N MSE = \frac{\sum_{i=1}^N(y_i-\hat{y_i})^2}{N} MSE=Ni=1N(yiyi^)2
均方根误差(Root Mean Squared Error)
R M S E = ∑ i = 1 N ( y i − y i ^ ) 2 N RMSE =\sqrt{\frac{\sum_{i=1}^N(y_i-\hat{y_i})^2}{N}} RMSE=Ni=1N(yiyi^)2

拟合优度R2(R-Square)

# coding=utf-8
import numpy as np
from sklearn import metrics

# MAPE需要自己实现
def mape(y_true, y_pred):
    return np.mean(np.abs((y_pred - y_true) / y_true))

y_true = np.array([1.0, 5.0, 4.0, 3.0, 2.0, 5.0, -3.0])
y_pred = np.array([1.0, 4.5, 3.8, 3.2, 3.0, 4.8, -2.2])

# MSE
print('MSE:',metrics.mean_squared_error(y_true, y_pred))
# RMSE
print('RMSE:',np.sqrt(metrics.mean_squared_error(y_true, y_pred)))
# MAE
print('MAE:',metrics.mean_absolute_error(y_true, y_pred))
# MAPE
print('MAPE:',mape(y_true, y_pred))
## R2-score
from sklearn.metrics import r2_score
y_true = [3, -0.5, 2, 7]
y_pred = [2.5, 0.0, 2, 8]
print('R2-score:',r2_score(y_true, y_pred))

三、学习问题与解答
sklearn.metrics

四、学习思考与总结

  1. 分析数据
    哪些数据是可靠的,哪些数据是需要精密的处理的,
    哪部分数据应该是关键数据
    数据之间的关联逻辑是什么样的

  2. 分析题目
    这题的难点可能在哪里,关键点可能在哪里,
    哪些地方可以挖掘更好的特征,
    用什么样得线下验证方式更为稳定,
    出现了过拟合或者其他问题,估摸可以用什么方法去解决这些问题,

  3. 评价指标
    本地验证&线上验证

  4. 其他
    比如高效性要求,比如对于数据异常的识别处理,比如工序流程的差异性,比如模型运行的时间,比模型的鲁棒性

(背景的业务逻辑下,比如CTR的题,一个寻常顾客大体会有怎么样的购买行为逻辑规律,或者风电那种题,如果机组比较邻近,相关一些风速,转速特征是否会很近似)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值