### Quick Start: Initialize and Update Engine Source: https://github.com/icezingza/namonexus-fusion-engine/blob/main/README.md Demonstrates how to initialize the NamoNexus Fusion Engine and perform multimodal observations. The engine automatically initializes with a Golden Ratio prior. It shows how to get the fused score, risk level, and credible interval. ```python from namonexus_fusion import NamoNexusEngine # Create engine — Golden Ratio prior initialised automatically engine = NamoNexusEngine() # Multimodal observation update engine.update(0.85, 0.70, "text") # (score, confidence, modality) engine.update(0.25, 0.90, "voice") engine.update(0.60, 0.85, "face") # Results print(engine.fused_score) # Bayesian posterior mean, e.g. 0.5423 print(engine.risk_level()) # "low" | "medium" | "high" | "critical" lo, hi = engine.credible_interval() print(f"95% CI: [{lo:.3f}, {hi:.3f}]") # Full session summary (JSON-serialisable) summary = engine.session_summary() ``` -------------------------------- ### Initialize and Use NamoNexusEngine for Multimodal Fusion (Python) Source: https://context7.com/icezingza/namonexus-fusion-engine/llms.txt Demonstrates how to initialize the NamoNexusEngine with default settings, update it with multimodal observations (score, confidence, modality), and retrieve fusion results like fused score, risk level, uncertainty, and credible intervals. It also shows how to calculate deception probability and get a session summary. ```python from namonexus_fusion import NamoNexusEngine # Create engine with default Golden Ratio prior (α₀/β₀ = φ) engine = NamoNexusEngine() # Update with multimodal observations: (score, confidence, modality) engine.update(0.85, 0.70, "text") # Text analysis suggests low risk engine.update(0.25, 0.90, "voice") # Voice analysis suggests higher risk engine.update(0.60, 0.85, "face") # Facial analysis is moderate # Get fusion results print(f"Fused score: {engine.fused_score:.4f}") # Output: ~0.5423 print(f"Risk level: {engine.risk_level()}") # Output: "medium" print(f"Uncertainty: ±{engine.uncertainty:.4f}") # Output: ~0.0812 # Get 95% Bayesian credible interval lo, hi = engine.credible_interval() print(f"95% CI: [{lo:.3f}, {hi:.3f}]") # Output: [0.372, 0.711] # Deception probability (P(score > threshold) under posterior) print(f"P(deception): {engine.deception_probability(threshold=0.5):.4f}") # Full session summary (JSON-serializable) summary = engine.session_summary() # { # "version": "4.0.0-phase2", # "fused_score": 0.5423, # "risk_level": "medium", # "uncertainty": 0.0812, # "credible_interval": {"lower": 0.3721, "upper": 0.7108}, # "total_observations": 24.5 # } ``` -------------------------------- ### Install NamoNexus Fusion Engine Source: https://github.com/icezingza/namonexus-fusion-engine/blob/main/README.md Instructions for installing the NamoNexus Fusion Engine from source for development or directly for production. Requires Python 3.9+ and dependencies like NumPy and SciPy. ```bash # From source (development) git clone https://github.com/namonexus/namonexus-fusion.git cd namonexus-fusion pip install -e ".[dev]" # Production install pip install . ``` -------------------------------- ### Initialize New User Engine from Enriched Prior (Python) Source: https://github.com/icezingza/namonexus-fusion-engine/blob/main/README.md Illustrates how a new user's engine can be initialized using an enriched population prior from the coordinator. This allows new users to benefit from the aggregated knowledge of existing users. ```python # New user warm-starts from the enriched population prior new_engine = NamoNexusEngine( hierarchical_model=coordinator, subject_id="new_user", ) ``` -------------------------------- ### Phase 1: Fit Personalised Prior and Warm-Start Engine Source: https://github.com/icezingza/namonexus-fusion-engine/blob/main/README.md Demonstrates fitting a personalized prior using historical session data and then initializing the NamoNexus Fusion Engine with this learned prior for improved accuracy. Includes generating synthetic data for demonstration. ```python from namonexus_fusion import NamoNexusEngine from namonexus_fusion.core import ( EmpiricalPriorLearner, SyntheticSessionGenerator, SubjectProfile, ) # Generate synthetic historical data (replace with real sessions in production) gen = SyntheticSessionGenerator(seed=42) profiles = [SubjectProfile("user_calm", baseline_score=0.80)] sessions = gen.generate(profiles, sessions_per_subject=20) # Fit personalised prior learner = EmpiricalPriorLearner() learner.add_sessions(sessions) prior = learner.fit("user_calm") # Warm-start the engine with the personalised prior engine = NamoNexusEngine(learned_prior=prior) engine.update(0.80, 0.70, "text") print(f"Prior mean: {prior.prior_mean:.4f}, Fused: {engine.fused_score:.4f}") ``` -------------------------------- ### Initialize and Update NamoNexus Engine (Python) Source: https://github.com/icezingza/namonexus-fusion-engine/blob/main/README.md Demonstrates initializing a HierarchicalBayesianModel for a specific site, creating a NamoNexusEngine, updating it with data, committing the session, and exporting the federated delta. This is a core workflow for individual sites. ```python model_b = HierarchicalBayesianModel(site_id="site_b") engine_b = NamoNexusEngine(hierarchical_model=model_b, subject_id="user_002") engine_b.update(0.7, 0.85, "text") engine_b.commit_session() delta_b = model_b.export_federated_delta() ``` -------------------------------- ### Create, Train, and Serialize NamoNexus Engine State Source: https://context7.com/icezingza/namonexus-fusion-engine/llms.txt Demonstrates how to initialize a NamoNexusEngine, update it with data, capture its state for serialization, and later restore it from the saved state. This is useful for saving and loading engine configurations and learned parameters. ```python from namonexus_fusion import NamoNexusEngine import json from namonexus_fusion.core.golden_bayesian import FusionState # Create and train an engine engine = NamoNexusEngine() engine.update(0.85, 0.70, "text") engine.update(0.25, 0.90, "voice") engine.update(0.60, 0.85, "face") # Capture state for serialization state = engine.get_state() state_dict = state.to_dict() # Serialize to JSON for storage/transmission state_json = json.dumps(state_dict) print(f"State size: {len(state_json)} bytes") # Later: restore engine from saved state new_engine = NamoNexusEngine() restored_state = FusionState.from_dict(json.loads(state_json)) new_engine.load_state(restored_state) # Verify restoration print(f"Original score: {engine.fused_score:.4f}") print(f"Restored score: {new_engine.fused_score:.4f}") # Identical ``` -------------------------------- ### Personalized Prior Learning with EmpiricalPriorLearner Source: https://context7.com/icezingza/namonexus-fusion-engine/llms.txt Shows how to use EmpiricalPriorLearner to learn personalized Beta priors from historical session data using Maximum Likelihood Estimation with Golden Ratio regularization. It addresses the cold-start problem by adapting priors to individual baselines. ```python from namonexus_fusion import NamoNexusEngine from namonexus_fusion.core.empirical_prior import ( EmpiricalPriorLearner, SyntheticSessionGenerator, SubjectProfile, PriorLearningConfig, ) # Configure learner with Golden Ratio regularization config = PriorLearningConfig( phi_regularization=1.0, # Strength of φ regularization min_sessions=5, # Minimum sessions before learning min_observations_per_session=2, # Filter noisy sessions ) learner = EmpiricalPriorLearner(config=config) # Generate synthetic historical data (replace with real sessions in production) gen = SyntheticSessionGenerator(seed=42) profiles = [ SubjectProfile("user_calm", baseline_score=0.80, voice_noise_std=0.06), SubjectProfile("user_tense", baseline_score=0.35, voice_noise_std=0.12), ] sessions = gen.generate(profiles, sessions_per_subject=20) # Add sessions and fit personalized priors learner.add_sessions(sessions) # Fit prior for calm user prior_calm = learner.fit("user_calm") print(f"Calm user prior: α₀={prior_calm.alpha0:.4f}, β₀={prior_calm.beta0:.4f}") print(f"Prior mean: {prior_calm.prior_mean:.4f}") print(f"φ deviation: {prior_calm.golden_ratio_deviation:.4f}") # Warm-start engine with personalized prior engine = NamoNexusEngine(learned_prior=prior_calm) engine.update(0.80, 0.70, "text") print(f"Fused score with personalized prior: {engine.fused_score:.4f}") ``` -------------------------------- ### Production Streaming Inference with StreamingPipeline Source: https://context7.com/icezingza/namonexus-fusion-engine/llms.txt Illustrates the use of StreamingPipeline for production-grade streaming inference, featuring backpressure control, sliding window statistics, at-least-once delivery, and connector abstractions for Kafka/WebSocket. It also includes drift detection. ```python from namonexus_fusion import NamoNexusEngine from namonexus_fusion.core.streaming_pipeline import ( StreamingPipeline, StreamingObservation, StreamingConfig, InMemoryConnector, WindowedStats, ) # Configure streaming pipeline stream_config = StreamingConfig( max_queue_depth=1000, # Backpressure threshold resume_fraction=0.5, # Resume at 50% capacity window_size=100, # Rolling statistics window trend_window=20, # Risk trend estimation window max_concurrent=4, # Parallel processing ) engine = NamoNexusEngine() pipeline = engine.stream() # Or: StreamingPipeline(engine, config=stream_config) # Create streaming observations observations = [ StreamingObservation(score=0.80, confidence=0.90, modality="text"), StreamingObservation(score=0.30, confidence=0.75, modality="voice"), StreamingObservation(score=0.65, confidence=0.80, modality="face"), StreamingObservation(score=0.82, confidence=0.88, modality="text"), StreamingObservation(score=0.28, confidence=0.70, modality="voice"), ] # Run synchronously (or async with pipeline.run()) results = pipeline.run_sync(InMemoryConnector(observations)) for r in results: trend = r.window_stats.risk_trend if r.window_stats else "n/a" print(f"score={r.fused_score:.4f} risk={r.risk_level:<8} " f"latency={r.latency_ms:.1f}ms trend={trend}") # Check drift detection if engine.has_drift_alarm: print("⚠ Drift alarm triggered") for event in engine.drift_events(): print(f" Drift: {event.modality} severity={event.severity}") # Pipeline diagnostics print(f"\nProcessed: {pipeline.n_processed}, Errors: {pipeline.n_errors}") print(f"Ledger stats: {pipeline.ledger_stats()}") ``` -------------------------------- ### Configure NamoNexusEngine with FusionConfig (Python) Source: https://context7.com/icezingza/namonexus-fusion-engine/llms.txt Illustrates how to customize the Bayesian fusion behavior by creating a `FusionConfig` object. This allows tuning parameters like prior strength, confidence scaling, validation modes, and history size. The Golden Ratio constraint is maintained automatically. ```python from namonexus_fusion import NamoNexusEngine, FusionConfig # Custom configuration with stronger prior (harder to move) config = FusionConfig( prior_strength=2.0, # α₀ = φ × 2.0, β₀ = 2.0 (stronger prior) max_trials=100, # Maximum pseudo-trials per observation confidence_scale=10.0, # n_trials = confidence × 10 strict_validation=True, # Raise on out-of-range inputs max_history=1000, # Keep last 1000 update records ) print(f"Prior alpha: {config.alpha0:.4f}") # φ × 2.0 ≈ 3.236 print(f"Prior beta: {config.beta0:.4f}") # 2.0 print(f"Prior ratio: {config.alpha0/config.beta0:.4f}") # φ ≈ 1.618 engine = NamoNexusEngine(config=config) engine.update(0.80, 0.90, "text") print(f"Score with strong prior: {engine.fused_score:.4f}") # Moves less from prior ``` -------------------------------- ### Run All NamoNexus Fusion Engine Tests (Bash) Source: https://github.com/icezingza/namonexus-fusion-engine/blob/main/README.md Command to execute all tests within the NamoNexus Fusion Engine project using pytest. This is useful for ensuring the integrity of the entire codebase. ```bash # All tests pytest namonexus_fusion/tests/ -v ``` -------------------------------- ### Run Tests with Coverage (Bash) Source: https://github.com/icezingza/namonexus-fusion-engine/blob/main/README.md Command to run all tests while also generating a code coverage report. This helps identify which parts of the codebase are being tested and which are not. ```bash # With coverage pytest namonexus_fusion/tests/ --cov=namonexus_fusion --cov-report=term-missing ``` -------------------------------- ### Serialize and Load NamoNexusEngine State (Python) Source: https://context7.com/icezingza/namonexus-fusion-engine/llms.txt Demonstrates how to save and load the complete state of the NamoNexusEngine using `get_state` and `load_state` methods. This is essential for persisting fusion progress across sessions, transferring state between services, or recovering from failures. The `FusionState` dataclass encapsulates all posterior parameters and history. ```python from namonexus_fusion import NamoNexusEngine import json # Example usage (assuming engine is already initialized and updated) # engine = NamoNexusEngine() # engine.update(0.85, 0.70, "text") # Get the current state # current_state = engine.get_state() # To save state (e.g., to a file): # with open("engine_state.json", "w") as f: # json.dump(current_state.dict(), f) # To load state from a file: # with open("engine_state.json", "r") as f: # loaded_state_dict = json.load(f) # new_engine = NamoNexusEngine() # new_engine.load_state(FusionState(**loaded_state_dict)) # Now new_engine has the same state as the original engine ``` -------------------------------- ### Coordinator Aggregates Deltas (Python) Source: https://github.com/icezingza/namonexus-fusion-engine/blob/main/README.md Shows how a coordinator model aggregates federated deltas received from different sites. This process is crucial for building a global model from distributed data, with structural constraints enforced automatically. ```python # Coordinator aggregates (φ structural constraint enforced automatically) coordinator = HierarchicalBayesianModel(site_id="coordinator") coordinator.aggregate_federated_deltas([delta_a, delta_b]) ``` -------------------------------- ### Run Specific Phase Tests (Bash) Source: https://github.com/icezingza/namonexus-fusion-engine/blob/main/README.md Commands to run tests for specific phases of the NamoNexus Fusion Engine. This allows for targeted testing of particular functionalities. ```bash # Specific phase pytest namonexus_fusion/tests/test_phase1.py -v pytest namonexus_fusion/tests/test_phase4.py -v ``` -------------------------------- ### Phase 3: Streaming Inference and Drift Detection Source: https://github.com/icezingza/namonexus-fusion-engine/blob/main/README.md Illustrates how to perform real-time inference using the NamoNexus Fusion Engine's streaming capabilities. It shows processing a sequence of observations and checking for drift alarms. ```python from namonexus_fusion import NamoNexusEngine from namonexus_fusion.core import StreamingObservation, InMemoryConnector engine = NamoNexusEngine() pipeline = engine.stream() observations = [ StreamingObservation(score=0.8, confidence=0.9, modality="text"), StreamingObservation(score=0.3, confidence=0.7, modality="voice"), StreamingObservation(score=0.6, confidence=0.8, modality="face"), ] results = pipeline.run_sync(InMemoryConnector(observations)) for r in results: print(r.fused_score, r.risk_level, r.window_stats.risk_trend) # Drift detection if engine.has_drift_alarm: print("Drift detected:", engine.drift_events()) ``` -------------------------------- ### Phase 4: Explainability and Audit Trail Source: https://github.com/icezingza/namonexus-fusion-engine/blob/main/README.md Demonstrates how to generate explanations for the fused score using Shapley values, providing per-modality attributions and a human-readable summary. It also shows how to export the audit record in JSON format for GDPR/PDPA compliance. ```python engine = NamoNexusEngine() engine.update(0.85, 0.70, "text") engine.update(0.25, 0.90, "voice") engine.update(0.60, 0.85, "face") report = engine.explain(metadata={"session_id": "sess_001"}) # Human-readable compliance text print(report.summary_text) # Per-modality Shapley attributions for attr in report.modality_attributions: print(f"{attr.modality}: φ={attr.shapley_value:.4f} ({attr.alignment.value})") # GDPR Article 22 / PDPA Section 40 audit record import json audit = report.to_dict() print(json.dumps(audit, indent=2)) ``` -------------------------------- ### Configure Hierarchical Bayesian Models for Federated Learning Source: https://context7.com/icezingza/namonexus-fusion-engine/llms.txt Illustrates how to configure Hierarchical Bayesian Models for federated learning using `HierarchicalConfig`. It shows standard configurations like the 'golden ratio' and custom configurations with differential privacy settings, including population prior strength, transition rates, and noise scaling. ```python from namonexus_fusion.core.hierarchical_bayesian import ( HierarchicalBayesianModel, HierarchicalConfig, ) # Standard configuration with Golden Ratio constraints golden_config = HierarchicalConfig.golden() print(f"Population strength: {golden_config.population_prior_strength:.4f}") # φ² print(f"Transition tau: {golden_config.tau:.4f}") # φ² # Federated configuration with differential privacy federated_config = HierarchicalConfig( population_prior_strength=2.618, # φ² (moderate prior mass) tau=2.618, # Transition at φ² × τ observations min_sessions_for_blend=2, # Minimum sessions before blending enforce_phi_constraint=True, # Re-project to φ after aggregation phi_tolerance=0.1, # Maximum φ deviation allowed dp_noise_scale=0.1, # Laplace noise for differential privacy max_individual_strength=500.0, # Cap individual posterior strength ) model = HierarchicalBayesianModel( config=federated_config, site_id="privacy_preserving_site" ) # Export delta with differential privacy noise delta = model.export_federated_delta() print(f"Noise applied: {delta.noise_applied}") print(f"Noise scale (ε): {delta.noise_scale}") ``` -------------------------------- ### Batch Update Engine Observations Source: https://github.com/icezingza/namonexus-fusion-engine/blob/main/README.md Shows how to efficiently update the NamoNexus Fusion Engine with multiple observations at once using a list of dictionaries. ```python engine.update_batch([ {"score": 0.85, "confidence": 0.70, "modality": "text"}, {"score": 0.25, "confidence": 0.90, "modality": "voice"}, {"score": 0.60, "confidence": 0.85, "modality": "face"}, ]) ``` -------------------------------- ### GDPR/PDPA Compliant Explainability Source: https://context7.com/icezingza/namonexus-fusion-engine/llms.txt Provides information on generating Shapley-value attributions with a Golden Ratio prior baseline for regulatory compliance (GDPR Article 22, PDPA Section 40). It offers per-modality explanations with alignment classification. ```python from namonexus_fusion import NamoNexusEngine import json engine = NamoNexusEngine() ``` -------------------------------- ### Federated Learning with Hierarchical Bayesian Models Source: https://context7.com/icezingza/namonexus-fusion-engine/llms.txt Demonstrates federated learning using Hierarchical Bayesian Models across multiple sites (Site A, Site B) for privacy-preserving knowledge sharing. It covers local session processing, exporting federated deltas, aggregating deltas at a coordinator, and warm-starting new users. ```python from namonexus_fusion import NamoNexusEngine from namonexus_fusion.core.hierarchical_bayesian import ( HierarchicalBayesianModel, HierarchicalConfig, ) # Site A: Local deployment model_a = HierarchicalBayesianModel(site_id="hospital_a") engine_a = NamoNexusEngine(hierarchical_model=model_a, subject_id="patient_001") # Process session at Site A engine_a.update(0.8, 0.9, "text") engine_a.update(0.4, 0.7, "voice") engine_a.commit_session() # Push evidence to hierarchical model # Export federated delta (no raw data transmitted) delta_a = model_a.export_federated_delta() print(f"Site A delta: Δα={delta_a.alpha_delta:.4f}, Δβ={delta_a.beta_delta:.4f}") # Site B: Another deployment model_b = HierarchicalBayesianModel(site_id="hospital_b") engine_b = NamoNexusEngine(hierarchical_model=model_b, subject_id="patient_002") engine_b.update(0.7, 0.85, "text") engine_b.update(0.5, 0.75, "face") engine_b.commit_session() delta_b = model_b.export_federated_delta() print(f"Site B delta: Δα={delta_b.alpha_delta:.4f}, Δβ={delta_b.beta_delta:.4f}") # Coordinator: Aggregate deltas (φ constraint enforced automatically) coordinator = HierarchicalBayesianModel(site_id="coordinator") coordinator.aggregate_federated_deltas([delta_a, delta_b]) pop = coordinator.population_prior print(f"\nPopulation prior after aggregation:") print(f" α_pop/β_pop = {pop.alpha_pop:.4f}/{pop.beta_pop:.4f}") print(f" φ ratio: {pop.phi_ratio:.6f} (target φ = 1.618034)") # New user warm-starts from enriched population prior engine_new = NamoNexusEngine( hierarchical_model=coordinator, subject_id="new_patient" ) blended = engine_new.blended_prior() print(f"\nNew user blended prior: ρ={blended.rho:.4f}, " f"mean={blended.mean:.4f}, source={blended.source}") ``` -------------------------------- ### Detect Distribution Drift with Page-Hinkley CUSUM (Python) Source: https://context7.com/icezingza/namonexus-fusion-engine/llms.txt Implements Page-Hinkley CUSUM-based drift detection using Golden Ratio thresholds to identify distributional shifts in data streams. It requires the 'namonexus_fusion' library and processes 'StreamingObservation' objects. ```python from namonexus_fusion import NamoNexusEngine from namonexus_fusion.core.streaming_pipeline import ( StreamingObservation, InMemoryConnector, ) engine = NamoNexusEngine() # Simulate observations with sudden drift normal_obs = [ StreamingObservation(score=0.75 + i*0.01, confidence=0.85, modality="voice") for i in range(10) ] # Sudden distribution shift drift_obs = [ StreamingObservation(score=0.30 + i*0.01, confidence=0.85, modality="voice") for i in range(10) ] pipeline = engine.stream() results = pipeline.run_sync(InMemoryConnector(normal_obs + drift_obs)) # Check for drift drift_summary = engine.drift_summary() print(f"Has drift alarm: {engine.has_drift_alarm}") print(f"Drift summary: {drift_summary}") # Detailed drift events if engine.has_drift_alarm: for event in engine.drift_events(): print(f"Drift detected:") print(f" Modality: {event.modality}") print(f" Severity: {event.severity}" ) # WARNING or ALARM print(f" CUSUM value: {event.cusum_value:.4f}") print(f" Threshold: {event.threshold:.4f}" ) # φ² ≈ 2.618 ``` -------------------------------- ### Process Multimodal Observations and Generate Compliance Report Source: https://context7.com/icezingza/namonexus-fusion-engine/llms.txt Processes multimodal observations (text, voice, face) using the Namonexus engine and generates a compliance-grade explanation report. The report includes a summary, dominant modality, compliance status, and detailed modality attributions. ```python engine.update(0.85, 0.70, "text") # Text suggests low risk engine.update(0.25, 0.90, "voice") # Voice suggests high risk engine.update(0.60, 0.85, "face") # Face is moderate # Generate compliance-grade explanation report = engine.explain(metadata={ "session_id": "sess_001", "operator": "demo_system", "purpose": "risk_assessment" }) # Human-readable compliance summary print("=== Compliance Summary ===") print(report.summary_text) # Dominant modality analysis print(f"\nDominant modality: {report.dominant_modality}") print(f"GDPR compliant: {report.compliance_gdpr}") print(f"PDPA compliant: {report.compliance_pdpa}") # Per-modality Shapley attributions print("\n=== Modality Attributions ===") for attr in report.modality_attributions: print(f"{attr.modality:<8} φ={attr.shapley_value:+.4f} " f"alignment={attr.alignment.value:<15} {attr.explanation}") # JSON audit record for compliance logging audit = report.to_dict() print("\n=== Audit Record Keys ===") print(list(audit.keys())) # Full audit JSON for storage audit_json = json.dumps(audit, indent=2) ``` -------------------------------- ### Core Bayesian Fusion Engine with Golden Ratio Prior (Python) Source: https://context7.com/icezingza/namonexus-fusion-engine/llms.txt The foundational Bayesian fusion class using Beta-Binomial posterior updates with a Golden Ratio prior. It allows direct access to low-level fusion operations and requires 'namonexus_fusion'. Inputs are scores, confidences, and modality names. ```python from namonexus_fusion import GoldenBayesianFusion, FusionConfig from namonexus_fusion.core.constants import GOLDEN_RATIO # Direct access to base Bayesian engine config = FusionConfig(prior_strength=1.0) fusion = GoldenBayesianFusion(config=config) print(f"Initial prior: α₀={fusion._alpha0:.4f}, β₀={fusion._beta0:.4f}") print(f"Prior ratio (should be φ): {fusion._alpha0/fusion._beta0:.6f}") print(f"Golden Ratio constant: {GOLDEN_RATIO:.6f}") # Manual updates fusion.update(score=0.80, confidence=0.90, modality_name="text") fusion.update(score=0.35, confidence=0.85, modality_name="voice") # Access posterior parameters directly print(f"\nPosterior: α={fusion._alpha:.4f}, β={fusion._beta:.4f}") print(f"Fused score: {fusion.fused_score:.4f}") print(f"Uncertainty (σ): {fusion.uncertainty:.4f}") # Risk classification thresholds # LOW: < 0.35, MEDIUM: 0.35-0.60, HIGH: 0.60-0.80, CRITICAL: > 0.80 print(f"Risk level: {fusion.risk_level()}") # Full observation history history = fusion.history print(f"\nHistory entries: {len(history)}") for entry in history: print(f" {entry['modality']}: score={entry['score']:.2f}, " f"conf={entry['confidence']:.2f}, n={entry['n_trials']:.1f}") ``` -------------------------------- ### Phase 4: Federated Learning Delta Export Source: https://github.com/icezingza/namonexus-fusion-engine/blob/main/README.md Shows how to export a federated delta from a Hierarchical Bayesian Model for use in federated learning scenarios, ensuring no raw data is transmitted. This is part of the Phase 4 capabilities for distributed model training. ```python from namonexus_fusion import NamoNexusEngine from namonexus_fusion.core import HierarchicalBayesianModel # Site A model_a = HierarchicalBayesianModel(site_id="site_a") engine_a = NamoNexusEngine(hierarchical_model=model_a, subject_id="user_001") engine_a.update(0.8, 0.9, "text") engine_a.update(0.4, 0.7, "voice") engine_a.commit_session() # Export federated delta — no raw data transmitted delta_a = model_a.export_federated_delta() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.