Пример #1
0
 def get_score_feature_weights(_label_id):
     _score, _feature_weights = scores_weights[_label_id]
     _x = x
     if flt_indices is not None:
         _x = mask(_x, flt_indices)
         _feature_weights = mask(_feature_weights, flt_indices)
     return _score, get_top_features(feature_names, _feature_weights, top,
                                     _x)
Пример #2
0
 def get_score_feature_weights(_label_id):
     _weights = _target_feature_weights(
         weight_dicts[_label_id],
         num_features=len(feature_names),
         bias_idx=feature_names.bias_idx,
     )
     _score = _get_score(weight_dicts[_label_id])
     _x = x
     if flt_indices is not None:
         _x = mask(_x, flt_indices)
         _weights = mask(_weights, flt_indices)
     return _score, get_top_features(flt_feature_names, _weights, top, _x)
Пример #3
0
 def _weights(label_id):
     scores = feature_weights[:, label_id]
     _x = x
     if flt_indices is not None:
         scores = scores[flt_indices]
         _x = mask(_x, flt_indices)
     return get_top_features(feature_names, scores, top, _x)
Пример #4
0
 def _weights(label_id):
     coef = get_coef(clf, label_id)
     _x = x
     scores = _multiply(_x, coef)
     if flt_indices is not None:
         scores = scores[flt_indices]
         _x = mask(_x, flt_indices)
     return get_top_features(feature_names, scores, top, _x)