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

本站现有博文311篇,共被浏览740232

本站已经建立2377天!

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