Skip to content

Instantly share code, notes, and snippets.

@omartinez182
Created September 10, 2020 19:35
Show Gist options
  • Save omartinez182/effdc2a56f3139b035d5b0a33b24bebd to your computer and use it in GitHub Desktop.
Save omartinez182/effdc2a56f3139b035d5b0a33b24bebd to your computer and use it in GitHub Desktop.
Snippet #1 - Nested Cross-Validation Article
#Load libraries
import numpy as np
import pandas as pd
from sklearn.datasets import load_wine
from sklearn.model_selection import StratifiedKFold
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import cross_val_score, GridSearchCV, KFold
import matplotlib.pyplot as plt
import warnings
%matplotlib inline
warnings.filterwarnings("ignore")
#Load data
X, y = load_wine(return_X_y=True)
X.shape, y.shape
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment