Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed attribute name fit.enumerators_ to fit.estimators #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import statsmodels.api as sm1
import matplotlib.pylab as plt

from ch4_optimal_clustering import clusterKMeansBase
from .ch4_optimal_clustering import clusterKMeansBase

#Code snippet 6.1 generating a set of informative, redundant, and noisy explanatory variables
# returns matrix X of training samples, and vector y of class labels for the training samples
Expand All @@ -30,7 +30,7 @@ def getTestData(n_features=100, n_informative=25, n_redundant=25, n_samples=1000
#code snippet 6.2 implementation of an ensembke MDI method
def featImpMDI(fit, featNames):
#feat importance based on IS mean impurity reduction
df0 = {i:tree.feature_importances_ for i, tree in enumerate(fit.enumerators_)}
df0 = {i:tree.feature_importances_ for i, tree in enumerate(fit.estimators_)}
df0 = pd.DataFrame.from_dict(df0, orient='index')
df0.columns = featNames
df0 = df0.replace(0, np.nan) #because max_features=1
Expand Down