EADST

Train XGBoost Model with Pandas Input

Train XGBoost Model with Pandas Input

import warnings
warnings.filterwarnings("ignore")
import pandas as pd
import numpy as np
import xgboost as xgb
from sklearn.metrics import classification_report

train=pd.read_csv('./train.csv')
test=pd.read_csv('./test.csv')


info=pd.read_csv('info.csv')
print(info.head()) # column name
print(info.shape)
new_info = info.drop_duplicates(subset=['id']) # remove duplicate row with same id
train2=pd.merge(train, new_info[['id', 'number']], how='left', on='id').fillna(0) # merge table horizontally

train_y=train2['result']
train_x=train2.drop(columns=['uaid','result','others'])
test_id = test['id']
test_y=test['result']
test_x=test.drop(columns=['uaid','result','others'])


model = xgb.XGBClassifier()
model.fit(train_x, train_y)
train_predict_y = model.predict(train_x)
print(classification_report(train_y, train_predict_y))


result=model.predict_proba(test_x)
result=pd.concat([test_y,pd.DataFrame(result)],axis=1)
result.to_csv('./test_result.csv')
相关标签
About Me
XD
Goals determine what you are going to be.
Category
标签云
SAM Pandas PIP logger Github QWEN 图标 Pillow CLAP Pytorch RGB IndexTTS2 Base64 FP8 Qwen 报税 Vim Dataset Animate Random 公式 Ptyhon Rebuttal VSCode tqdm git Paper Google BeautifulSoup v0.dev 云服务器 Math uwsgi Conda Breakpoint Tracking VGG-16 ModelScope Mixtral CAM CUDA Website FlashAttention Knowledge Hilton Miniforge VPN 阿里云 Jetson Qwen2 LaTeX scipy HaggingFace Augmentation PyTorch Interview Use Land ONNX Bert Quantization Ubuntu Django icon Password ChatGPT TensorFlow Logo GIT OpenCV Markdown Pickle UNIX Tensor Excel 签证 Translation LLM Agent Nginx PDB CTC TTS JSON printf git-lfs Algorithm 净利润 C++ 域名 RL Bitcoin RAR Streamlit Web 论文 MD5 Hotel 算法题 GGML hf Bipartite 飞书 InvalidArgumentError Linux uWSGI Plate CEIR 财报 图形思考法 Diagram Search 第一性原理 Image2Text Attention SQLite transformers Baidu OpenAI Tiktoken DeepSeek COCO FastAPI Jupyter XML Bin Domain SVR Qwen2.5 SPIE Disk OCR SQL LeetCode Distillation 腾讯云 Git GPTQ Gemma Vmess News Plotly DeepStream LoRA EXCEL Sklearn Transformers PDF 顶会 ms-swift Firewall Hungarian 关于博主 Template Datetime Color Magnet Llama PyCharm Statistics YOLO Numpy tar Anaconda Zip API Heatmap HuggingFace Video CSV Docker Permission 强化学习 Paddle ResNet-50 Proxy FP32 Card 版权 FP64 CV WAN Windows WebCrawler 多线程 Freesound UI v2ray 论文速读 llama.cpp 搞笑 GoogLeNet TensorRT Claude CC Shortcut Quantize Cloudreve Michelin Crawler diffusers NLTK XGBoost Python 证件照 BTC Input Safetensors TSV 音频 GPT4 Data AI NLP LLAMA Review Food BF16 NameSilo Clash 继承 mmap 多进程 递归学习法 torchinfo FP16
站点统计

本站现有博文332篇,共被浏览895426

本站已经建立2597天!

热门文章
文章归档
回到顶部