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

CLASSIFIER_SCORE_TOKEN_SUBSTRING = 1.0
CLASSIFIER_SCORE_TOKEN_SEMANTIC = 0.5
CLASSIFIER_SIMILARITY_CHAR_THRESHOLD = 0.6
CLASSIFIER_SIMILARITY_AFFIX_THRESHOLD = 0.4
CLASSIFIER_SIMILARITY_AFFIX_MIN_LEN = 3
CLASSIFIER_NAME_LENGTH_MIN = 8
CLASSIFIER_NAME_LENGTH_MAX = 25
CLASSIFIER_QUALITY_GOOD_LENGTH = 2.0
CLASSIFIER_QUALITY_SHORT_NAME = 0.5
CLASSIFIER_QUALITY_LONG_NAME = 1.0
CLASSIFIER_PARTS_OPTIMAL_MIN = 2
CLASSIFIER_PARTS_OPTIMAL_MAX = 3
CLASSIFIER_QUALITY_OPTIMAL_PARTS = 2.0
CLASSIFIER_QUALITY_SINGLE_PART = 1.5
CLASSIFIER_QUALITY_MANY_PARTS = 0.5
CLASSIFIER_PENALTY_EXPERIMENTAL = 1.0
CLASSIFIER_BONUS_DOMAIN_DIVERSITY = 0.5
# --- Classifier benchmark ---
CLASSIFIER_BENCHMARK_SAMPLES = 50
SELECT_MAX_CLASSIFIERS = 10
TASK_RELEVANCE_MAX_RESULTS = 20
TASK_SELECTOR_MAX_TASKS = 10
# --- Layer threshold patterns (model size) ---
LAYER_THRESHOLD_SMALL = 16
LAYER_THRESHOLD_MEDIUM = 32
LAYER_THRESHOLD_LARGE = 48
# --- GPTZero detector ---
GPTZERO_MIN_TEXT_LENGTH = 50
GPTZERO_DEFAULT_NEUTRAL_SCORE = 0.5
GPTZERO_AI_PROB_WEIGHT = 0.7
GPTZERO_AVG_PROB_WEIGHT = 0.3
# --- Generation evaluator ---
GEN_EVAL_HIGH_CONFIDENCE = 0.9
# --- Method training layer range ---
DEFAULT_METHOD_LAYER_RANGE_END = 37
# --- Optuna pruning ---
OPTUNA_PRUNE_ACCURACY_THRESHOLD = 0.35
# --- Classifier cache ---
LAYER_CACHE_DECAY_DENOMINATOR = 10.0
LAYER_CACHE_MIN_SCORE = 0.1
# --- Classifier bonus ---
CLASSIFIER_BONUS_MAX = 0.2
CLASSIFIER_BONUS_SAMPLE_DENOM = 1000
# --- NLI evaluator ---
NLI_ENTAILMENT_THRESHOLD = 0.45
# --- Coherence evaluator ---
COHERENCE_RATIO_THRESHOLD = 0.5
# --- Accuracy margin ---
STABILITY_ACCURACY_MARGIN = 0.1
# --- TETNO condition vector optimization ---
TETNO_CONDITION_VEC_OPT_ITERS = 50
# --- Basic metrics ---
PERCENTILE_P10 = 10
PERCENTILE_P25 = 25
PERCENTILE_P75 = 75
PERCENTILE_P90 = 90
ALIGNMENT_HIGH_THRESHOLD = 0.5
METRICS_TOP_INDICES_LIMIT = 20
METRICS_THRESHOLD_FRACTION_DEFAULT = 0.01
CUMSUM_THRESHOLD_50 = 0.5
CUMSUM_THRESHOLD_90 = 0.9
CUMSUM_THRESHOLD_99 = 0.99
# --- Steerability ---
STEERABILITY_MIN_PAIRS = 5
# --- Linearity layer sampling ---
LINEARITY_LAYER_SAMPLING_DIVISOR = 8

# --- Layer sampling divisors ---
LAYER_SAMPLING_DIVISOR_TRAINING = 4
SENSOR_LAYER_SAMPLING_DIVISOR = 6

# --- Task interface ---
RANDOM_MATH_ANSWER_MAX = 1000

# --- Refusal detection weights ---
REFUSAL_WEIGHT_CANNOT_ACTION = 1.0
REFUSAL_WEIGHT_PREFER_RATHER = 0.6
REFUSAL_WEIGHT_DECLINE_REFUSE = 0.9
REFUSAL_WEIGHT_NO_SUPPORT = 0.8
REFUSAL_WEIGHT_NO_ABILITY = 0.8
REFUSAL_WEIGHT_REFUSAL_WORD = 0.6
REFUSAL_DETECTION_THRESHOLD = 0.9
REFUSAL_APOLOGY_BONUS = 0.1

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

# --- Evaluation confidence ---
EVAL_CONFIDENCE_BASE = 0.5
NLP_EVAL_CONFIDENCE_BASE = 0.75

# --- Quality evaluation clamp ---
QUALITY_THRESHOLD_CLAMP_MIN = 0.1
QUALITY_THRESHOLD_CLAMP_MAX = 0.9

# --- Classifier thresholds ---
CLASSIFIER_MIN_TARGET_SCORE = 0.7
CLASSIFIER_MIN_PERFORMANCE_SCORE = 0.1

# --- Task relevance ---
TASK_MIN_RELEVANCE_SCORE = 0.1

# --- Subspace validation ---
SUBSPACE_ROBUSTNESS_NOISE_SCALE = 0.1

# --- Steering search grids ---
CAA_MIN_COSINE_SIMILARITY = 0.3
CAA_MAX_COSINE_SIMILARITY = 0.95
# TECZA_INDEPENDENCE_WEIGHT defined in _arb_01 (=0.05)
# TECZA_LEARNING_RATE defined in _arb_01 (=0.01)
GROM_SPARSE_WEIGHT_OPTIONS = (0.0, 0.05, 0.1)

# --- Advanced steering ---
CLAMPING_STEERING_MARGIN = 0.5
BETA_SEARCH_GRID = (0.3, 0.5, 0.7, 0.9)

# --- Hyperparameter optimizer ---
THRESHOLD_RANGE_DEFAULT = (0.3, 0.4, 0.5, 0.6, 0.7, 0.8)

# --- Code evaluation ---
CODE_CORRECTNESS_THRESHOLD = 0.5

# --- Optimizer registry bounds ---
GROM_LR_UPPER = 0.05
GROM_RETAIN_UPPER = 0.3
GROM_SPARSE_UPPER = 0.2
GROM_BEHAVIOR_UPPER = 10.0
GROM_STEPS_UPPER = 1000
GROM_LAMBDA_UPPER = 2.0
TECZA_RETAIN_UPPER = 1.0
TECZA_DIRECTIONS_UPPER = 5.0
TECZA_INDEPENDENCE_UPPER = 0.5
TETNO_GATE_TEMP_LOWER = 0.1
TETNO_GATE_TEMP_UPPER = 2.0
TETNO_CONDITION_UPPER = 0.9
TETNO_ALPHA_UPPER = 5.0
TETNO_DIRECTIONS_UPPER = 1.5

# --- K-values for benchmarks ---
LIVEMATHBENCH_K_VALUES = (4, 8, 16)
LIVEMATHBENCH_K_VALUES_SMALL = (2, 4, 8)
BIGCODE_K_VALUES = (1, 10, 100)
DIRECTION_K_VALUES = (1, 2, 3, 5, 10)
CONCEPT_DETECTION_COARSE_K = (
    2, 3, 5, 8, 10, 15, 20, 30, 50, 75, 100, 150, 200,
)

# --- Pair count ablation ---
PAIR_COUNT_ABLATION_SERIES = (10, 25, 50, 100, 200)

# --- Optuna classifier ---
OPTUNA_CLASSIFIER_BATCH_SIZES = (16, 32, 64)

# --- TETNO threshold search ---
# TETNO_THRESHOLD_SEARCH_STEPS defined in _arb_01 (=20)
THRESHOLD_SEARCH_INIT_VALUE = 0.5

# --- Benchmark relevance priority bonuses ---
RELEVANCE_PRIORITY_BONUS_FAST_HIGH = 0.15
RELEVANCE_PRIORITY_BONUS_HIGH = 0.05
RELEVANCE_PRIORITY_BONUS_MEDIUM = 0.02

# --- Diversity sampling ---
DIVERSITY_MAX_SAMPLE_SIZE = 20

# --- Optimization limits ---
OPTIMIZATION_BENCHMARK_LIMIT = 50
METHOD_SELECTION_SAMPLE_SIZE = 50
MIN_LAYER_ACTIVATIONS_FOR_GEOMETRY = 10
PAIRS_ABLATION_DEFAULT_MIN = 50

# --- Extraction batch ---
EXTRACTION_DB_BATCH_SIZE = 50

# --- SimHash dedup ---
SIMHASH_DEFAULT_THRESHOLD_BITS = 3
SIMHASH_RELAXED_THRESHOLD_BITS = 10
SIMHASH_DEFAULT_NUM_BANDS = 8

# --- Discover steering ---
DISCOVER_STEERING_TASK_LIMIT = 1000
DISCOVER_STEERING_TRAIN_LIMIT = 500

# --- Continual loop ---
CONTINUAL_LOOP_QUERY_LIMIT = 20

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

# --- NLI reverse entailment ---
NLI_REVERSE_ENTAILMENT_THRESHOLD = 0.50
NLI_CONFIDENCE_BASE_WEIGHT = 0.7
NLI_CONFIDENCE_SCALE_WEIGHT = 0.3

# --- Exhaustive search ---
EXHAUSTIVE_SEARCH_TOP_K = 50
AGENT_SYNTH_PAIRS_PER_ISSUE = 5
AGENT_BENCH_MIN_PAIRS_TRAINING = 3

# --- FGAA comparison ---
FGAA_DENSITY_THRESHOLD = 0.01
FGAA_TOP_K_POSITIVE = 50
FGAA_TOP_K_NEGATIVE = 0

# --- LoRA comparison defaults ---
LORA_DEFAULT_DROPOUT = 0.05

# --- LiveMathBench tau ---
LIVEMATHBENCH_TAU_VALUES = (0.25, 0.5, 0.75, 1.0)

# --- Search space string options ---
STEERING_STRATEGIES = (
    "constant", "initial_only", "diminishing", "increasing", "gaussian",
)
TOKEN_AGGREGATIONS = (
    "last_token", "mean_pooling", "first_token", "max_pooling",
    "continuation_token",
)
PROMPT_CONSTRUCTIONS = (
    "chat_template", "direct_completion", "multiple_choice",
    "role_playing", "instruction_following",
)
DIRECTION_WEIGHTING_OPTIONS = ("primary_only", "equal", "learned")

# --- Hyperparameter optimizer string options ---
OPTIMIZER_AGGREGATION_METHODS = (
    "average", "final", "first", "max", "min",
)
OPTIMIZER_TOKEN_TARGETING = (
    "choice_token", "continuation_token", "last_token",
    "first_token", "mean_pooling",
)

# --- Classifier cache scoring weights ---
CACHE_WEIGHT_MODEL_NAME = 0.4
CACHE_WEIGHT_TASK_NAME = 0.3
CACHE_WEIGHT_MODEL_TYPE = 0.2
CACHE_WEIGHT_LAYER_PROXIMITY = 0.1

# --- Search space layer/dim configs ---
SENSOR_LAYER_CONFIGS = ("middle",)
TETNO_STEERING_LAYER_CONFIGS = ("single_best", "range_3", "range_5")
GROM_STEERING_LAYER_CONFIGS = ("range_3", "range_5")
GROM_MAX_ALPHA_SEARCH = (2.0, 3.0, 5.0)

# --- Comparison module defaults ---
COMPARISON_EVAL_BATCH_SIZE = 64
COMPARISON_NUM_PAIRS = 50
COMPARISON_TEST_SIZE = 20
COMPARISON_STEERING_LAYER = 12

# --- LiveMathBench sampling ---
LIVEMATHBENCH_NUM_SAMPLES = 48

# --- Extraction script limits ---
EXTRACTION_DEFAULT_PAIR_LIMIT = 500

# --- Concept detection thresholds ---
CONCEPT_PCA_VARIANCE_90 = 0.90
CONCEPT_BIC_STRONG_THRESHOLD = 10
CONCEPT_SILHOUETTE_STRONG = 0.15
CONCEPT_SILHOUETTE_MODERATE = 0.08
CONCEPT_DIRECTION_DISTINCT = 0.15
CONCEPT_DIRECTION_MODERATE = 0.25
CONCEPT_STABILITY_THRESHOLD = 0.85
CONCEPT_K_DIRECTION_THRESHOLD = 0.20

# --- Training hyperparameters (comparison module) ---
TRAINING_WARMUP_RATIO = 0.1
