How to top n values from .predict_proba in multioutputclassifier?
I am following MultiOutputClassifier technique to predict roles (the data are transformed to numeric so that's not a concern)
I want to use .predict_proba()
and extract top 4 values along with its classes.(there are 5 output variables role0, role1, role2, role3, role4, role5
).
I am not sure how to do this.
While doing normal analysis we use this to extract top n values for each observation.
proba_k=k.predict_proba(xval)
best_n=np.argsort(-proba_k, axis=1)[:, :4]
My concern is to predict top 4 roles in role0
.
role0 role1 role2 role3 role4
9469 Small Business Owner Operator Operations Director Chief Executive Officer Service Manager Manager Commercial Lines
1433 Internal Sales Coordinator Financial Systems Analyst Corporate Paralegal General Ledger Accountant Project Accountant
I am sorry if the table looks a bit clumsy.
Topic multi-output multiclass-classification scikit-learn python
Category Data Science