Sklearn中MLPClassifier中最重要的功能

mak*_*kis 5 classification machine-learning python-2.7 multi-layer scikit-learn

我想知道在Sklearn中安装MLP分类器后,是否有任何方法可以可视化或找到最重要/最重要的功能。

简单的例子:

import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import LeaveOneOut
from sklearn.neural_network import MLPClassifier
from sklearn.model_selection import GridSearchCV
from sklearn.pipeline import make_pipeline


data= pd.read_csv('All.csv', header=None)
X, y = data.iloc[0:, 0:249].values, data.iloc[0:,249].values

sc = StandardScaler()
mlc = MLPClassifier(activation = 'relu', random_state=1,nesterovs_momentum=True)
loo = LeaveOneOut()
pipe = make_pipeline(sc, mlc)

parameters = {"mlpclassifier__hidden_layer_sizes":[(168,),(126,),(498,),(166,)],"mlpclassifier__solver" : ('sgd','adam'), "mlpclassifier__alpha": [0.001,0.0001],"mlpclassifier__learning_rate_init":[0.005,0.001] }
clf = GridSearchCV(pipe, parameters,n_jobs= -1,cv = loo)
clf.fit(X, y)

model = clf.best_estimator_
print("the best model and parameters are the following: {} ".format(model))
Run Code Online (Sandbox Code Playgroud)

Tom*_*oim 6

好问题。NN模型缺乏可解释性是ML / NN社区一直在努力的痛苦之一。

LIME论文(Ribeiro等人,KDD'16)是一种最近引起人们关注的方法。以下是摘要的相关摘录:

  • “在这项工作中,我们提出了LIME,这是一种新颖的解释技术,通过学习围绕预测的局部可解释模型,以一种可解释和忠实的方式解释任何分类器的预测”

还有一个GitHub 存储库(是的,Python!)。

(如果您尝试使用LIME,请在问题评论中分享您的经验。)

  • LIME 用于分析样本级别的特征,它不会为您提供模型级别的任何信息。 (2认同)