How to use the eli5.utils.mask function in eli5

To help you get started, we’ve selected a few eli5 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TeamHG-Memex / eli5 / eli5 / _feature_weights.py View on Github external
def _features(indices, feature_names, coef, x):
    names = mask(feature_names, indices)
    weights = mask(coef, indices)
    if x is not None:
        values = mask(x, indices)
        return [FeatureWeight(name, weight, value=value)
                for name, weight, value in zip(names, weights, values)]
    else:
        return [FeatureWeight(name, weight)
                for name, weight in zip(names, weights)]
github TeamHG-Memex / eli5 / eli5 / _feature_weights.py View on Github external
def _features(indices, feature_names, coef, x):
    names = mask(feature_names, indices)
    weights = mask(coef, indices)
    if x is not None:
        values = mask(x, indices)
        return [FeatureWeight(name, weight, value=value)
                for name, weight, value in zip(names, weights, values)]
    else:
        return [FeatureWeight(name, weight)
                for name, weight in zip(names, weights)]
github TeamHG-Memex / eli5 / eli5 / _feature_weights.py View on Github external
def _features(indices, feature_names, coef, x):
    names = mask(feature_names, indices)
    weights = mask(coef, indices)
    if x is not None:
        values = mask(x, indices)
        return [FeatureWeight(name, weight, value=value)
                for name, weight, value in zip(names, weights, values)]
    else:
        return [FeatureWeight(name, weight)
                for name, weight in zip(names, weights)]
github TeamHG-Memex / eli5 / eli5 / _feature_weights.py View on Github external
def get_top_features_filtered(x, flt_feature_names, flt_indices,
                              weights, top, scale=1.0):
    if flt_indices is not None:
        _x = mask(x, flt_indices)
        weights = mask(weights, flt_indices)
    else:
        _x = x
    return get_top_features(flt_feature_names, weights * scale, top, _x)