Packages

c

com.linkedin.feathr.common

FeatureValue

class FeatureValue extends Serializable with KryoSerializable

Describes the basic representation of a feature value in Feathr. This is the OLD FeatureValue API. Feathr is migrating to a new FeatureValue API defined at com.linkedin.feathr.common.value.FeatureValue. This implementation of the old API is a wrapper around the new API, with lots of glue to maintain compatibility.

SERIALIZATION: For use with Spark RDD API, this class is serializable both by Java Object Serialization and by Kryo. Note that because the serialized representation is based on NTV (name-term-value), serialization will NOT work for tensor features having rank greater than 1.

MUTABILITY: For legacy compatibility, instances of this class are mutable under the following conditions:

  1. When constructed with zero-argument constructor 2. When constructed with Map<String,Float> constructor 3. When constructed specifically as a term-vector using any createStringTermVector factory methods 4. When deserialized with Kryo or Java-Object Serialization When mutable, instances may be mutated by:
  2. Using modifier methods the Map objects returned by .getValue or .getAsTermVector 2. Using modifier methods on ._value public member field. 3. Using the .put method. All mutability support in FeatureValue is DEPRECATED.

NOTE: This class will be deprecated soon in favor of com.linkedin.feathr.common.value.FeatureValue

Linear Supertypes
KryoSerializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. FeatureValue
  2. KryoSerializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new FeatureValue(tensor: TypedTensor)

    Constructor to create FeatureValue with a tensor object

    Constructor to create FeatureValue with a tensor object

    tensor

    TypedTensor

    Exceptions thrown

    NullPointerException if tensor parameter is null

  2. new FeatureValue(featureValueInternal: value.FeatureValue)
    Annotations
    @VisibleForTesting()
  3. new FeatureValue(value: Map[String, Float])

    Annotations
    @Deprecated
    Deprecated
  4. new FeatureValue(value: Any, type: FeatureTypes)

    Annotations
    @Deprecated
    Deprecated
  5. new FeatureValue()

    Annotations
    @Deprecated
    Deprecated
  6. new FeatureValue(value: Any)

    Annotations
    @Deprecated
    Deprecated

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(o: Any): Boolean
    Definition Classes
    FeatureValue → AnyRef → Any
    Annotations
    @Override()
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. def getAsBoolean(): Boolean

    Get feature value as boolean

    Get feature value as boolean

    returns

    boolean value

    Exceptions thrown

    RuntimeException if this is not a valid boolean feature

  10. def getAsCategorical(): String

    Returns the single categorical value associated with the feature

    Returns the single categorical value associated with the feature

    Note: this method will return String even if the feature was created using FeatureValue#createCategorical(Number) because categorical are meant to contain only discrete values which are represented by String

    returns

    the categorical term as a String

    Exceptions thrown

    RuntimeException if this is not a valid categorical feature

  11. def getAsNumeric(): Float

    get feature value as number

    get feature value as number

    returns

    number value

    Exceptions thrown

    RuntimeException if this is not a valid numeric feature

  12. def getAsTensorData(): TensorData

    returns

    a Quince TensorData representation of this feature value

  13. def getAsTermVector(): Map[String, Float]

    Gets the feature in an NTV term-vector representation.

    Gets the feature in an NTV term-vector representation.

    returns

    Map from String term names to Float values

    Exceptions thrown

    RuntimeException if the feature is a tensor of rank greater than 1, then this feature cannot be represented as an NTV term vector

  14. def getAsTypedTensor(): TypedTensor

    returns

    a Quince TypedTensor representation of this feature value

  15. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. def getFeatureType(): FeatureType
  17. def hashCode(): Int
    Definition Classes
    FeatureValue → AnyRef → Any
    Annotations
    @Override()
  18. def isEmpty(): Boolean

    Check if the FeatureValue is empty or not.

    Check if the FeatureValue is empty or not. When it's empty, it return true; otherwise false. Emptiness of FeatureValue is defined in the following way: 1. For tensor based features, empty means an tensor. 2. For legacy term vector based features, empty means an empty vector. Note: Since Boolean NTV feature false is equivalent to empty map, so it's false is considered as empty as well.

  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  23. def read(kryo: Kryo, input: Input): Unit
    Definition Classes
    FeatureValue → KryoSerializable
    Annotations
    @SuppressWarnings() @Override()
  24. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  25. def toString(): String
    Definition Classes
    FeatureValue → AnyRef → Any
    Annotations
    @Override()
  26. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  29. def write(kryo: Kryo, output: Output): Unit
    Definition Classes
    FeatureValue → KryoSerializable
    Annotations
    @Override()

Deprecated Value Members

  1. def getAsString(): String

    Gets a CATEGORICAL feature value represented as a string.

    Gets a CATEGORICAL feature value represented as a string.

    returns

    string value

    Annotations
    @Deprecated
    Deprecated
  2. def getNumTerms(): Int

    Get the number of terms in feature when interpreted as a term vector.

    Get the number of terms in feature when interpreted as a term vector.

    • For a numeric feature, this will always be 1
    • For a categorical feature, this will always be 1
    • For a categorical set feature, this will be the number of terms in the set
    • For any vector feature, it will be the number of explicitly present elements in the vector
    returns

    the number of terms in this feature

    Annotations
    @Deprecated
    Deprecated
    Exceptions thrown

    RuntimeException if this instance stores a tensor of rank greater than 1

  3. def getValue(): Map[String, Float]

    Annotations
    @Deprecated
    Deprecated
  4. def put(key: String, value: Float): Unit

    Modify a term-vector FeatureValue by adding a term-value mapping.

    Modify a term-vector FeatureValue by adding a term-value mapping. Mutability is only allowed under certain conditions, described in the class-level Javadoc.

    Annotations
    @Deprecated
    Deprecated
    Exceptions thrown

    RuntimeException if not mutable

  5. def size(): Int

    Annotations
    @Deprecated
    Deprecated
    Exceptions thrown

    RuntimeException if this instance stores a tensor of rank greater than 1

Inherited from KryoSerializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped