1 Star 1 Fork 0

zhoub86/ML-in-physical-layer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
reportGBDT.py 830 Bytes
一键复制 编辑 原始数据 按行查看 历史
FassyGit 提交于 2018-03-10 14:12 . Add
import pandas as pd
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.ensemble import BaggingClassifier
traindata = pd.read_csv('stock_train_data_20171111.csv')
testdata = pd.read_csv('stock_test_data_20171111.csv')
X_train=traindata[:]
del X_train['label']
del X_train['id']
del X_train['era']
del X_train['weight']
y_train=traindata['label']
X_test=testdata[:]
del X_test['id']
weight=traindata['weight'].values
logistic_model = BaggingClassifier(GradientBoostingClassifier(random_state=10),
max_samples=0.5,max_features=0.5)
logistic_model.fit(X_train, y_train,sample_weight=weight)
fitted_test= logistic_model.predict_proba(X_test)[:, 1]
save = pd.DataFrame({'id':testdata['id'],'proba':fitted_test})
save.to_csv('resultGBDT.csv',index=False,sep=',')
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/zhoub86/ML-in-physical-layer.git
git@gitee.com:zhoub86/ML-in-physical-layer.git
zhoub86
ML-in-physical-layer
ML-in-physical-layer
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385