MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / train

Method train

nodedb-vector/src/rerank/codecs/sq8.rs:130–138  ·  view source on GitHub ↗

Calibrate from a sample of vectors. Replaces the current codec state. Requires at least one sample.

(&mut self, samples: &[&[f32]])

Source from the content-addressed store, hash-verified

128 ///
129 /// Replaces the current codec state. Requires at least one sample.
130 fn train(&mut self, samples: &[&[f32]]) -> Result<(), RerankError> {
131 if samples.is_empty() {
132 return Err(RerankError::BadInput(
133 "sq8 train: empty sample set".to_string(),
134 ));
135 }
136 self.codec = Sq8Codec::calibrate(samples, self.dim);
137 Ok(())
138 }
139}
140
141// ── Tests ─────────────────────────────────────────────────────────────────────

Callers 2

trained_codecFunction · 0.45

Calls 2

to_stringMethod · 0.80
is_emptyMethod · 0.45

Tested by 1