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

本站现有博文335篇,共被浏览937409

本站已经建立2648天!

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