Tabnine Logo
Feature.getName
Code IndexAdd Tabnine to your IDE (free)

How to use
getName
method
in
org.jpmml.converter.Feature

Best Java code snippets using org.jpmml.converter.Feature.getName (Showing top 20 results out of 315)

origin: jpmml/jpmml-r

static
private String formatHingeFunction(int dir, Feature feature, double cut){
  switch(dir){
    case -1:
      return ("h(" + cut + " - " + (feature.getName()).getValue() + ")");
    case 1:
      return ("h(" + (feature.getName()).getValue() + " - " + cut + ")");
    default:
      throw new IllegalArgumentException();
  }
}
origin: jpmml/jpmml-sparkml

public void putFeatures(String column, List<Feature> features){
  List<Feature> existingFeatures = this.columnFeatures.get(column);
  if(existingFeatures != null && existingFeatures.size() > 0){
    if(features.size() != existingFeatures.size()){
      throw new IllegalArgumentException("Expected " + existingFeatures.size() + " features, got " + features.size() + " features");
    }
    for(int i = 0; i < existingFeatures.size(); i++){
      Feature existingFeature = existingFeatures.get(i);
      Feature feature = features.get(i);
      if(!(feature.getName()).equals(existingFeature.getName())){
        throw new IllegalArgumentException();
      }
    }
  }
  this.columnFeatures.put(column, features);
}
origin: jpmml/jpmml-sklearn

@Override
protected List<String> formatColumns(List<Feature> features){
  List<String> result = new ArrayList<>();
  for(Feature feature : features){
    FieldName name = feature.getName();
    result.add("data:" + XMLUtil.createTagName(name.getValue()));
  }
  if(result.contains("data:output")){
    throw new IllegalArgumentException();
  }
  result.add("data:output");
  return result;
}
origin: jpmml/jpmml-r

public Double getCoefficient(Feature feature, RDoubleVector coefficients){
  FieldName name = feature.getName();
  if(feature instanceof HasDerivedName){
    BiMap<Feature, FieldName> inverseFeatures = this.features.inverse();
    name = inverseFeatures.get(feature);
  }
  return coefficients.getValue(name.getValue());
}
origin: jpmml/jpmml-sklearn

public void renameFeature(Feature feature, FieldName renamedName){
  FieldName name = feature.getName();
  DerivedField derivedField = removeDerivedField(name);
  try {
    Field field = Feature.class.getDeclaredField("name");
    if(!field.isAccessible()){
      field.setAccessible(true);
    }
    field.set(feature, renamedName);
  } catch(ReflectiveOperationException roe){
    throw new RuntimeException(roe);
  }
  derivedField.setName(renamedName);
  addDerivedField(derivedField);
}
origin: jpmml/jpmml-sklearn

public Feature getFeature(FieldName name){
  List<? extends Feature> features = getFeatures();
  for(Feature feature : features){
    if((feature.getName()).equals(name)){
      return feature;
    }
  }
  throw new IllegalArgumentException(name.getValue());
}
origin: jpmml/jpmml-sklearn

@Override
public List<Feature> encodeFeatures(List<Feature> features, SkLearnEncoder encoder){
  List<?> classes = getClasses();
  ClassDictUtil.checkSize(1, features);
  Feature feature = features.get(0);
  List<String> inputCategories = new ArrayList<>();
  List<String> outputCategories = new ArrayList<>();
  for(int i = 0; i < classes.size(); i++){
    inputCategories.add(ValueUtil.formatValue(classes.get(i)));
    outputCategories.add(ValueUtil.formatValue(i));
  }
  Supplier<MapValues> mapValuesSupplier = () -> {
    encoder.toCategorical(feature.getName(), inputCategories);
    return PMMLUtil.createMapValues(feature.getName(), inputCategories, outputCategories);
  };
  DerivedField derivedField = encoder.ensureDerivedField(FeatureUtil.createName("label_encoder", feature), OpType.CATEGORICAL, DataType.INTEGER, mapValuesSupplier);
  Feature encodedFeature = new CategoricalFeature(encoder, derivedField, outputCategories);
  Feature result = new CategoricalFeature(encoder, feature, inputCategories){
    @Override
    public ContinuousFeature toContinuousFeature(){
      return encodedFeature.toContinuousFeature();
    }
  };
  return Collections.singletonList(result);
}
origin: jpmml/jpmml-sparkml

encoder.toCategorical(feature.getName(), categories);
MapValues mapValues = PMMLUtil.createMapValues(feature.getName(), categories, values);
origin: jpmml/jpmml-sklearn

String inputColumn = inputColumns.get(i);
mapValues.addFieldColumnPairs(new FieldColumnPair(feature.getName(), inputColumn));
origin: org.jpmml/jpmml-h2o

  static
  public Feature encodeFeature(Feature feature, Object replacementValue, MissingValueTreatmentMethod missingValueTreatmentMethod){
    ModelEncoder encoder = (ModelEncoder)feature.getEncoder();

    Field<?> field = feature.getField();

    if(field instanceof DataField){
      MissingValueDecorator missingValueDecorator = new MissingValueDecorator()
        .setMissingValueReplacement(ValueUtil.formatValue(replacementValue))
        .setMissingValueTreatment(missingValueTreatmentMethod);

      encoder.addDecorator(feature.getName(), missingValueDecorator);

      return feature;
    } else

    {
      throw new IllegalArgumentException();
    }
  }
}
origin: jpmml/jpmml-lightgbm

  .setImportance(importance);
encoder.addDecorator(feature.getName(), importanceDecorator);
origin: jpmml/jpmml-sklearn

encoder.toCategorical(feature.getName(), categories);
origin: jpmml/jpmml-sparkml

Field<?> field = encoder.getField(feature.getName());
  encoder.addDecorator(feature.getName(), missingValueDecorator);
} else
origin: jpmml/jpmml-sklearn

@Override
public List<Feature> encodeFeatures(List<Feature> features, SkLearnEncoder encoder){
  String function = getFunction();
  Boolean trimBlanks = getTrimBlanks();
  if(function == null && !trimBlanks){
    return features;
  }
  List<Feature> result = new ArrayList<>();
  for(Feature feature : features){
    Expression expression = feature.ref();
    if(function != null){
      expression = PMMLUtil.createApply(function, expression);
    } // End if
    if(trimBlanks){
      expression = PMMLUtil.createApply("trimBlanks", expression);
    }
    Field<?> field = encoder.toCategorical(feature.getName(), Collections.emptyList());
    // XXX: Should have been set by the previous transformer
    field.setDataType(DataType.STRING);
    DerivedField derivedField = encoder.createDerivedField(FeatureUtil.createName("normalize", feature), OpType.CATEGORICAL, DataType.STRING, expression);
    feature = new StringFeature(encoder, derivedField);
    result.add(feature);
  }
  return result;
}
origin: cheng-li/pyramid

static
private Predicate encodePredicate(Feature feature, Node node, boolean left){
  FieldName name = feature.getName();
  SimplePredicate.Operator operator;
  String value;
origin: jpmml/jpmml-sklearn

FieldName name = h2oFeature.getName();
origin: jpmml/jpmml-sklearn

return feature.getName();
origin: jpmml/jpmml-r

FieldName name = feature.getName();
origin: jpmml/jpmml-sklearn

FieldName name = feature.getName();
origin: jpmml/jpmml-sklearn

encoder.addDecorator(feature.getName(), missingValueDecorator);
org.jpmml.converterFeaturegetName

Popular methods of Feature

  • toContinuousFeature
  • getField
  • ref
  • getDataType
  • getEncoder
  • equals
  • hashCode
  • toStringHelper

Popular in Java

  • Making http post requests using okhttp
  • putExtra (Intent)
  • requestLocationUpdates (LocationManager)
  • getSystemService (Context)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Runner (org.openjdk.jmh.runner)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now