Skip to content
C

Problem 3: Use Stratified K-Fold on Imbalanced Data

Easypython

Problem Description

Write a Python program that applies Stratified K-Fold Cross-Validation to an imbalanced classification dataset, and prints the resulting fold scores.

Input

An imbalanced labeled dataset.

Output

The fold scores using Stratified K-Fold.

Constraints

  • At least 20 labeled examples, with a clear class imbalance.

Example Input

text
(An imbalanced dataset with 20 examples, 16 of class 0 and 4 of class 1)

Example Output

text
Stratified fold scores: [0.8, 0.75, 0.85, 0.8, 0.9]

Concepts Covered

StratifiedKFold, cross_val_score().

Input (stdin)

Output

Run your code to see output here...