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

本站现有博文321篇,共被浏览767738

本站已经建立2450天!

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