"""Constants requiring experimental optimization."""
from wisent.core.grp_05.sub_constants.for_experiments._exp_03 import *  # noqa: F401,F403

ZWIAD_PER_TYPE_DEFAULT = 2

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

# --- 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

# --- Probe metrics ---
PROBE_MIN_PER_CLASS = 5
PROBE_SMALL_HIDDEN = 16
PROBE_MLP_HIDDEN = 64
PROBE_MLP_ALPHA = 0.01
PROBE_VALIDATION_FRACTION = 0.1

# --- Classifier extended ---
CLASSIFIER_EARLY_STOPPING_PATIENCE = 10
CLASSIFIER_TRAINING_SAMPLES = 25

# --- Kernel steering (additive baking) ---
KERNEL_DISTANCE_FRACTION = 0.6

# --- Auto optimization ---
AUTO_MAX_TIME_MINUTES = 60.0
AUTO_MIN_PAIRS = 10
AUTO_SAMPLE_SIZE = 50
AUTO_LAYER_FRACTION = 0.75
AUTO_N_FOLDS = 3
AUTO_DEFAULT_STRENGTHS = (0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 2.0)

# --- Search results deserialization defaults ---
MULTI_DIR_MIN_K_NOT_FOUND = -1
MULTI_DIR_SATURATION_K_DEFAULT = 1

# --- Signal analysis ---
SIGNAL_NULL_MEAN = 0.5
SIGNAL_NULL_STD = 0.1
SIGNAL_SATURATION_DELTA = 0.02
SIGNAL_POWER_SAMPLE_SIZES = (10, 20, 50, 100, 200, 500)
BOOTSTRAP_CI_LOW_DEFAULT = 0.4
BOOTSTRAP_CI_HIGH_DEFAULT = 0.6
SIGNAL_ICD_THRESHOLD = 20

# --- Effectiveness thresholds ---
EFFECTIVENESS_HIGH = 0.1
EFFECTIVENESS_MODERATE = 0.05
EFFECTIVENESS_SLIGHT = 0.01

# --- Classifier optimizer defaults ---
CLASSIFIER_LAYER_RANGE_END = 23

# --- Signal detection (paper methodology) ---
SIGNAL_EXIST_THRESHOLD = 0.6
SIGNAL_LINEAR_GAP = 0.15
DENSITY_RATIO_DEFAULT = 1.0

# --- Dip test / direction consistency ---
DIP_TEST_SIMULATIONS = 1000
DIRECTION_N_SPLITS = 10

# --- 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

# --- Behavioral validation confidence ---
BEHAVIORAL_CONF_IMPROPERLY = 0.5
BEHAVIORAL_CONF_UNEXPECTED = 0.3
BEHAVIORAL_CONF_INEFFECTIVE = 0.1

# --- Abliteration defaults ---
ABLITERATION_MAX_WEIGHT_POS = 8.0
ABLITERATION_MIN_WEIGHT_DIST = 6.0
ABLITERATION_EVAL_LIMIT = 500

# --- Preflight compatibility scoring ---
PREFLIGHT_COMPAT_DEFAULT = 0.5
PREFLIGHT_COMPAT_EXCELLENT = 1.0
PREFLIGHT_COMPAT_GOOD = 0.7
PREFLIGHT_COMPAT_ADAPTIVE = 0.9
PREFLIGHT_COMPAT_POOR = 0.3
PREFLIGHT_COMPAT_NEUTRAL = 0.5
PREFLIGHT_COMPAT_THRESHOLD = 0.5
PREFLIGHT_LINEAR_HIGH = 0.8
PREFLIGHT_LINEAR_VERY_HIGH = 0.9
PREFLIGHT_LINEAR_MODERATE = 0.5
PREFLIGHT_CONE_HIGH = 0.7
PREFLIGHT_MANIFOLD_HIGH = 0.8
PREFLIGHT_BIMODAL_MODERATE = 0.6

# --- Registry search range bounds ---
REGISTRY_LR_FLOOR = 0.00001
REGISTRY_LR_SUB_FLOOR = 0.000001

# --- Search space defaults ---
SEARCH_DEFAULT_STRENGTHS = (0.5, 1.0, 1.5, 2.0)
SEARCH_STRENGTH_RANGE_MIN = 0.1
SEARCH_STRENGTH_RANGE_MAX = 2.0
SEARCH_LAYER_OFFSET = 3
SEARCH_MAX_LAYER_CAP = 32
SEARCH_DEFAULT_LAYERS = (4, 6, 8, 10, 12)

# --- Auto optimization extras ---
AUTO_EVAL_SUBSET = 30
AUTO_MIN_PAIRS_SPLIT = 20
AUTO_LAYER_DIVISOR = 4
AUTO_COMPREHENSIVE_TIME_MINUTES = 20.0

# --- Sensitivity / calibration ---
SENSITIVITY_DEFAULT_STEPS = 5
SENSITIVITY_DEFAULT_CONSTANT_LIMIT = 50
SENSITIVITY_OPTUNA_TOP_N = 20
CALIBRATION_MIN_OBSERVATIONS = 5

# --- Evidence ledger ---
EVIDENCE_DOMINANCE_MARGIN = 0.02
EVIDENCE_MAX_AGE_DAYS = 90
EVIDENCE_CROSS_MODEL_DECAY = 0.5

# --- TECZA search ranges ---
TECZA_SEARCH_NUM_DIRECTIONS = (1, 2, 3, 5)
TECZA_SEARCH_OPT_STEPS = (50, 100)
TECZA_SEARCH_RETAIN_WEIGHTS = (0.0, 0.1, 0.3)

# --- TETNO search ranges ---
TETNO_SEARCH_STEERING_LAYERS = ("single", "range_3", "range_5")
TETNO_SEARCH_CONDITION_THRESHOLDS = (0.3, 0.5, 0.7)
TETNO_SEARCH_GATE_TEMPERATURES = (0.1, 0.5, 1.0)
TETNO_SEARCH_MAX_ALPHAS = (1.5, 2.0, 3.0)

# --- GROM search ranges ---
GROM_SEARCH_NUM_DIRECTIONS = (2, 3, 5)
GROM_SEARCH_STEERING_LAYERS = ("range_3", "range_5")
GROM_SEARCH_GATE_HIDDEN_DIMS = (32, 64, 128)
GROM_SEARCH_INTENSITY_HIDDEN_DIMS = (16, 32, 64)
GROM_SEARCH_OPT_STEPS = (100, 200)
GROM_SEARCH_BEHAVIOR_WEIGHTS = (0.5, 1.0)
GROM_SEARCH_RETAIN_WEIGHTS = (0.1, 0.2, 0.5)
GROM_SEARCH_SPARSE_WEIGHTS = (0.0, 0.05)
GROM_SEARCH_MAX_ALPHAS = (2.0, 3.0)

# --- Steering application defaults ---
STEERING_APP_INITIAL_TOKENS = 10
STEERING_APP_INITIAL_TOKENS_SHORT = 5
STEERING_APP_INITIAL_TOKENS_LONG = 20
STEERING_APP_DECAY_RATE = 0.1
STEERING_APP_DECAY_RATE_SLOW = 0.05
STEERING_APP_GAUSSIAN_CENTER = 0.5
STEERING_APP_GAUSSIAN_WIDTH = 0.2

# --- GROM loss weights ---
GROM_LOSS_CONTRASTIVE_WEIGHT = 2.0
GROM_LOSS_UTILITY_WEIGHT = 0.5
GROM_LOSS_CONCENTRATION_WEIGHT = 0.3
GROM_LOSS_GATE_WARMUP_WEIGHT = 0.5
GROM_LOSS_CONTRASTIVE_MARGIN = 2.0

# --- GROM geometry adaptation ---
GROM_ADAPT_CONE_THRESHOLD = 0.7
GROM_ADAPT_MANIFOLD_THRESHOLD = 0.8
GROM_ADAPT_LINEAR_DIRECTIONS = 1
GROM_ADAPT_COMPLEX_DIRECTIONS = 5
GROM_ADAPT_MAX_DIRECTIONS = 7

# --- GROM network dimension bounds ---
GROM_GATE_DIM_MIN = 32
GROM_GATE_DIM_MAX = 512
GROM_GATE_DIM_DIVISOR = 16
GROM_INTENSITY_DIM_MIN = 16
GROM_INTENSITY_DIM_MAX = 256
GROM_INTENSITY_DIM_DIVISOR = 32

# --- GROM loss: CAA alignment weight ---
GROM_LOSS_CAA_ALIGNMENT_WEIGHT = 0.5

# --- TECZA training ---
TECZA_SEPARATION_MARGIN = 1.0
TECZA_PERTURBATION_SCALE = 0.3
TECZA_UNIVERSAL_BASIS_NOISE = 0.1

# --- TETNO training ---
TETNO_CONDITION_MARGIN = 0.5
TETNO_MIN_LAYER_SCALE = 0.1

# --- MLP method ---
MLP_EARLY_STOPPING_PATIENCE = 20
MLP_INPUT_DIVISOR = 4

# --- Null test / metrics subsampling ---
MAX_PAIRS_FOR_NULL_TEST = 1000
MAX_PAIRS_FOR_METRICS = 1000

# --- Signal null test thresholds ---
NULL_TEST_Z_SCORE_NORMALIZER = 0.1

# --- Nonsense baseline defaults ---
NONSENSE_PAIRS_MIN = 30
NONSENSE_PAIRS_MAX = 100

# --- Threshold calibration quantiles ---
CALIBRATION_Q_NLI_MARGIN = 0.15
CALIBRATION_Q_NLI_ENT = 0.25
CALIBRATION_Q_EMB_DELTA = 0.10
CALIBRATION_Q_EMB_MATCH = 0.20
CALIBRATION_Q_PROBE_HIGH = 0.85
CALIBRATION_Q_PROBE_LOW = 0.35

# --- Optimize weights comparisons ---
WEIGHT_MIN_DISTANCE_FRACTION = 0.6

# --- Optimizer base thresholds ---
OPTIMIZER_CONSISTENCY_THRESHOLD = 0.5

# --- Diversity processor defaults ---
DIVERSITY_OPENER_PENALTY = -2.0
DIVERSITY_OPENER_CUTOFF_POS = 5
DIVERSITY_TRIE_PENALTY = -1.0
DIVERSITY_TRIE_MAX_DEPTH = 6
DIVERSITY_LEDGER_MAX_ITEMS = 200
DIVERSITY_SAMPLE_K = 5
DIVERSITY_MIN_CLAUSE_LENGTH = 12
DIVERSITY_MAX_CLAUSE_LENGTH = 80
DIVERSITY_WINDOW_SIZE = 6

# --- Clustering validation thresholds ---
CLUSTERING_MIN_SAMPLES = 20
CLUSTERING_STABILITY_THRESHOLD = 0.8
CLUSTERING_MAX_K_SEARCH = 6
CLUSTERING_BALANCE_THRESHOLD = 0.2
CLUSTERING_QUALITY_W_STABILITY = 0.4
CLUSTERING_QUALITY_W_K_CONF = 0.3
CLUSTERING_QUALITY_W_BALANCE = 0.3

# --- Intervention selection thresholds ---
INTERVENTION_CONFIDENCE_BASE = 0.5
INTERVENTION_MARGIN_WEIGHT = 0.3
INTERVENTION_Z_NORMALIZER = 3.0
INTERVENTION_CONF_STD_FACTOR = 0.1
INTERVENTION_MIN_SILHOUETTE = 0.1

# --- Advanced steering defaults ---
CLAMPING_MARGIN_DEFAULT = 0.1
CENTROID_SHIFT_FACTOR = 0.1
ADAPTIVE_MAX_STRENGTH = 2.0
ADVANCED_DEFAULT_STRENGTHS = (0.5, 1.0, 2.0, 5.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
