from lightgbm import LGBMRegressor
from xgboost import XGBRegressor
import numpy as np
import pandas as pd
train = pd.read_csv('./zhengqi_train.txt',sep = '\t')
test = pd.read_csv('./zhengqi_test.txt',sep = '\t')
X_train = train.iloc[:,:-1]
y_train = train['target']
X_train.shape
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/d68cd38e11e20310f1dfa6e601ad48aa.png#pic_center)
%%time
light = LGBMRegressor()
light.fit(X_train,y_train)
y_ = light.predict(test)
pd.Series(y_).to_csv('./light.txt',index = False)
%%time
xgb = XGBRegressor(max_depth = 50,n_estimators = 100)
xgb.fit(X_train,y_train)
y_ = xgb.predict(test)
pd.Series(y_).to_csv('./xgb.txt',index = False)
cov = train.cov()
cov
drop_labels = cov.index[cov.loc['target'].abs()<0.1]
drop_labels.shape
X_train.drop(drop_labels,axis = 1,inplace = True)
X_train.shape
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/0d86544544194816b9eaa365d89a5568.png#pic_center)
light = LGBMRegressor()
light.fit(X_train,y_train)
y_ = light.predict(test)
pd.Series(y_).to_csv('./light2.txt',index = False)
X_test = pd.read_csv('./zhengqi_test.txt',sep = '\t')
drop_labels = ["V5","V9","V11"]
X_train = train.iloc[:,0:-1]
X_test = pd.read_csv('./zhengqi_test.txt',sep = '\t')
X_train.drop(drop_labels,axis = 1,inplace = True)
X_test.drop(drop_labels,axis = 1,inplace = True)
X_test.shape
light = LGBMRegressor()
light.fit(X_train,y_train)
y_ = light.predict(X_test)
pd.Series(y_).to_csv('./light3.txt',index = False)