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

本站现有博文338篇,共被浏览972307次

本站已经建立2685天!

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