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

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

本站已经建立2718天!

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