Problem 3: Manually Calculate Gini Impurity
Easypython
Problem Description
Write a Python program that manually calculates the Gini Impurity for a node given the count of samples in each class (without using any built-in function).
Input
A list of class counts (e.g., [6, 4] meaning 6 of Class A, 4 of Class B).
Output
The calculated Gini Impurity.
Constraints
- At least 2 classes.
Example Input
text[6, 4]
Example Output
textGini Impurity: 0.48
Concepts Covered
Manual Gini formula, proportions, arithmetic.