1. Home
  2. /
  3. Xgboost
  4. /
  5. Feature Importance

Feature Importance - Xgboost Typing CST Test

Loading…

Feature Importance — Xgboost Code

Trains a model and prints feature importances.

import xgboost as xgb
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split

data = load_breast_cancer()
X_train,X_test,y_train,y_test = train_test_split(data.data,data.target,test_size=0.2,random_state=42)

model = xgb.XGBClassifier(eval_metric='logloss')
model.fit(X_train,y_train)
print('Feature Importances:',model.feature_importances_)

Xgboost Language Guide

XGBoost (Extreme Gradient Boosting) is an optimized, scalable, and high-performance gradient boosting framework based on decision trees, widely used for supervised learning tasks including classification, regression, and ranking.

Primary Use Cases

  • ▸Binary and multiclass classification
  • ▸Regression tasks
  • ▸Learning-to-rank applications
  • ▸Feature importance analysis
  • ▸Integration in ML pipelines for structured/tabular data

Notable Features

  • ▸Gradient boosting with L1/L2 regularization
  • ▸Parallelized tree construction
  • ▸Supports missing value handling natively
  • ▸Tree pruning via depth-wise or loss-guided strategies
  • ▸Supports GPU acceleration and distributed training

Origin & Creator

XGBoost was developed by Tianqi Chen and collaborators in 2014 to provide an efficient and scalable gradient boosting library, optimized for performance and accuracy.

Industrial Note

XGBoost is heavily used in Kaggle competitions, finance, healthcare analytics, adtech, recommendation systems, and any scenario needing fast and accurate tree-based predictions.

More Xgboost Typing Exercises

XGBoost Simple Classification ExampleXGBoost Binary ClassificationXGBoost Regression ExampleXGBoost Early StoppingXGBoost Cross-ValidationXGBoost Grid Search ExampleXGBoost Predict ProbabilitiesXGBoost Save and Load ModelXGBoost Feature Importance Plot

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher