Skip to content

Instantly share code, notes, and snippets.

View TimothyYe's full-sized avatar
🖋️
Creating bugs...

Timothy TimothyYe

🖋️
Creating bugs...
  • Singapore
View GitHub Profile
@TimothyYe
TimothyYe / example.py
Created July 25, 2024 13:52
Stacking to Improve Model Performance
import numpy as np
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
from xgboost import XGBClassifier
# Generate a sample dataset
X, y = make_classification(n_samples=1000, n_features=20, n_classes=2, random_state=42)