use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LimeAnalysisResult {
pub timestamp: DateTime<Utc>,
pub local_coefficients: HashMap<String, f64>,
pub feature_names: Vec<String>,
pub local_r_squared: f64,
pub intercept: f64,
pub feature_importance: Vec<FeatureImportance>,
pub perturbation_analysis: PerturbationAnalysis,
pub neighborhood_stats: NeighborhoodStats,
pub local_fidelity: f64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FeatureImportance {
pub feature_name: String,
pub importance_score: f64,
pub confidence_interval: (f64, f64),
pub p_value: f64,
pub stability: f64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PerturbationAnalysis {
pub num_perturbations: usize,
pub strategy: String,
pub prediction_variance: f64,
pub neighborhood_coverage: f64,
pub influential_perturbations: Vec<PerturbationResult>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PerturbationResult {
pub id: String,
pub perturbed_features: Vec<String>,
pub original_prediction: f64,
pub perturbed_prediction: f64,
pub prediction_change: f64,
pub distance: f64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NeighborhoodStats {
pub mean_prediction: f64,
pub std_prediction: f64,
pub density: f64,
pub correlation_matrix: HashMap<(String, String), f64>,
}