Crate sevensense_learning

Crate sevensense_learning 

Source
Expand description

§sevensense-learning

Graph Neural Network (GNN) based learning and embedding refinement for 7sense.

This crate provides:

  • GNN models (GCN, GraphSAGE, GAT) for graph-based learning
  • Embedding refinement through message passing
  • Contrastive learning with InfoNCE and triplet loss
  • Elastic Weight Consolidation (EWC) for continual learning
  • Graph attention mechanisms for relationship modeling

§Architecture

The crate follows Domain-Driven Design principles:

  • domain: Core entities and repository traits
  • application: Business logic and services
  • infrastructure: GNN implementations and attention mechanisms

§Example

use sevensense_learning::{LearningService, LearningConfig, GnnModelType};

let config = LearningConfig::default();
let service = LearningService::new(config);

// Train on transition graph
let metrics = service.train_epoch(&graph).await?;

// Refine embeddings
let refined = service.refine_embeddings(&embeddings).await?;

Re-exports§

pub use domain::entities::LearningSession;
pub use domain::entities::GnnModelType;
pub use domain::entities::TrainingStatus;
pub use domain::entities::TrainingMetrics;
pub use domain::entities::TransitionGraph;
pub use domain::entities::RefinedEmbedding;
pub use domain::entities::EmbeddingId;
pub use domain::entities::Timestamp;
pub use domain::entities::GraphNode;
pub use domain::entities::GraphEdge;
pub use domain::entities::HyperParameters;
pub use domain::entities::LearningConfig;
pub use domain::repository::LearningRepository;
pub use application::services::LearningService;
pub use infrastructure::gnn_model::GnnModel;
pub use infrastructure::gnn_model::GnnLayer;
pub use infrastructure::gnn_model::Aggregator;
pub use infrastructure::attention::AttentionLayer;
pub use infrastructure::attention::MultiHeadAttention;
pub use loss::info_nce_loss;
pub use loss::triplet_loss;
pub use loss::margin_ranking_loss;
pub use loss::contrastive_loss;
pub use ewc::EwcState;
pub use ewc::FisherInformation;
pub use ewc::EwcRegularizer;

Modules§

application
Application layer for the learning bounded context.
domain
Domain layer for the learning bounded context.
ewc
Elastic Weight Consolidation (EWC) for continual learning.
infrastructure
Infrastructure layer for the learning bounded context.
loss
Loss functions for contrastive learning.
prelude
Prelude module for convenient imports

Constants§

VERSION
Crate version information