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

本站现有博文320篇,共被浏览757164

本站已经建立2422天!

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