Class FeatureValues

java.lang.Object
com.linkedin.feathr.common.value.FeatureValues

public class FeatureValues extends Object
Utility functions for constructing FeatureValue instances. User code that produces FeatureValues, such as Anchor extractors (in yet-to-come new Anchor extractor API), should prefer to use these when creating FeatureValues, when possible.
  • Method Details

    • numeric

      public static NumericFeatureValue numeric(float floatValue)
      Returns a numeric feature value for a given float value
    • numeric

      public static NumericFeatureValue numeric(TensorData tensor)
      Returns a numeric feature value from a given tensor, which must be a numeric-scalar
    • bool

      public static BooleanFeatureValue bool(boolean booleanValue)
      Returns a boolean feature value for a given boolean primitive value. (We would have named this function "boolean" but that is not allowed since it's a Java keyword.)
    • bool

      public static BooleanFeatureValue bool(TensorData tensor)
      Returns a boolean feature value for a given tensor, which must be a boolean-scalar. (We would have named this function "boolean" but that is not allowed since it's a Java keyword.)
    • categorical

      public static CategoricalFeatureValue categorical(String stringValue)
      Returns a categorical feature value for a given string categorical value.
    • categorical

      public static CategoricalFeatureValue categorical(TensorData tensor)
      Returns a categorical feature for a given tensor value, assuming it is shaped as expected for a categorical feature.
    • categoricalSet

      public static CategoricalSetFeatureValue categoricalSet(Collection<String> strings)
      Returns a categorical set feature for a given collection of strings.
    • categoricalSet

      public static CategoricalSetFeatureValue categoricalSet(Set<String> strings)
      Returns a categorical set feature for a given set of strings.
    • categoricalSet

      public static CategoricalSetFeatureValue categoricalSet(String... strings)
      Returns a categorical set feature for a given list of String arguments.
    • emptyCategoricalSet

      public static CategoricalSetFeatureValue emptyCategoricalSet()
      Returns an empty categorical set.
    • categoricalSet

      public static CategoricalSetFeatureValue categoricalSet(TensorData tensorData)
      Returns a categorical feature for a given tensor value, assuming it is shaped as expected for a categorical set feature.
    • denseVectorDynamicSize

      public static DenseVectorFeatureValue denseVectorDynamicSize(float... floatArray)
      Returns a dense-vector feature value of unknown/dynamic size for a given list of float arguments.
    • denseVector

      public static DenseVectorFeatureValue denseVector(TensorData tensorData)
      Returns a dense-vector feature value for a given tensor, which must be a rank-1 tensor of value-type float.
    • termVector

      public static TermVectorFeatureValue termVector(Map<String,Float> termVector)
      Returns a term-vector feature value for a given term-vector map.
    • termVector

      public static TermVectorFeatureValue termVector(TensorData tensorData)
      Returns a term-vector feature value for a given tensor, which must be rank-1 and have numeric value type.
    • termVector

      public static TermVectorFeatureValue termVector(String t0, float v0)
      Returns a term-vector feature value with a single mapping, given by the term and value arguments.
    • termVector

      public static TermVectorFeatureValue termVector(String t0, float v0, String t1, float v1)
      Returns a term-vector feature value with 2 mappings, given by the term and value arguments.
    • termVector

      public static TermVectorFeatureValue termVector(String t0, float v0, String t1, float v1, String t2, float v2)
      Returns a term-vector feature value with 3 mappings, given by the term and value arguments.
    • emptyTermVector

      public static TermVectorFeatureValue emptyTermVector()
      Returns an empty term-vector feature value.