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

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

本站已经建立2443天!

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