Skip to content
C

Problem 2: Compare Different Values of k

Easypython

Problem Description

Write a Python program that performs Cross-Validation with k=3, k=5, and k=10 on the same model and dataset, comparing the resulting mean scores.

Input

A labeled dataset.

Output

The mean score for each value of k.

Constraints

  • At least 15 labeled examples (to reasonably support k=10).

Example Input

text
(A labeled dataset with 15+ examples)

Example Output

text
k=3: Mean accuracy = 0.87 k=5: Mean accuracy = 0.90 k=10: Mean accuracy = 0.91

Concepts Covered

cross_val_score(), comparing cv values.

Input (stdin)

Output

Run your code to see output here...