Skip to contents

Maps new data points into an existing SONG embedding by assigning each point to its nearest coding vector and returning that coding vector's embedding coordinates. This does not train or mutate the model. Multiple points assigned to one prototype have identical coordinates; these coordinates are not physical locations or evidence of contact.

Usage

# S3 method for class 'song_model'
predict(object, newdata, ..., feature_manifest = NULL)

Arguments

object

A trained "song_model" object.

newdata

Numeric matrix of new data (n_new x D). A single observation is accepted as a one-row matrix or data frame.

...

Ignored.

feature_manifest

The unchanged manifest supplied at training, if any. Named features must follow training order. See song() for the contract.

Value

A numeric matrix (n_new x d) of embedding coordinates.

References

Senanayake, D. A., Wang, W., Naik, S. H., & Halgamuge, S. (2021). Self-Organizing Nebulous Growths for Robust and Incremental Data Visualization. IEEE Transactions on Neural Networks and Learning Systems, 32(10), 4588–4602. doi:10.1109/TNNLS.2020.3023941

Examples

model <- song(as.matrix(iris[1:120, 1:4]), epochs = 5L, seed = 42)
#> Epoch 1/5 | CVs: 3 | QE: 1.4789 | so_lr: 1.0000 | lr: 1.0000
#> Epoch 2/5 | CVs: 5 | QE: 0.8328 | so_lr: 0.8187 | lr: 0.8000
#> Epoch 3/5 | CVs: 9 | QE: 0.5362 | so_lr: 0.4493 | lr: 0.6000
#> Epoch 4/5 | CVs: 16 | QE: 0.4402 | so_lr: 0.1653 | lr: 0.4000
#> Epoch 5/5 | CVs: 24 | QE: 0.3847 | so_lr: 0.0408 | lr: 0.2000
#> Running UMAP dispersion step...
new_coords <- predict(model, newdata = as.matrix(iris[121:150, 1:4]))