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

LINEARITY_CONFIDENCE_LOW = 0.2
LINEARITY_CROSS_CONTEXT_THRESHOLD = 0.7

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

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

# --- Cloud metrics ---
CLOUD_MAX_SAMPLES_MANIFOLD = 500
CLOUD_MAX_SAMPLES_TOPOLOGY = 300
CLOUD_CONE_PERCENTILE = 90

# --- Concept pairs ---
CONCEPT_MIN_SAMPLES = 10
CONCEPT_SEPARABILITY_HIGH = 0.95
CONCEPT_MIXED_PAIR_THRESHOLD = 0.3

# --- Configurable recommendation ---
RECOMMEND_CONFIDENCE_MARGIN_WEIGHT = 0.5
RECOMMEND_BASELINE_CONFIDENCE = 0.3

# --- Strategy diagnostics scoring ---
STRATEGY_DIAG_W_LINEAR = 0.3
STRATEGY_DIAG_W_CONSISTENCY = 0.4
STRATEGY_DIAG_W_STEERING = 0.3
STRATEGY_DIAG_AB_THRESHOLD = 0.5
STRATEGY_DIAG_AB_PENALTY = 0.5
STRATEGY_DIAG_NONLINEAR_GAP = 0.05
STRATEGY_DIAG_LOW_CONSISTENCY = 0.1
STRATEGY_DIAG_LOW_LINEAR_ACC = 0.7
STRATEGY_DIAG_LOW_SEMANTIC = 0.05

# --- Direction stability metrics ---
DIRECTION_N_BOOTSTRAP = 30
DIRECTION_SUBSET_FRACTION = 0.5
DIRECTION_STD_PENALTY = 0.5
CONSISTENCY_W_COSINE = 0.4
CONSISTENCY_W_POSITIVE = 0.3
CONSISTENCY_W_HIGH_SIM = 0.3

# --- Statistical power analysis ---
POWER_EXCELLENT_THRESHOLD = 0.9
POWER_LOW_THRESHOLD = 0.5
MDE_SMALL_THRESHOLD = 0.3
MDE_MEDIUM_THRESHOLD = 0.6
MDE_LARGE_THRESHOLD = 1.0

# --- Shrinkage interpretation ---
SHRINKAGE_LOW = 0.1
SHRINKAGE_MODERATE = 0.3
SHRINKAGE_HIGH = 0.6

# --- Guided weight modification ---
GUIDED_MIN_LINEAR_SCORE = 0.5
GUIDED_SURGICAL_TOP_K = 3
GUIDED_FISHER_WEIGHT_MIN = 0.1
GUIDED_FISHER_WEIGHT_MAX = 2.0
GUIDED_MAX_DEGRADATION = 0.1

# --- Probe k-NN default ---
PROBE_KNN_K = 10

# --- Sparsity metrics ---
SPARSITY_THRESHOLD_FRACTION = 0.01

# --- Concept stability ---
CONCEPT_STABILITY_N_BOOTSTRAP = 20

# --- SimHash deduplication ---
DEDUP_WORD_NGRAM = 3
DEDUP_CHAR_NGRAM = 4

# --- Guided modification scoring ---
GUIDED_VARIANCE_THRESHOLD = 0.05
GUIDED_STRONG_SIGNAL = 0.8
GUIDED_MODERATE_SIGNAL = 0.6
GUIDED_FISHER_MAX_BOOST = 0.3
GUIDED_FISHER_BOOST_SCALE = 0.1
GUIDED_FISHER_LOG_DIVISOR = 5.0
GUIDED_EFFECT_MAX_BOOST = 0.2
GUIDED_EFFECT_BOOST_SCALE = 0.1
GUIDED_COHENS_D_NORMALIZER = 2.0
GUIDED_NONLINEAR_PENALTY = 0.5
GUIDED_WEIGHT_MAX = 1.5

# --- TETNO export/load ---
TETNO_HYBRID_STRENGTH_FACTOR = 0.5
TETNO_GATE_TEMPERATURE_LEGACY = 0.5
TETNO_DYNAMIC_BASE_STRENGTH = 1.0

# --- Kernel-based baking ---
KERNEL_MIN_ALPHA = 0.5

# --- Evaluator scoring ---
EVAL_WEIGHT_EMBEDDING = 0.4
EVAL_WEIGHT_NLI = 0.6
EVAL_MIN_MARGIN = 0.05
EVAL_CONFIDENCE_CEILING = 0.95
EVAL_CONFIDENCE_BASELINE = 0.6
EVAL_NLI_THRESHOLD = 0.5
EVAL_NLI_CONF_CEILING = 0.85
EVAL_NLI_CONF_BASE = 0.6
EVAL_NLI_CONF_SCALE = 0.3
EVAL_EMB_THRESHOLD = 0.6
EVAL_EMB_CONF_CEILING = 0.8
EVAL_EMB_CONF_BASE = 0.5
EVAL_EMB_CONF_SCALE = 0.3
EVAL_F1_MATCH_THRESHOLD = 0.8
EVAL_F1_PARTIAL_THRESHOLD = 0.5
EVAL_DEFAULT_DIFFERENCE_SCORE = 50.0
EVAL_DIFFERENCE_CUTOFF = 70
EVAL_W_DIFFERENCE = 0.2
EVAL_W_QUALITY = 0.3
EVAL_W_ALIGNMENT = 0.5

# --- Geometry adaptive thresholds ---
GEOMETRY_ADAPT_THRESHOLD_NUMERATOR = 0.5
GEOMETRY_ADAPT_THRESHOLD_MIN = 0.02
GEOMETRY_ADAPT_THRESHOLD_MAX = 0.1

# --- Coherence detection thresholds ---
COHERENCE_FUNCTION_WORD_THRESHOLD = 0.15
COHERENCE_SPACE_RATIO_MIN = 0.08
COHERENCE_LONG_TOKEN_LEN = 25
COHERENCE_LONG_TOKEN_RATIO = 0.1
COHERENCE_VALIDITY_RATIO_MIN = 0.3
COHERENCE_UNIQUE_TOKEN_RATIO_MIN = 0.4
COHERENCE_REPETITION_RATIO_MAX = 0.3
COHERENCE_SPECIAL_CHAR_RATIO_MAX = 0.2
COHERENCE_SPECIAL_CHAR_PENALTY = 0.7
COHERENCE_SHORT_RESPONSE_PENALTY = 0.1
COHERENCE_NONSENSE_WORD_RATIO_MAX = 0.15
COHERENCE_TRIGRAM_REPEAT_THRESHOLD = 3
COHERENCE_CONTENT_WORD_REPEAT_THRESHOLD = 3

# --- Perplexity evaluator ---
EVAL_PERPLEXITY_DIFF_THRESHOLD = 1.0

# --- Intervention scoring increments ---
INTERVENTION_SCORE_LOW_DIM_CAA = 1.0
INTERVENTION_SCORE_LOW_DIM_OSTRZE = 0.5
INTERVENTION_SCORE_NO_LOW_DIM = 0.5
INTERVENTION_SCORE_LINEAR_CAA = 2.0
INTERVENTION_SCORE_LINEAR_OSTRZE = 1.5
INTERVENTION_SCORE_NONLINEAR_MLP = 1.5
INTERVENTION_SCORE_NONLINEAR_OSTRZE = 1.0
INTERVENTION_SCORE_NONLINEAR_GROM = 0.5
INTERVENTION_SCORE_FRAGMENTED_TECZA = 2.0
INTERVENTION_SCORE_FRAGMENTED_GROM = 1.0
INTERVENTION_SCORE_FRAGMENTED_CAA_PENALTY = -1.0
INTERVENTION_SCORE_SINGLE_CAA = 0.5
INTERVENTION_SCORE_TRANSLATION_CAA = 1.0

# --- Agent defaults ---
AGENT_DEFAULT_SAMPLES = 25
AGENT_STEERING_THRESHOLD = 0.6
AGENT_QUALITY_THRESHOLD = 0.3
AGENT_DEFAULT_TIME_BUDGET = 5.0
AGENT_DEFAULT_TIME_BUDGET_INIT = 10.0
AGENT_DEMO_TIME_BUDGET = 2.0
TASK_FUZZY_MATCH_THRESHOLD = 0.6
# TASK_MIN_RELEVANCE_SCORE defined in _arb_09 (=0.1)

# --- PaCMAP optimization phases ---
PACMAP_INITIAL_SCALE = 0.01
PACMAP_W_NEAR = 1.0
PACMAP_W_MID = 0.5
PACMAP_W_FAR = 0.1
PACMAP_PHASE_1_END = 0.1
PACMAP_PHASE_2_END = 0.35
PACMAP_P1_NEAR = 2.0
PACMAP_P1_MID = 0.5
PACMAP_P1_FAR = 0.01
PACMAP_P2_NEAR = 3.0
PACMAP_P2_MID = 1.0
PACMAP_P2_FAR = 0.1
PACMAP_P3_NEAR = 1.0
PACMAP_P3_MID = 0.5
PACMAP_P3_FAR = 1.0
PACMAP_FAR_REPULSE_EPS = 0.01

# --- Optuna search bounds (shared across methods) ---
OPTUNA_OPT_STEPS_MIN = 50
OPTUNA_OPT_STEPS_MAX = 500
OPTUNA_MAX_ALPHA_MIN = 0.5
OPTUNA_MAX_ALPHA_MAX = 5.0
OPTUNA_RETAIN_WEIGHT_MIN = 0.0
OPTUNA_RETAIN_WEIGHT_MAX = 1.0
OPTUNA_NUM_DIRECTIONS_MIN = 1
OPTUNA_NUM_DIRECTIONS_MAX = 10
OPTUNA_INFERENCE_K_MIN = 1
OPTUNA_INFERENCE_K_MAX = 15
OPTUNA_TEMPERATURE_MIN = 0.01
OPTUNA_TEMPERATURE_MAX = 2.0
OPTUNA_VARIANCE_MIN = 0.5
OPTUNA_VARIANCE_MAX = 0.99

# --- Optuna MLP bounds ---
OPTUNA_MLP_HIDDEN_DIM_MIN = 32
OPTUNA_MLP_HIDDEN_DIM_MAX = 1024
OPTUNA_MLP_NUM_LAYERS_MIN = 1
OPTUNA_MLP_NUM_LAYERS_MAX = 5

# --- Optuna GROM architecture bounds ---
OPTUNA_GROM_GATE_DIM_MIN = 16
OPTUNA_GROM_GATE_DIM_MAX = 256
OPTUNA_GROM_INTENSITY_DIM_MIN = 8
OPTUNA_GROM_INTENSITY_DIM_MAX = 128
OPTUNA_GROM_SPARSE_WEIGHT_MIN = 0.0
OPTUNA_GROM_SPARSE_WEIGHT_MAX = 0.5

# --- Optuna NURT integration ---
OPTUNA_NURT_STEPS_MIN = 2
OPTUNA_NURT_STEPS_MAX = 8

# --- Optuna SZLAK (log-scale needs non-zero min) ---
OPTUNA_SZLAK_REG_MIN = 0.01

# --- Optuna WICHER ---
OPTUNA_WICHER_CONCEPT_DIMS = (0, 8, 16)
OPTUNA_WICHER_STEPS_MIN = 1
OPTUNA_WICHER_STEPS_MAX = 5

# --- Optuna PRZELOM ---
OPTUNA_PRZELOM_TARGET_MODES = ("uniform", "nearest")

# --- Default steering layers (TETNO/GROM optimizer configs) ---
DEFAULT_STEERING_LAYERS = (20, 21, 22)

# --- Search space: MLP ---
SEARCH_MLP_HIDDEN_DIMS = (128, 256, 512)
SEARCH_MLP_NUM_LAYERS = (1, 2, 3)

# --- Search space: TETNO/GROM shared ---
SEARCH_STEERING_RANGES = (3, 5)

# --- Search space: GROM ---
SEARCH_GROM_GATE_HIDDEN_DIMS = (32, 64)
SEARCH_GROM_INTENSITY_HIDDEN_DIMS = (16, 32)

# --- Hierarchical config: strengths ---
HIERARCHICAL_STRENGTHS = (0.3, 0.5, 0.7, 1.0, 1.3, 1.5, 2.0, 2.5, 3.0)

# --- Hierarchical config: MLP ---
HIERARCHICAL_MLP_HIDDEN_DIMS = (64, 128, 256, 512)
HIERARCHICAL_MLP_NUM_LAYERS_LIST = (1, 2, 3)

# --- Hierarchical config: TECZA ---
HIERARCHICAL_TECZA_DIRECTIONS = (1, 2, 3, 5)
HIERARCHICAL_TECZA_OPT_STEPS_LIST = (50, 100, 200)

# --- Hierarchical config: TETNO ---
HIERARCHICAL_TETNO_THRESHOLDS = (0.3, 0.5, 0.7)
HIERARCHICAL_TETNO_TEMPERATURES = (0.05, 0.1, 0.2, 0.5)

# --- Hierarchical config: GROM ---
HIERARCHICAL_GROM_DIRECTIONS = (3, 5, 8)
HIERARCHICAL_GROM_TEMPERATURES = (0.3, 0.5, 1.0)
