gives the distance between example1 and example2 in the feature space defined by extractor.
represents an operator form of FeatureDistance that can be applied to a pair of examples.
Details and Options
- FeatureDistance can be used on many types of data, including numerical, textual, sounds, and images, as well as combinations of these.
- The extractor is typically a FeatureExtractorFunction object as generated by FeatureExtraction.
- FeatureDistance[extractor][ex1,ex2] is equivalent to FeatureDistance[ex1,ex2,extractor].
- The following options can be given:
DistanceFunction Automatic the distance to use in the feature space
- The option DistanceFunction can be any distance or dissimilarity function or a function f defining a distance between two values.
- For numeric feature vectors, the default setting is DistanceFunctionEuclideanDistance.
Examplesopen allclose all
Basic Examples (1)
Construct a dataset of dog images:
Train an extractor function from this dataset:
Compute the distance in the feature space between two images using FeatureDistance:
Generate an operator form of FeatureDistance:
This operator form can be used to compute distances:
Compute the distance matrix of the dataset using this feature distance:
Find the dog that maximizes its distance from the others in the feature space:
Train a feature extractor to compute term frequency-inverse document frequency vectors from texts:
Construct a feature distance for this feature extractor:
The distance function EuclideanDistance has been chosen. Use the option DistanceFunction to chose CosineDistance instead:
Wolfram Research (2016), FeatureDistance, Wolfram Language function, https://reference.wolfram.com/language/ref/FeatureDistance.html.
Wolfram Language. 2016. "FeatureDistance." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FeatureDistance.html.
Wolfram Language. (2016). FeatureDistance. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FeatureDistance.html