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

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

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

origin: jpmml/jpmml-sklearn

public Apply encodeApply(String function, Feature feature, int index, String term){
  Constant constant = PMMLUtil.createConstant(term, DataType.STRING);
  return PMMLUtil.createApply(function, feature.ref(), constant);
}
origin: jpmml/jpmml-r

  static
  private Apply createHingeFunction(int dir, Feature feature, double cut){
    Expression expression;

    switch(dir){
      case -1:
        expression = PMMLUtil.createApply("-", PMMLUtil.createConstant(cut), feature.ref());
        break;
      case 1:
        expression = PMMLUtil.createApply("-", feature.ref(), PMMLUtil.createConstant(cut));
        break;
      default:
        throw new IllegalArgumentException();
    }

    return PMMLUtil.createApply("max", expression, PMMLUtil.createConstant(0d));
  }
}
origin: jpmml/jpmml-sklearn

@Override
public List<Feature> encodeFeatures(List<Feature> features, SkLearnEncoder encoder){
  String function = getFunction();
  if(features.size() <= 1){
    return features;
  }
  Apply apply = new Apply(translateFunction(function));
  for(Feature feature : features){
    apply.addExpressions(feature.ref());
  }
  FieldName name = FeatureUtil.createName(function, features);
  DerivedField derivedField = encoder.createDerivedField(name, OpType.CONTINUOUS, DataType.DOUBLE, apply);
  return Collections.singletonList(new ContinuousFeature(encoder, derivedField));
}
origin: jpmml/jpmml-sparkml

  @Override
  public List<Feature> encodeFeatures(SparkMLEncoder encoder){
    Tokenizer transformer = getTransformer();

    Feature feature = encoder.getOnlyFeature(transformer.getInputCol());

    Apply apply = PMMLUtil.createApply("lowercase", feature.ref());

    DerivedField derivedField = encoder.createDerivedField(FeatureUtil.createName("lowercase", feature), OpType.CATEGORICAL, DataType.STRING, apply);

    return Collections.singletonList(new DocumentFeature(encoder, derivedField, "\\s+"));
  }
}
origin: jpmml/jpmml-sklearn

Apply apply = PMMLUtil.createApply("lowercase", feature.ref());
origin: jpmml/jpmml-sparkml

public Apply createApply(){
  DefineFunction defineFunction = getDefineFunction();
  Feature feature = getFeature();
  String value = getValue();
  Constant constant = PMMLUtil.createConstant(value, DataType.STRING);
  return PMMLUtil.createApply(defineFunction.getName(), feature.ref(), constant);
}
origin: jpmml/jpmml-sklearn

Apply apply = PMMLUtil.createApply("if", PMMLUtil.createApply("equal", feature.ref(), PMMLUtil.createConstant(value, feature.getDataType())), PMMLUtil.createConstant(posLabel), PMMLUtil.createConstant(negLabel));
origin: jpmml/jpmml-r

@Override
public void addFeature(Feature feature){
  FieldName name = FeatureUtil.getName(feature);
  DataField dataField = getDataField(name);
  if(dataField != null){
    Expression expression = feature.ref();
    Expression transformedExpression = encodeExpression(name, expression);
    if(!(expression).equals(transformedExpression)){
      DerivedField derivedField = createDerivedField(FieldName.create("preProcess(" + name.getValue() + ")"), OpType.CONTINUOUS, DataType.DOUBLE, transformedExpression);
      feature = new ContinuousFeature(PreProcessEncoder.this, derivedField);
    }
  }
  super.addFeature(feature);
}
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: jpmml/jpmml-sparkml

  @Override
  public List<Feature> encodeFeatures(SparkMLEncoder encoder){
    RegexTokenizer transformer = getTransformer();

    if(!transformer.getGaps()){
      throw new IllegalArgumentException("Expected splitter mode, got token matching mode");
    } // End if

    if(transformer.getMinTokenLength() != 1){
      throw new IllegalArgumentException("Expected 1 as minimum token length, got " + transformer.getMinTokenLength() + " as minimum token length");
    }

    Feature feature = encoder.getOnlyFeature(transformer.getInputCol());

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

    if(transformer.getToLowercase()){
      Apply apply = PMMLUtil.createApply("lowercase", feature.ref());

      field = encoder.createDerivedField(FeatureUtil.createName("lowercase", feature), OpType.CATEGORICAL, DataType.STRING, apply);
    }

    return Collections.singletonList(new DocumentFeature(encoder, field, transformer.getPattern()));
  }
}
origin: jpmml/jpmml-sklearn

return feature.ref();
origin: jpmml/jpmml-sparkml

case "keep":
    Apply setApply = PMMLUtil.createApply("isIn", feature.ref());
    Apply apply = PMMLUtil.createApply("if", setApply, feature.ref(), PMMLUtil.createConstant(invalidCategory, dataType));
origin: jpmml/jpmml-sklearn

apply.addExpressions(feature.ref());
origin: jpmml/jpmml-sklearn

Expression expression = feature.ref();
expression = PMMLUtil.createApply("if", expression, PMMLUtil.createConstant(replacementValue, feature.getDataType()), feature.ref());
org.jpmml.converterFeatureref

Popular methods of Feature

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

Popular in Java

  • Updating database using SQL prepared statement
  • startActivity (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onCreateOptionsMenu (Activity)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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