K
- Type of keys in upstream.V
- Type of values in upstream.C
- Type of "coordinate" - index of feature value in upstream object.L
- Type of label for resulting vectors.public abstract class Vectorizer<K,V,C extends Serializable,L> extends Object implements FeatureLabelExtractor<K,V,L>
BinaryObject
can be upstream
object and coordinates for them are names of fields with double-values.Modifier and Type | Class and Description |
---|---|
static class |
Vectorizer.LabelCoordinate
Shotrcuts for coordinates in feature vector.
|
static class |
Vectorizer.VectorizerAdapter<K,V,C extends Serializable,L>
Utility class for convenient overridings.
|
Constructor and Description |
---|
Vectorizer(C... coords)
Creates an instance of Vectorizer.
|
Modifier and Type | Method and Description |
---|---|
protected abstract List<C> |
allCoords(K key,
V value)
Returns list of all coordinate with feature values.
|
LabeledVector<L> |
apply(K key,
V value)
Extracts labeled vector from upstream object.
|
protected Vector |
createVector(int size)
Create an instance of vector.
|
Vectorizer<K,V,C,L> |
exclude(C... coords)
Exclude these coordinates from result vector.
|
LabeledVector<L> |
extract(K k,
V v)
Extract
LabeledVector from key and value. |
protected abstract Serializable |
feature(C coord,
K key,
V value)
Extracts feature value by given coordinate.
|
protected abstract L |
label(C coord,
K key,
V value)
Extract label value by given coordinate.
|
Vectorizer<K,V,C,L> |
labeled(C labelCoord)
Sets label coordinate for Vectorizer.
|
Vectorizer<K,V,C,L> |
labeled(Vectorizer.LabelCoordinate labelCoord)
Sets label coordinate for Vectorizer.
|
protected abstract L |
zero()
Returns default label value for unlabeled data.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
extractFeatures, extractLabel
map
andThen
andThen
public Vectorizer(C... coords)
coords
- Coordinates for feature extraction. If array is empty then Vectorizer will extract all fields from
upstream object.public LabeledVector<L> apply(K key, V value)
apply
in interface BiFunction<K,V,LabeledVector>
key
- Key.value
- Value.public Vectorizer<K,V,C,L> labeled(C labelCoord)
labelCoord
- Label coordinate.public Vectorizer<K,V,C,L> labeled(Vectorizer.LabelCoordinate labelCoord)
labelCoord
- Label coordinate.public Vectorizer<K,V,C,L> exclude(C... coords)
coords
- Coordinates.public LabeledVector<L> extract(K k, V v)
LabeledVector
from key and value.extract
in interface FeatureLabelExtractor<K,V,L>
k
- Key.v
- Value.protected abstract Serializable feature(C coord, K key, V value)
coord
- Coordinate.key
- Key.value
- Value.protected abstract L label(C coord, K key, V value)
coord
- Coordinate.key
- Key.value
- Value.protected abstract L zero()
protected abstract List<C> allCoords(K key, V value)
key
- Key.value
- Value.protected Vector createVector(int size)
size
- Vector size.
GridGain In-Memory Computing Platform : ver. 8.9.15 Release Date : December 3 2024