Problem 4: Combine a Pipeline with GridSearchCV
Easypython
Problem Description
Write a Python program that builds a Pipeline with a scaler and a LogisticRegression classifier, then uses GridSearchCV to tune the classifier's regularization strength (C parameter) within the pipeline.
Input
A labeled dataset and a small set of candidate C values.
Output
The best C value found and its Cross-Validation score.
Constraints
- At least 20 labeled examples.
Example Input
text(A labeled dataset, C candidates: [0.1, 1, 10])
Example Output
textBest parameters: {'classifier__C': 1} Best score: 0.88
Concepts Covered
Pipeline, GridSearchCV, parameter naming with __ for pipeline steps.