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

本站现有博文337篇,共被浏览949721

本站已经建立2661天!

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