|
QDpy
|
Learn a linear map using a squared-Euclidean triplet margin. More...
Public Member Functions | |
| fit (self, raw_features, triplets, *, steps=128, batch_size=32, learning_rate=0.01, seed=0) | |
| Fit or fine-tune the map using an array of labelled indices. | |
| transform (self, raw_features) | |
| Apply the same projection to one vector or a matrix of row vectors. | |
Learn a linear map using a squared-Euclidean triplet margin.
Project fixed-width raw features into a lower-dimensional space. For each labelled triplet, fit a linear map so the anchor is closer to the preferred point than to the other point by at least the margin. Distances in the training loss are squared Euclidean distances. :param raw_feature_size: Number of input coordinates after feature extraction. :param descriptor_size: Number of learned descriptor coordinates. :param margin: Positive target gap between squared distances. :param seed: Seed for the initial projection.
| qdpy.algorithms.qdhf.TripletProjector.fit | ( | self, | |
| raw_features, | |||
| triplets, | |||
| * | , | ||
| steps = 128, | |||
| batch_size = 32, | |||
| learning_rate = 0.01, | |||
| seed = 0 ) |
Fit or fine-tune the map using an array of labelled indices.
Use Adam on the triplet hinge loss and return the fitted projector. Each row of ``triplets`` gives three distinct row indices into ``raw_features``: anchor, preferred neighbor, other candidate. Training starts with the current projection and independent Adam moments. Commit the updated weights only after a finite fit.
Reimplemented in qdpy.algorithms.divhf.DivHFProjector.
| qdpy.algorithms.qdhf.TripletProjector.transform | ( | self, | |
| raw_features ) |