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

本站现有博文333篇,共被浏览919507

本站已经建立2625天!

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