E - Type of object whose features are extractedpublic class CacheFeatureExtractor<E> extends FeatureExtractorFilter<E> implements Serializable
CacheFeatureExtractor uses a cache to store a mapping from
objects to their feature vector maps.
Elements will be stored in the cache and looked up in the cache
using the standard map methods put() and get(). It
is up to the map to remove elements.
Thread Safety
A cached feature extractor will be thread safe if its contained
cache is thread safe. A map may be made thread safe by wrapping it
with synchronization. There are more live thread-safe maps in Java
from the util.concurrent package. The FastCache and HardFastCache are also both thread safe. The only
methods of the map accessed by this class are the put and get
methods.
Serialization
A cached feature extractor will be serializable if its contained
map and contained feature extractor are serializable. The current
values in the cache will be included in the serialized value. To
prevent serializing values, clear the cache before serializing it
(the cache is accessible through the cache() method. The
fast cache and most of Java's map implementations are serializable.
| Constructor and Description |
|---|
CacheFeatureExtractor(FeatureExtractor<? super E> extractor,
Map<E,Map<String,? extends Number>> cache)
Construct a cached feature extractor that caches the
results of the specified extractor using the specified cache.
|
| Modifier and Type | Method and Description |
|---|---|
Map<E,Map<String,? extends Number>> |
cache()
Returns the cache for this cached feature extractor.
|
Map<String,? extends Number> |
features(E in)
Return the features extracted by the contained feature
extractor.
|
baseExtractorpublic CacheFeatureExtractor(FeatureExtractor<? super E> extractor, Map<E,Map<String,? extends Number>> cache)
extractor - Extractor to use to extract feature vectors.cache - Cache in which to store extracted vectors.public Map<E,Map<String,? extends Number>> cache()
public Map<String,? extends Number> features(E in)
FeatureExtractorFilterfeatures in interface FeatureExtractor<E>features in class FeatureExtractorFilter<E>in - Input to be converted to a feature vector.Copyright © 2016 Alias-i, Inc.. All rights reserved.