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

本站现有博文340篇,共被浏览1026348次

本站已经建立2721天!

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