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

本站现有博文330篇,共被浏览861491

本站已经建立2570天!

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