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:
- 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:
- 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
- Alphabetic
- By Inheritance
- FeatureValue
- KryoSerializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
FeatureValue(tensor: TypedTensor)
Constructor to create FeatureValue with a tensor object
Constructor to create FeatureValue with a tensor object
- tensor
- Exceptions thrown
NullPointerExceptionif tensor parameter is null
-
new
FeatureValue(featureValueInternal: value.FeatureValue)
- Annotations
- @VisibleForTesting()
-
new
FeatureValue(value: Map[String, Float])
- Annotations
- @Deprecated
- Deprecated
-
new
FeatureValue(value: Any, type: FeatureTypes)
- Annotations
- @Deprecated
- Deprecated
-
new
FeatureValue()
- Annotations
- @Deprecated
- Deprecated
-
new
FeatureValue(value: Any)
- Annotations
- @Deprecated
- Deprecated
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(o: Any): Boolean
- Definition Classes
- FeatureValue → AnyRef → Any
- Annotations
- @Override()
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
getAsBoolean(): Boolean
Get feature value as boolean
Get feature value as boolean
- returns
boolean value
- Exceptions thrown
RuntimeExceptionif this is not a valid boolean feature
-
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
Stringeven if the feature was created usingFeatureValue#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
RuntimeExceptionif this is not a valid categorical feature
-
def
getAsNumeric(): Float
get feature value as number
get feature value as number
- returns
number value
- Exceptions thrown
RuntimeExceptionif this is not a valid numeric feature
-
def
getAsTensorData(): TensorData
- returns
a Quince TensorData representation of this feature value
-
def
getAsTermVector(): Map[String, Float]
Gets the feature in an NTV term-vector representation.
Gets the feature in an NTV term-vector representation.
- returns
MapfromStringterm names toFloatvalues
- Exceptions thrown
RuntimeExceptionif the feature is a tensor of rank greater than 1, then this feature cannot be represented as an NTV term vector
-
def
getAsTypedTensor(): TypedTensor
- returns
a Quince TypedTensor representation of this feature value
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getFeatureType(): FeatureType
-
def
hashCode(): Int
- Definition Classes
- FeatureValue → AnyRef → Any
- Annotations
- @Override()
-
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.
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
read(kryo: Kryo, input: Input): Unit
- Definition Classes
- FeatureValue → KryoSerializable
- Annotations
- @SuppressWarnings() @Override()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- FeatureValue → AnyRef → Any
- Annotations
- @Override()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
write(kryo: Kryo, output: Output): Unit
- Definition Classes
- FeatureValue → KryoSerializable
- Annotations
- @Override()
Deprecated Value Members
-
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
-
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
RuntimeExceptionif this instance stores a tensor of rank greater than 1
-
def
getValue(): Map[String, Float]
- Annotations
- @Deprecated
- Deprecated
-
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
RuntimeExceptionif not mutable
-
def
size(): Int
- Annotations
- @Deprecated
- Deprecated
- Exceptions thrown
RuntimeExceptionif this instance stores a tensor of rank greater than 1