"""Geometry, linearity, stability, and subspace constants."""
from wisent.core.utils.config_tools.constants.for_experiments.by_domain.analysis._analysis import *  # noqa: F401,F403

# --- SVD / subspace ---
MIN_CONCEPT_DIM = 2
MAX_CONCEPT_DIM = 32
DEFAULT_VARIANCE_THRESHOLD = 0.80
MARGINAL_VARIANCE_THRESHOLD = 0.05
UNIVERSAL_SUBSPACE_RANK = 16

# --- Geometry diagnostics thresholds ---
GEO_DIAG_LINEAR_VARIANCE = 0.85
GEO_DIAG_CONE_THRESHOLD = 0.65
GEO_DIAG_CLUSTER_SILHOUETTE = 0.55
GEO_DIAG_MANIFOLD_THRESHOLD = 0.70
GEO_DIAG_SPARSE_THRESHOLD = 0.1
GEO_DIAG_BIMODAL_DIP = 0.05
GEO_DIAG_ORTHOGONAL_THRESHOLD = 0.12

# --- Linearity analysis ---
LINEARITY_MAX_PAIRS = 1000
LINEARITY_PCA_COMPONENTS = 50
LINEARITY_HIDDEN_DIM_LARGE = 64
LINEARITY_HIDDEN_DIM_SMALL = 32
LINEARITY_N_CLUSTERS = 3
LINEARITY_NONLINEAR_ERROR = 0.3
LINEARITY_N_INIT = 10
LINEARITY_N_BOOTSTRAP = 100
LINEARITY_MLP_MAX_ITER = 50
LINEARITY_MIN_GAPS = 10
LINEARITY_DEGREE = 2
LINEARITY_N_FEATURES = 50
LINEARITY_REG_C = 0.1
LINEARITY_RIDGE_ALPHA = 1.0
LINEARITY_BOOTSTRAP_ITER = 50
LINEARITY_Z_SCORE_THRESHOLD = 2.0

# --- Linearity test parameters ---
LINEARITY_TEST_GAP_THRESHOLD = 0.05
LINEARITY_TEST_P_THRESHOLD = 0.05
LINEARITY_TEST_RESIDUAL_THRESHOLD = 0.3
LINEARITY_TEST_RAMSEY_THRESHOLD = 0.03
LINEARITY_TEST_N_BOOTSTRAP = 30
LINEARITY_CONFIDENCE_HIGH = 0.8
LINEARITY_CONFIDENCE_LOW = 0.2
LINEARITY_CROSS_CONTEXT_THRESHOLD = 0.7
LINEARITY_LAYER_SAMPLING_DIVISOR = 8

# --- Stability analysis ---
STABILITY_N_BOOTSTRAP = 50
STABILITY_THRESHOLD_HIGH = 0.9
STABILITY_N_SUBSAMPLES = 20
STABILITY_SUBSAMPLE_RATIO = 0.8
STABILITY_THRESHOLD_MED = 0.7
STABILITY_MIN_SAMPLES_LARGE = 100
STABILITY_MIN_SAMPLES_MED = 50
STABILITY_MIN_SAMPLES_SMALL = 30
STABILITY_N_CLUSTERS = 2
STABILITY_ACCURACY_MARGIN = 0.1

# --- Cone scoring ---
CONE_THRESHOLD = 0.7
CONE_DIRECTIONS = 5
CONE_NOISE_SCALE = 0.3
CONE_LOSS_WEIGHT_DISSIMILAR = 0.5
CONE_LOSS_WEIGHT_CONE = 0.5
CONE_LOSS_WEIGHT_DIVERSITY = 0.1
CONE_POS_RATIO_WEIGHT = 0.7
CONE_SIG_RATIO_WEIGHT = 0.3
CONE_COS_THRESHOLD_LOW = 0.3
CONE_COS_SCORE_LOW = 0.5
CONE_COS_THRESHOLD_HIGH = 0.7
CONE_SIGNIFICANCE_THRESHOLD = 0.1
CONE_WEIGHT_COS = 0.20
CONE_WEIGHT_SIG = 0.25
CONE_WEIGHT_EFFECT = 0.20
CONE_WEIGHT_SAMPLE = 0.20
CONE_WEIGHT_RATIO = 0.15

# --- Direction visualization ---
DIRECTION_ORTHOGONAL_THRESHOLD = 0.1
DIRECTION_ALIGNED_THRESHOLD = 0.9
DIRECTION_HIGH_SIMILARITY = 0.8
DIRECTION_MODERATE_SIMILARITY = 0.5
DIRECTION_LOW_SIMILARITY = 0.1
DIRECTION_K_VALUES = (1, 2, 3, 5, 10)

# --- Decomposition metrics ---
DECOMP_ADAPTIVE_K_MIN = 2
DECOMP_ADAPTIVE_K_MAX = 15
DECOMP_MIN_CLUSTER_SIZE_BASE = 5
DECOMP_CLUSTER_SIZE_RATIO = 20
DECOMP_MIN_SILHOUETTE = 0.3
DECOMP_MAX_SILHOUETTE_SAMPLES = 1000
DECOMP_MIN_CONCEPT_SAMPLES = 10
DECOMP_MIN_CONCEPT_SAMPLES_CHOW = 20
DECOMP_THRESHOLD_BASE = 0.5
DECOMP_THRESHOLD_MIN = 0.02
DECOMP_THRESHOLD_MAX = 0.1
DECOMP_COSINE_SIM_THRESHOLD = 0.8
DECOMP_PCA_DIMS_MAX = 50
DECOMP_KMEANS_N_INIT_MIN = 3
DECOMP_KMEANS_N_INIT_MAX = 10
DECOMP_KMEANS_SCALING_FACTOR = 1000

# --- Cloud metrics ---
CLOUD_MAX_SAMPLES_MANIFOLD = 500
CLOUD_MAX_SAMPLES_TOPOLOGY = 300
CLOUD_CONE_PERCENTILE = 90
CLOUD_VAR_PERCENTILE_50 = 0.5
CLOUD_VAR_PERCENTILE_90 = 0.9
CLOUD_VAR_PERCENTILE_99 = 0.99
CLOUD_K_NEIGHBORS_DEFAULT = 10

# --- Intrinsic dimensionality ---
INTRINSIC_DIM_K = 10
INTRINSIC_DIM_TOP_N = 10
PCA_VARIANCE_THRESHOLDS = (0.90, 0.95, 0.99)
TWO_NN_MU_THRESHOLD = 1.0

# --- Subspace analysis ---
SUBSPACE_MIN_VECTORS = 3
SUBSPACE_DECAY_NORMALIZE = 10.0
SUBSPACE_SPARSITY_THRESHOLD = 0.99
SUBSPACE_TOP_CONTRIB_THRESHOLD = 0.99
SUBSPACE_DEFAULT_QUALITY = 0.8
SUBSPACE_QUALITY_W_CONCENTRATION = 0.5
SUBSPACE_QUALITY_W_RANK = 0.3
SUBSPACE_QUALITY_W_DECAY = 0.2

# --- Subspace validation dynamic thresholds ---
SUBSPACE_NORM_TOLERANCE = 0.05
SUBSPACE_SPECTRAL_RATIO_LOW = 0.1
SUBSPACE_SPECTRAL_RATIO_HIGH = 0.2
SUBSPACE_VAR_THRESHOLD_MAX = 0.95
SUBSPACE_VAR_THRESHOLD_ADJUST = 0.1
SUBSPACE_CONE_MIN_DYNAMIC = 0.5
SUBSPACE_CONE_ADJUST = 0.1
SUBSPACE_VAR_THRESHOLD_MIN = 0.75
SUBSPACE_VAR_FINE_ADJUST = 0.05
SUBSPACE_HIDDEN_DIM_LARGE = 4096
SUBSPACE_SILHOUETTE_MIN_DYNAMIC = 0.4
SUBSPACE_SILHOUETTE_ADJUST = 0.1
SUBSPACE_ROBUSTNESS_NOISE_SCALE = 0.1
SUBSPACE_DIRECTION_PADDING = 5
SUBSPACE_SAMPLE_CONSERVATIVE = 20
SUBSPACE_SAMPLE_RELAXED = 100

# --- Manifold / steering analysis ---
MANIFOLD_NEIGHBORS = 10
MAX_CLUSTERS = 5
MOVEMENT_THRESHOLD = 0.6
STEERING_N_RANDOM = 20
STEERING_N_PCA = 10
MANIFOLD_LINEARITY_SAMPLE_LIMIT = 50

# --- Geometry adaptive thresholds ---
GEOMETRY_ADAPT_THRESHOLD_NUMERATOR = 0.5
GEOMETRY_ADAPT_THRESHOLD_MIN = 0.02
GEOMETRY_ADAPT_THRESHOLD_MAX = 0.1
GEOMETRY_CV_FOLDS = 3
GEOMETRY_LOGISTIC_C_MIN = 0.01
GEOMETRY_LOGISTIC_C_MAX = 10.0
GEOMETRY_DEFAULT_NUM_COMPONENTS = 5
GEOMETRY_OPTIMIZATION_STEPS_SMALL = 30

# --- Geometry detector scoring ---
DETECTOR_COHENS_D_DIVISOR = 5
DETECTOR_LARGE_SAMPLE_N = 50
DETECTOR_CONE_THRESHOLD_LOW = 0.1
DETECTOR_CONE_RANGE_MID = 0.3
DETECTOR_CONE_SCALE_MID = 0.2
DETECTOR_CONE_RANGE_HIGH = 0.7
DETECTOR_CONE_SCALE_HIGH = 0.4
DETECTOR_CONE_OFFSET_TOP = 0.8
DETECTOR_CONE_RANGE_TOP = 0.7
DETECTOR_CONE_SCALE_TOP = 0.3
DETECTOR_SMALL_SAMPLE_N = 20
DETECTOR_CLUSTER_SAMPLE_N = 30

# --- Geometry detector defaults ---
GEO_MANIFOLD_SCORE_DEFAULT = 0.4
GEO_MANIFOLD_CONFIDENCE = 0.5
GEO_ORTHOGONAL_CONFIDENCE = 0.6

# --- Geometry structure thresholds ---
GEOMETRY_THRESHOLD_DEFAULT = 0.5
GEOMETRY_THRESHOLD_CLUSTER = 0.6
GEOMETRY_THRESHOLD_SPARSE = 0.7
GEOMETRY_THRESHOLD_MANIFOLD = 0.3

# --- Geometry confidence ---
SPARSE_DETECTION_CONFIDENCE = 0.8
BIMODAL_DETECTION_CONFIDENCE = 0.7
CONTROL_VECTOR_MAX_ZERO_FRACTION = 0.999

# --- Steerability ---
STEERABILITY_MIN_PAIRS = 5
STEERABILITY_SILHOUETTE_SAMPLE_LIMIT = 200
STABILITY_LOO_SAMPLE_LIMIT = 100

# --- Diagnostic significance markers ---
DIAG_SIGNIFICANCE_STRONG = 0.3
DIAG_SIGNIFICANCE_MODERATE = 0.1
DIAG_SIGNIFICANCE_WEAK = 0.05
DIAG_SCORE_HIGH = 0.8
DIAG_SCORE_MODERATE = 0.6
DIAG_SCORE_LOW = 0.4

# --- Diagnose vectors thresholds ---
DIAG_NORM_TOLERANCE = 0.01
DIAG_ZERO_PCT_THRESHOLD = 50
DIAG_MEAN_MAGNITUDE_THRESHOLD = 0.5
DIAG_NORM_MIN = 0.01
DIAG_NORM_MAX = 100

# --- Zwiad protocol ---
ZWIAD_PRZELOM_BONUS_MAX = 1.5
ZWIAD_MIN_SILHOUETTE = 0.1
ZWIAD_PER_TYPE_DEFAULT = 2

# --- Zwiad centroids range/weight ---
ZWIAD_RANGE_SPECTRAL_MIN = 0.3
ZWIAD_RANGE_SURVIVAL_MIN = 0.5
ZWIAD_RANGE_DIM_MIN = 1
ZWIAD_RANGE_DIM_MAX = 100
ZWIAD_RANGE_CONC_MAX = 0.9
ZWIAD_RANGE_SHARP_MAX = 0.9
ZWIAD_WEIGHT_SPECTRAL = 3.0
ZWIAD_WEIGHT_SURVIVAL = 1.5
ZWIAD_WEIGHT_DIM = 1.0
ZWIAD_WEIGHT_CONC = 2.0
ZWIAD_WEIGHT_SHARP = 2.0
ZWIAD_WEIGHT_EDITABILITY = 1.5

# --- Zwiad intervention scores ---
ZWIAD_SCORE_PRIMARY = 2.0
ZWIAD_SCORE_SECONDARY = 1.5
ZWIAD_SCORE_TERTIARY = 1.0
ZWIAD_EDITABILITY_THRESHOLD = 0.6

# --- Zwiad adaptive thresholds ---
ZWIAD_GAP_K = 0.5
ZWIAD_GAP_MIN = 0.02
ZWIAD_GAP_MAX = 0.1
ZWIAD_SIL_BASE = 0.05
ZWIAD_SIL_SLOPE = 0.1
ZWIAD_SIL_SCALE_SAMPLES = 500
ZWIAD_SIL_MAX = 0.2

# --- Zwiad clustering ---
ZWIAD_PCA_COMPONENTS = 3
ZWIAD_KMEANS_PRIMARY_CLUSTERS = 8
ZWIAD_KMEANS_SECONDARY_CLUSTERS = 5

# --- Zwiad analysis limits ---
ZWIAD_ANALYSIS_LIMIT = 500
ZWIAD_ANALYSIS_LIMIT_SMALL = 200

# --- EOT editability ---
EOT_DEFAULT_TEMPERATURE = 1.0
EOT_SURVIVAL_WEIGHT = 0.50
EOT_SPECTRAL_WEIGHT = 0.25
EOT_PERTURBATION_SCALE = 0.01

# --- PCA/subspace counts ---
PCA_TOP_N_COMPONENTS = 10
PCA_QUALITY_COMPONENTS = 5
PCA_GALLERY_COMPONENTS = 50
CUMULATIVE_VARIANCE_TOP_N = 3

# --- Check-linearity CLI thresholds ---
CHECK_LINEARITY_LINEAR_THRESHOLD = 0.7
CHECK_LINEARITY_WEAK_THRESHOLD = 0.5
CHECK_LINEARITY_MIN_COHENS_D = 1.0
CHECK_LINEARITY_DEFAULT_MAX_PAIRS = 50

# --- Min samples thresholds ---
MIN_SAMPLES_PCA = 3
MIN_CLOUD_POINTS = 3
MIN_CLOUD_CLUSTER_POINTS = 6
MIN_LAYER_ACTIVATIONS_FOR_GEOMETRY = 10
MIN_CONCEPT_PAIRS = 10
MIN_PAIRS_FOR_LINEARITY = 10

# --- Variance explained ---
VARIANCE_EXPLAINED_90PCT = 0.9
