&引用;“拆开包装”;SklearnClassifier对象-NLTK Python

&引用;“拆开包装”;SklearnClassifier对象-NLTK Python,python,scikit-learn,nltk,Python,Scikit Learn,Nltk,我使用了NLTK python包中的SklearnClassifier()包装器来训练两个sklearn分类器(LogisticRegression()和RandomForest()),以解决文本为特征的二进制分类问题。是否有任何功能允许用户“展开”此对象,以便访问诸如参数估计(用于逻辑回归)或随机林中的变量重要性列表(或原始sklearn对象中的任何可用项)之类的内容?nltk分类器对象可以为新实例评分,因此底层信息必须包含在该对象的某个位置?谢谢您的想法。您的分类器隐藏在_clf变量下 cl

我使用了NLTK python包中的SklearnClassifier()包装器来训练两个sklearn分类器(LogisticRegression()和RandomForest()),以解决文本为特征的二进制分类问题。是否有任何功能允许用户“展开”此对象,以便访问诸如参数估计(用于逻辑回归)或随机林中的变量重要性列表(或原始sklearn对象中的任何可用项)之类的内容?nltk分类器对象可以为新实例评分,因此底层信息必须包含在该对象的某个位置?谢谢您的想法。

您的分类器隐藏在_clf变量下

classifier = SKLearnClassifier(MLPClassifier())
mlp = classifier._clf
文件可在以下网址找到:


欢迎来到堆栈溢出!你可能想退房。正确格式化你的问题将大大有助于你找到你想要的答案。已经有一段时间了。我不确定这是新功能还是我错过了。谢谢
def __init__(self, estimator, dtype=float, sparse=True):
    """
    :param estimator: scikit-learn classifier object.

    :param dtype: data type used when building feature array.
        scikit-learn estimators work exclusively on numeric data. The
        default value should be fine for almost all situations.

    :param sparse: Whether to use sparse matrices internally.
        The estimator must support these; not all scikit-learn classifiers
        do (see their respective documentation and look for "sparse
        matrix"). The default value is True, since most NLP problems
        involve sparse feature sets. Setting this to False may take a
        great amount of memory.
    :type sparse: boolean.
    """
    self._clf = estimator
    self._encoder = LabelEncoder()
    self._vectorizer = DictVectorizer(dtype=dtype, sparse=sparse)