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

本站现有博文332篇,共被浏览899920

本站已经建立2601天!

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