队长:无能万金油 邮箱:[email protected]
- lightgbm 2.3.0
- sklearn
- numpy
- matplotlib
- pandas 0.23.4
- gensim
- shapely
- geopandas
- tqdm
- 预处理和模型代码文件:初赛整理.ipynb
- 本代码模型为light的sklearn接口的回归模型。
- data文件主要存放赛选和清理后的数据和sport文件,由于清洗后的 文件依然很大,所以并没有放进去,可通过运行代码里面的读取源文件生成, 不过处理时间较长。
特征工程部分我们做了很多特征,但是后期发下有些特征容易使模型过拟合
,由于线上线下无法构建稳定的训练集,造成线下loss下降,线上loss升高的情况
所以我们赛选了一部分特征送入模型:
距离特征:
距离目的地港口
距离起始港口
前后数据距离
行船累积距离
时间特征:
起始时间:年、月、日、小时、周期
行船时间
距离时间
预估时间
速度特征:
瞬时速度,加速度,平均速度
label特征:
根据目的干计算平均到港时间
根据终点港计算平均到港时间
根据TRANSPORT计算平均到港时间
我们人工校正了一些港口的坐标,结合event文件,得到港口坐标文件sport
清洗思路主要是赛选出起始港和终点港差距小于一定范围的数据
同时训练集的构造选取目的港和trace在test中出现的数据,保证训练集和测试集的相似性
对于噪声数据如direction为-1的数据也进行了清除
模型开始,构建是以一个loadingOrder为一个样本构建的,为了模拟test
采用随机截取前半段来构建train
但是后半期我们采用单个路由作为一个样本来训练的思路
label的构建就采用最后一条Log时间-timestamp 转化成小时计算
最后提交文件就采用timestamp+label 得到到港时间,在对到港时间取均值
后处理部分,我们对异常的label做了校正尝试,比如箱型检测,对于一个loadingOrder的
数据,取上分位和下分位,超过或低于分位点的用分位点代替或者平均值代替。
通过观察预测结果我们还做了一些调整,比如删除第一个log的预测值,或者只取最后一个log的预测值。
亦或者使用修正的格式构造:label=(predict-predict_mean)/predict_std+predict
同时我们还尝试多个模型,多个种子,多参数的融合
将多个线上分数表现良好的结果取平均预测时间。
单模型预测线上分数能在1k左右
最后融合+后处理 线上最好成绩达到810.