Feature helper methods
195010
public IDbgpFeature getFeature(String name) throws DbgpException
	{
		IDbgpCoreCommands core = session.getCoreCommands();
		return core.getFeature(name);
	}
406483
def _select_features(example, feature_list=None):
  """"""
  feature_list = feature_list or ["inputs", "targets"]
  return {f: example[f] for f in feature_list}
1013314
def _BOW_FEATURE_EXTRACTOR(sf, target=None):
    
    if isinstance(sf, dict):
        out = _tc.SArray([sf]).unpack('')
    elif isinstance(sf, _tc.SFrame):
        out = sf.__copy__()
    else:
        raise ValueError("Unrecognized input to feature extractor.")
    for f in _get_str_columns(out):
        if target != f:
            out[f] = _tc.text_analytics.count_words(out[f])
    return out
891785
def to_feature(value):
  """"""
  if isinstance(value, FeatureConnector):
    return value
  elif utils.is_dtype(value):  # tf.int32, tf.string,...
    return Tensor(shape=(), dtype=tf.as_dtype(value))
  elif isinstance(value, dict):
    return FeaturesDict(value)
  else:
    raise ValueError('Feature not supported: {}'.format(value))
1189009
def >>(*args)
      args.to_a.flatten.each do |feature|
        features.delete feature.to_sym
      end
      self
    end
1125008
def get_feature_info(feature):
    """"""
    dimensions = feature.findall('position')
    for dim in dimensions:
        if dim.attrib['dim'] == '0':
            rt = dim.text
        elif dim.attrib['dim'] == '1':
            mz = dim.text
    return {'rt': float(rt), 'mz': float(mz),
            'charge': int(feature.find('charge').text),
            'intensity': float(feature.find('intensity').text),
            }
743690
def set_feature_generator(self):
        """"""
        self.features = preparation.build_proteintable(self.lookup,
                                                       self.headerfields,
                                                       self.mergecutoff,
                                                       self.isobaric,
                                                       self.precursor,
                                                       self.probability,
                                                       self.fdr, self.pep,
                                                       self.genecentric)
494732
void get_valency_features(final Context ctx,
                              final List<Integer> nr_left_children,
                              final List<Integer> nr_right_children,
                              List<Integer> features)
    {
        if (!use_valency)
        {
            return;
        }

        int lvc = 8;
        int rvc = 8;
        if (ctx.S0 >= 0)
        {
            lvc = math.binned_1_2_3_4_5_6_10[nr_left_children.get(ctx.S0)];
            rvc = math.binned_1_2_3_4_5_6_10[nr_right_children.get(ctx.S0)];
            if (lvc == 10)
            {
                lvc = 7;
            }
            if (rvc == 10)
            {
                rvc = 7;
            }
        }
        features.add(lvc + kValencyInFeaturespace);
        features.add(rvc + kValencyInFeaturespace);

        lvc = 8;
        rvc = 8;
        if (ctx.S1 >= 0)
        {
            lvc = math.binned_1_2_3_4_5_6_10[nr_left_children.get(ctx.S1)];
            rvc = math.binned_1_2_3_4_5_6_10[nr_right_children.get(ctx.S1)];
            if (lvc == 10)
            {
                lvc = 7;
            }
            if (rvc == 10)
            {
                rvc = 7;
            }
        }
        features.add(lvc + kValencyInFeaturespace);
        features.add(rvc + kValencyInFeaturespace);
    }
1092279
public void updateFeatures() {
	for (int i = 0; i < feaGen.features.size(); i++) {
	    Feature f = (Feature)feaGen.features.get(i);
	    f.wgt = lambda[f.idx];    
	}
    }
1134859
def predict(self, features):
        """"""

        # get distance of features to class clusters
        distances = [self._distance(x) for x in features]

        # assign class label belonging to smallest distance
        class_predict = [np.argmin(d) for d in distances]

        return self.le.inverse_transform(class_predict)
530234
def p_feature_soft(self, t):
        """"""

        t[0] = SoftFeatures(t[2], t[4], line=t.lineno(1))
457481
def maybe_reverse_features(self, feature_map):
    """"""
    if not self._was_reversed:
      return
    inputs = feature_map.pop("inputs", None)
    targets = feature_map.pop("targets", None)
    inputs_seg = feature_map.pop("inputs_segmentation", None)
    targets_seg = feature_map.pop("targets_segmentation", None)
    inputs_pos = feature_map.pop("inputs_position", None)
    targets_pos = feature_map.pop("targets_position", None)
    if inputs is not None:
      feature_map["targets"] = inputs
    if targets is not None:
      feature_map["inputs"] = targets
    if inputs_seg is not None:
      feature_map["targets_segmentation"] = inputs_seg
    if targets_seg is not None:
      feature_map["inputs_segmentation"] = targets_seg
    if inputs_pos is not None:
      feature_map["targets_position"] = inputs_pos
    if targets_pos is not None:
      feature_map["inputs_position"] = targets_pos
319838
def _solve_features(self, model_name, dependency_cache=None):
        
        features = self[model_name].features
        return list(self.extractor.solve(features, cache=dependency_cache))
236750
def _parse_features(features, new_names=False, rename_function=None, default_feature_type=None,
                        allowed_feature_types=None):
        
        return FeatureParser(features, new_names=new_names, rename_function=rename_function,
                             default_feature_type=default_feature_type, allowed_feature_types=allowed_feature_types)
29371
def _get_features(self, i, word, context, prev, prev2):
        '''
        '''
        def add(name, *args):
            features[' '.join((name,) + tuple(args))] += 1

        i += len(self.START)
        features = defaultdict(int)
        # It's useful to have a constant feature, which acts sort of like a prior
        add('bias')
        add('i suffix', word[-3:])
        add('i pref1', word[0])
        add('i-1 tag', prev)
        add('i-2 tag', prev2)
        add('i tag+i-2 tag', prev, prev2)
        add('i word', context[i])
        add('i-1 tag+i word', prev, context[i])
        add('i-1 word', context[i-1])
        add('i-1 suffix', context[i-1][-3:])
        add('i-2 word', context[i-2])
        add('i+1 word', context[i+1])
        add('i+1 suffix', context[i+1][-3:])
        add('i+2 word', context[i+2])
        return features
1363236
def normalize_features(features):
    """"""
    return (features - N.min(features)) / (N.max(features) - N.min(features))
182692
function (featureStringCommaSeparated) {
  var arrayFeatures = featureStringCommaSeparated
    .split(',')
    .filter(function (x) { return x.length })
    .map(function (x) { return x.replace(/[\*\/]/g, '') }); // Eliminate XSS vuln
  var arrayUnsupportedFeatures = [];
  for (var i = 0; i < arrayFeatures.length; i++) {
    var supportedFeature = true;
    var fullFeature = arrayFeatures[i];
    if (contains(fullFeature, "~")) {
      if (contains(fullFeature, "Intl.~locale")) {
        supportedFeature = checkIntlLocale(window, fullFeature);
      } else {
        console.warn('Feature ' + fullFeature + ' can not be detected because it has not JavaScript API.');
      }
    } else {
      // Get the feature and the container Object
      var featureString = fullFeature.substring(fullFeature.lastIndexOf('.') + 1);
      if (contains(featureString, "@@")) {
        console.warn('Feature ' + featureString + ' can not be detected because it depends on Symbol.');
      } else {
        var objectString = fullFeature.substring(0, fullFeature.lastIndexOf('.'));
        var object = getDescendantProp(window, objectString);
        if (object !== undefined) {
          //if ((object.hasOwnProperty(featureString)) === false) {
          if ((featureString in object) === false) {
            supportedFeature = false;
          }
        } else {
          supportedFeature = false;
        }
      }
    }
    // If the feature is not supported by the browser, then add it to polyfill it
    if (supportedFeature === false) {
      arrayUnsupportedFeatures.push(fullFeature);
    }
  }
  return arrayUnsupportedFeatures;
}