{"library":"lightgbm","code":"import numpy as np\nimport lightgbm as lgb\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.metrics import accuracy_score\n\n# Generate some dummy data\nX = np.random.rand(1000, 10)\ny = np.random.randint(0, 2, 1000)\n\n# Split data into training and testing sets\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n\n# Initialize and train the LGBMClassifier\n# Using scikit-learn API for convenience\nmodel = lgb.LGBMClassifier(objective='binary', random_state=42)\nmodel.fit(X_train, y_train,\n          eval_set=[(X_test, y_test)],\n          callbacks=[lgb.early_stopping(10)]) # Early stopping after 10 rounds without improvement\n\n# Make predictions\ny_pred = model.predict(X_test)\n\n# Evaluate the model\naccuracy = accuracy_score(y_test, y_pred)\nprint(f\"Model Accuracy: {accuracy:.4f}\")","lang":"python","description":"This quickstart demonstrates how to train a binary classification model using LightGBM's scikit-learn compatible API (`LGBMClassifier`). It covers data preparation, model initialization, training with early stopping, prediction, and evaluation. For non-scikit-learn API, `lgb.Dataset` and `lgb.train` are used.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}