I have a ndarray that includes probabilities for being associated to specific class. This is multi-class problem in which every record can be associated to class 0 - 4.
I used one of the classifiers of sckit-learn:
classifier = RandomForestClassifier(n_estimators=100)
predictions_proba = classifier.predict_proba(dataframe)
Let's look on predictions_proba
array([[ 0.2 , 0.36 , 0.32 , 0.05 , 0.07 ],
[ 0.04 , 0.54 , 0.29 , 0.08 , 0.05 ],
[ 0.05 , 0.02 , 0. , 0.93 , 0. ],
...,
[ 0.47777778, 0.2 , 0.13 , 0.19 , 0.00222222],
[ 0.5951746 , 0. , 0. , 0. , 0.4048254 ],
[ 0. , 0. , 0. , 0.13837252, 0.86162748]])
I would like to find the easiest way for finding the greatest probability in each sub array. For the example above I would like to return:
[ 0.36, 0.54, 0.93,..., 0.86162748]
0.36 is the greatest probability in the first array, 0.54 is the greatest probility in the second array, and so on.
finding max in NumPy array?