Python Forum
Help with eli5 module output
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with eli5 module output
#1
Hi,

I'm running the following code in Spyder(Python 3.7). However, the output is <IPython.core.display.HTML object>, rather than a table. Am I missing something here? Thanks in advance.
#import libraries
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier

data = pd.read_csv('FIFA 2018 Statistics.csv')
y = (data['Man of the Match'] == "Yes")  # Convert from string "Yes"/"No" to binary
feature_names = [i for i in data.columns if data[i].dtype in [np.int64]]
X = data[feature_names]
train_X, val_X, train_y, val_y = train_test_split(X, y, random_state=1)
my_model = RandomForestClassifier(random_state=0).fit(train_X, train_y)

import eli5
from eli5.sklearn import PermutationImportance

perm = PermutationImportance(my_model, random_state=1).fit(val_X, val_y)
eli5.show_weights(perm, feature_names = val_X.columns.tolist())
Reply
#2
Spyder doesn't display HTML
https://python-forum.io/Thread-How-to-di...TML-object
https://stackoverflow.com/questions/5490...on-console
Reply
#3
Got it. Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  My code displays too much output when importing class from a module lil_e 4 1,154 Oct-22-2022, 12:56 AM
Last Post: Larz60+
  Recursive function not returning expected output...(Python speech recog module) bigmit37 4 5,867 Jan-10-2017, 02:13 PM
Last Post: bigmit37

Forum Jump:

User Panel Messages

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