Package com.linkedin.feathr.common.value
Class FeatureValues
java.lang.Object
com.linkedin.feathr.common.value.FeatureValues
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 Summary
Modifier and TypeMethodDescriptionstatic BooleanFeatureValuebool(boolean booleanValue) Returns a boolean feature value for a given boolean primitive value.static BooleanFeatureValuebool(TensorData tensor) Returns a boolean feature value for a given tensor, which must be a boolean-scalar.static CategoricalFeatureValuecategorical(TensorData tensor) Returns a categorical feature for a given tensor value, assuming it is shaped as expected for a categorical feature.static CategoricalFeatureValuecategorical(String stringValue) Returns a categorical feature value for a given string categorical value.static CategoricalSetFeatureValuecategoricalSet(TensorData tensorData) Returns a categorical feature for a given tensor value, assuming it is shaped as expected for a categorical set feature.static CategoricalSetFeatureValuecategoricalSet(String... strings) Returns a categorical set feature for a given list of String arguments.static CategoricalSetFeatureValuecategoricalSet(Collection<String> strings) Returns a categorical set feature for a given collection of strings.static CategoricalSetFeatureValuecategoricalSet(Set<String> strings) Returns a categorical set feature for a given set of strings.static DenseVectorFeatureValuedenseVector(TensorData tensorData) Returns a dense-vector feature value for a given tensor, which must be a rank-1 tensor of value-type float.static DenseVectorFeatureValuedenseVectorDynamicSize(float... floatArray) Returns a dense-vector feature value of unknown/dynamic size for a given list of float arguments.static CategoricalSetFeatureValueReturns an empty categorical set.static TermVectorFeatureValueReturns an empty term-vector feature value.static NumericFeatureValuenumeric(float floatValue) Returns a numeric feature value for a given float valuestatic NumericFeatureValuenumeric(TensorData tensor) Returns a numeric feature value from a given tensor, which must be a numeric-scalarstatic TermVectorFeatureValuetermVector(TensorData tensorData) Returns a term-vector feature value for a given tensor, which must be rank-1 and have numeric value type.static TermVectorFeatureValuetermVector(String t0, float v0) Returns a term-vector feature value with a single mapping, given by the term and value arguments.static TermVectorFeatureValuetermVector(String t0, float v0, String t1, float v1) Returns a term-vector feature value with 2 mappings, given by the term and value arguments.static TermVectorFeatureValuetermVector(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.static TermVectorFeatureValuetermVector(Map<String, Float> termVector) Returns a term-vector feature value for a given term-vector map.
-
Method Details
-
numeric
Returns a numeric feature value for a given float value -
numeric
Returns a numeric feature value from a given tensor, which must be a numeric-scalar -
bool
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
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
Returns a categorical feature value for a given string categorical value. -
categorical
Returns a categorical feature for a given tensor value, assuming it is shaped as expected for a categorical feature. -
categoricalSet
Returns a categorical set feature for a given collection of strings. -
categoricalSet
Returns a categorical set feature for a given set of strings. -
categoricalSet
Returns a categorical set feature for a given list of String arguments. -
emptyCategoricalSet
Returns an empty categorical set. -
categoricalSet
Returns a categorical feature for a given tensor value, assuming it is shaped as expected for a categorical set feature. -
denseVectorDynamicSize
Returns a dense-vector feature value of unknown/dynamic size for a given list of float arguments. -
denseVector
Returns a dense-vector feature value for a given tensor, which must be a rank-1 tensor of value-type float. -
termVector
Returns a term-vector feature value for a given term-vector map. -
termVector
Returns a term-vector feature value for a given tensor, which must be rank-1 and have numeric value type. -
termVector
Returns a term-vector feature value with a single mapping, given by the term and value arguments. -
termVector
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
Returns an empty term-vector feature value.
-