Skip to main content

sphereql_embed/
lib.rs

1//! Vector embedding projection engine.
2//!
3//! Projects high-dimensional embeddings onto S² via one of several
4//! projection families (PCA, kernel PCA, Laplacian eigenmap, UMAP)
5//! and offers a query pipeline for k-NN search, similarity thresholds,
6//! concept paths, glob detection, local manifold fitting, and a
7//! category-level enrichment layer (inter-category graph, bridge
8//! detection with `Genuine`/`OverlapArtifact`/`Weak` classification,
9//! inner spheres, hierarchical concept paths, domain-group routing
10//! for low-EVR regimes).
11//!
12//! On top of that, the crate ships a **metalearning framework**:
13//!
14//! - [`config`] — a single [`PipelineConfig`] hierarchy for every
15//!   tunable constant.
16//! - [`quality_metric`] — a [`QualityMetric`] trait plus four concrete
17//!   metrics (territorial health, bridge coherence, cluster silhouette,
18//!   graph modularity) and composite presets.
19//! - [`tuner`] — [`auto_tune`] over a discrete [`SearchSpace`] with
20//!   Grid / Random / Bayesian (TPE-lite) strategies. Projection kind
21//!   is a first-class tuner axis.
22//! - [`corpus_features`] — a 10-feature corpus profile suitable as
23//!   input to a meta-model.
24//! - [`meta_model`] — [`MetaTrainingRecord`] with an on-disk store
25//!   under `~/.sphereql/meta_records.json`, the [`MetaModel`] trait,
26//!   and two concrete implementations ([`NearestNeighborMetaModel`],
27//!   [`DistanceWeightedMetaModel`]).
28//! - [`feedback`] — per-query user-satisfaction primitives
29//!   ([`FeedbackEvent`] + [`FeedbackAggregator`]) for L3 online
30//!   refinement of stored records.
31//!
32//! See [`SphereQLPipeline::new_with_config`],
33//! [`SphereQLPipeline::new_from_metamodel`], and
34//! [`SphereQLPipeline::new_from_metamodel_tuned`] for the
35//! tune-or-recall entry points.
36
37pub mod ann;
38pub mod category;
39pub mod confidence;
40pub mod config;
41pub mod configured_projection;
42pub mod corpus_features;
43pub mod corpus_quality;
44pub mod domain_groups;
45pub mod feedback;
46pub mod kernel_pca;
47pub mod laplacian;
48pub mod logical_confidence;
49pub mod mapper;
50pub mod meta_model;
51pub mod navigator;
52pub mod pipeline;
53pub mod projection;
54pub mod quality_metric;
55pub mod query;
56pub mod self_tune;
57pub mod spatial_quality;
58pub mod text_embedder;
59pub mod tuner;
60pub mod types;
61pub mod umap;
62pub mod util;
63
64pub use category::*;
65pub use confidence::*;
66pub use config::*;
67pub use configured_projection::*;
68pub use corpus_features::*;
69pub use corpus_quality::*;
70pub use domain_groups::*;
71pub use feedback::*;
72pub use kernel_pca::*;
73pub use laplacian::*;
74pub use logical_confidence::*;
75pub use mapper::*;
76pub use meta_model::*;
77pub use navigator::*;
78pub use pipeline::*;
79pub use projection::*;
80pub use quality_metric::*;
81pub use query::*;
82pub use self_tune::*;
83pub use spatial_quality::*;
84pub use text_embedder::*;
85pub use tuner::*;
86pub use types::*;
87// `umap::*` would re-export `UmapConfig`, clashing with the tunable
88// `config::UmapConfig`. Expose only the public projection type; callers
89// who want the fitter-internal `UmapConfig` reach for `umap::UmapConfig`
90// directly.
91pub use umap::UmapSphereProjection;
92pub use util::*;