Grab-inspired demand classifier combines predictions from several decision trees trained on different samples. You need to average the trees' class probabilities and return the class with the highest mean probability, giving a deterministic ensemble baseline.
P has one row per tree and one column per class: row t is tree t's predicted class-probability vector for a single sample. Average the rows and return the index of the class with the highest mean probability (the lowest index on a tie).
Implement solve(P).
Returns. Return the winning class index as a Python int.
Example 1
Input:
solve([[0.8, 0.2], [0.4, 0.6], [0.7, 0.3]])
Output:
0
Example 2
Input:
solve([[0.2, 0.5, 0.3], [0.3, 0.3, 0.4]])
Output:
1
No results yet
Run your code to check it against the examples, or submit to run every test.