炼丹记之科大讯飞2020温室温度预测baseline mse=0.25分享

赛题地址:http://challenge.xfyun.cn/topic/info?type=temperature

 

# -*- coding: utf-8 -*-
"""
Created on Tue Jun 30 17:00:08 2020

@author: csdn lanxuxml
"""

import pandas as pd

train_data = pd.read_csv('train.csv')
testA_data = pd.read_csv('test.csv')

sub = pd.DataFrame(testA_data['time'])

train_data = train_data[train_data['temperature'].notnull()]
train_data = train_data.fillna(method='bfill')
testA_data = testA_data.fillna(method='bfill')

testA_data.columns = ['time','year','month','day','hour','min','sec','outdoorTemp','outdoorHum','outdoorAtmo','indoorHum','indoorAtmo']

train_data.columns = ['time','year','month','day','hour','min','sec','outdoorTemp','outdoorHum','outdoorAtmo','indoorHum','indoorAtmo', 'temperature']

train_data = train_data[['hour','min','sec','outdoorTemp','outdoorHum','outdoorAtmo','indoorHum','indoorAtmo', 'temperature']]
testA_data = testA_data[['hour','min','sec','outdoorTemp','outdoorHum','outdoorAtmo','indoorHum','indoorAtmo']]

train_data['ratio_outdoorTemp'] = 1/train_data['outdoorTemp']
testA_data['ratio_outdoorTemp'] = 1/testA_data['outdoorTemp']

train_data['temperature-rewise'] = train_data['temperature'] - train_data['outdoorTemp']
train_data.drop(['temperature'], axis=1, inplace=True)

from pycaret.regression import *

exp_reg = setup(train_data, target = 'temperature-rewise', categorical_features = ['hour','min','sec'], train_size = 0.85)

lr=create_model('lr')

evaluate_model(lr)

pred_holdout = predict_model(lr)

lr_final = finalize_model(lr)

pred_testA = predict_model(lr_final, data=testA_data)

sub["temperature"]=pred_testA['Label'] + testA_data['outdoorTemp']

sub.to_csv("submision_xunfei.csv",index=False)

你可能感兴趣的:(算法竞赛,炼丹记)