classifies a flower against the current SOM species classifier: the one embedded in the wasm binary until train()/fineTune()/loadSOM() replace it.
stringified json
conditions this flower's stats are computed under; need not match the one the classifier was trained under (see fe::Environment).
the best-matching node and the distance to it, or null if the genome is malformed or its DNA is unusable (not an error; a malformed classifierJson/environment still rejects).
classifies a whole batch of flowers in one wasm call (the classifier is parsed once, unlike classify() per flower), e.g. to migrate a saved collection.
stringified {"Generation": [...]}, the same
shape train()/fineTune() take.
see classify().
one entry per input flower, in order: the match, or null if that flower's genome is malformed/unusable (not an error).
classifies feature vectors from extractFeatures() with the current classifier, no rendering.
one entry per input entry: the match, or null for a null/unusable vector.
returns a GLTF string of the flower, it uses the params inside genome.
returns a GLTF string of the flower (with normals and emissive textures), it uses the params inside genome.
it drawn the flower from the given genome.
stringified json
flower from the given genome.
it drawns the petal layer from the given genome.(no stem)
stringified json
layer to draw
flower - petal from specified layer
it drawns the petals from the given genome. (no stem)
stringified json
flower petals
measures how well the current classifier fits a batch of flowers: mean quantization error plus how the flowers spread over the nodes. Look at both when judging convergence, the error can look flat while the load is still being redistributed.
stringified {"Generation": [...]}.
see classify().
evaluate() over feature vectors from extractFeatures() (null entries are dropped).
extracts the feature vector of every flower of a batch, once. Rendering is the expensive part of classifying, evaluating or fine-tuning and wasm calls keep no state, so a caller running several steps over the same flowers (e.g. one fine-tuning epoch per call, to show progress) extracts once and passes the vectors (about 1.4 KB as JSON against ~17 KB for a genome) to classifyFeatures()/ evaluateFeatures()/fineTuneFeatures(). Hold them for the length of such a run, not with the stored flowers.
stringified {"Generation": [...]}.
see classify(); the vectors depend on it.
one entry per input flower, in order: its vector, or null if the genome is malformed/unusable.
fine-tunes the current classifier (the embedded default, or one trained or loaded earlier) on a new batch and makes the result the current one (see getSOM()).
stringified {"Generation": [...]}, see train().
conditions THIS batch was grown under -- not necessarily what the currently-loaded classifier was originally trained under (see fe::Environment).
how many additional epochs to train for.
starting learning rate for this fine-tuning run.
starting neighborhood radius for this run.
fineTune() over feature vectors from extractFeatures() (null entries are dropped); replaces the current classifier like fineTune() does. To report progress run ONE decay in steps: call it once per epoch (or per few epochs) with the same baseLR/baseRadius/totalEpochs and epochOffset = epochs done so far.
epochs to run in this call.
epochs of the decay already done by earlier calls, 0 for the first.
epochs of the whole decay, 0 means epochOffset + epochs.
the short git commit hash this wasm binary was built from, or "unknown" for a build outside a git checkout.
gets the flower stats.
stringified json
0.0 to 1.0
degrees, same scale as the returned min/maxTemperature
meters above sea level
terrain type id
gets the currents parameters
the classifier embedded in the wasm binary, as-is -- what classify() uses until train()/fineTune()/loadSOM() replace it (see getSOM()).
the semver this wasm binary was built from, e.g. "4.0.0". Same value as this package's own package.json "version".
getVersion() + "+" + getCommitHash(), e.g. "4.0.0+a1b2c3d".
function to load wasm module.
replaces the current classifier with one supplied directly, e.g. saved earlier via getSOM() or fetched as its own asset. Pure JS state: the JSON is not parsed or validated until the next classify()/fineTune(), so this works before init().
stringified FlowerClassifier.toJson()
returns a GLTF string of the flower.
GLTF file string
returns a GLTF string of the flower (with normals and emissive textures).
GLTF file string
it makes the petal for the specified layer. (no stem)
flower, only petal in layer
it mutates the given flower genome.
genome from original flower.
flower - the new mutated flower
it makes a child from two flower genomes.
genome for father
genome for mother
flower - child flower
trains a fresh SOM species classifier from a whole batch of flower genomes in one wasm call and makes it the current one (see getSOM()).
stringified {"Generation": [{"dna":...,"petals":...}, ...]} (the wire format used to move a flower collection between apps); entries that fail feature extraction are skipped and logged, not an error.
conditions this batch was grown under.
grid size + hyperparameters.
simple wrapper around fe wasm module.
Example