a2.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:assignments 作者: iit-cs579 项目源码 文件源码
def top_coefs(clf, label, n, vocab):
    """
    Find the n features with the highest coefficients in
    this classifier for this label.
    See the .coef_ attribute of LogisticRegression.

    Params:
      clf.....LogisticRegression classifier
      label...1 or 0; if 1, return the top coefficients
              for the positive class; else for negative.
      n.......The number of coefficients to return.
      vocab...Dict from feature name to column index.
    Returns:
      List of (feature_name, coefficient) tuples, SORTED
      in descending order of the coefficient for the
      given class label.
    """
    ###TODO
    pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号