Python Forum
Using Python and scikitlearn, how to output the individual feature dependencies?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using Python and scikitlearn, how to output the individual feature dependencies?
#5
Hello Jef,
Thanks again for your input. Ok, I have made some changes to my code:
from sklearn.ensemble import ExtraTreesClassifier
model = ExtraTreesClassifier()
model.fit(x_train, y_train)
coef = pd.DataFrame({''Columns'': x_train.columns, ''Importances'': np.transpose(model.feature_importances_)}).sort_values(by=[''Importances''], ascending=False)
print(coef.nlargest(10, ''Importances''))
I am getting the following output:
Output:
Columns Importances 125 incident_severity_Minor Damage 0.042847 40 insured_hobbies_chess 0.041505 126 incident_severity_Total Loss 0.028544 124 collision_type_Unknown 0.019634 41 insured_hobbies_cross-fit 0.014173 1 policy_state_OH 0.009765 16 insured_sex_MALE 0.009697 57 insured_relationship_own-child 0.009582 25 insured_occupation_exec-managerial 0.009513 5 policy_deductable_500 0.009146
I can't make sense of this, as the percentages don't seem right? Need they be calibrated or converted?
Thank you!
Reply


Messages In This Thread
RE: Using Python and scikitlearn, how to output the individual feature dependencies? - by warren8r - Jan-31-2020, 04:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  AttributeError: Can't get attribute 'Individual' on <module 'deap.creator' DomClout 4 8,921 Jul-27-2018, 09:05 PM
Last Post: Vysero
  Python Dependencies rbs 4 3,998 Dec-19-2017, 08:24 PM
Last Post: snippsat
  AUCPR of individual features using Random Forest (Error: unhashable Type) melissa 1 3,359 Jul-10-2017, 12:48 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020