Skip to content
CampusEduX

Problem 1: Perform Basic 5-Fold Cross-Validation

Easypython
Learn the Concept: Cross-Validation

Problem Description

Write a Python program that performs 5-Fold Cross-Validation on a Logistic Regression model, printing the scores for each fold and their mean.

Input

A labeled dataset.

Output

The 5 fold scores and their mean.

Constraints

  • At least 10 labeled examples.

Example Input

text
(A labeled binary classification dataset with 10+ examples)

Example Output

text
Fold scores: [0.9, 1.0, 0.8, 0.9, 1.0] Mean accuracy: 0.92

Concepts Covered

cross_val_score(), cv=5.

Related Problems

  • Problem 2: Compare Different Values of k
    Easy · python
    Solve Problem
  • Problem 3: Use Stratified K-Fold on Imbalanced Data
    Easy · python
    Solve Problem
  • Problem 4: Compare Cross-Validation Mean and Standard Deviation for Two Models
    Easy · python
    Solve Problem

Input (stdin)

Output

Run your code to see output here...