|
23 | 23 | from llm_fingerprinter.fingerprinter import LLMFingerprinter |
24 | 24 | from llm_fingerprinter.fingerprint_store import FingerprintStore |
25 | 25 | from llm_fingerprinter.template_classifier import TemplateClassifier |
26 | | -from llm_fingerprinter.training_data import balance_grouped_samples |
27 | 26 | from llm_fingerprinter.plotting import FingerprintPlotError, plot_fingerprint_projection |
28 | 27 | from llm_fingerprinter.contracts.llm import LLMRequest, Message |
29 | 28 | from llm_fingerprinter.providers import create_provider |
@@ -575,13 +574,8 @@ def simulate(ctx, backend, endpoint, api_key, request_file, model, family, num_s |
575 | 574 | help='Run k-fold cross-validation before training') |
576 | 575 | @click.option('--cv-folds', default=5, type=int, |
577 | 576 | help='Number of cross-validation folds (default: 5)') |
578 | | -@click.option('--balance/--no-balance', default=True, show_default=True, |
579 | | - help='Downsample each family to the same number of fingerprints.') |
580 | | -@click.option('--balance-seed', default=42, type=int, show_default=True, |
581 | | - help='Random seed used for reproducible family balancing.') |
582 | 577 | @click.pass_context |
583 | | -def train(ctx, augment, use_pca, pca_components, cross_validate, cv_folds, |
584 | | - balance, balance_seed): |
| 578 | +def train(ctx, augment, use_pca, pca_components, cross_validate, cv_folds): |
585 | 579 | """Train classifier from saved fingerprints. |
586 | 580 |
|
587 | 581 | \b |
@@ -612,24 +606,6 @@ def train(ctx, augment, use_pca, pca_components, cross_validate, cv_folds, |
612 | 606 | click.echo(" Run 'simulate' first") |
613 | 607 | sys.exit(1) |
614 | 608 |
|
615 | | - if balance: |
616 | | - original_counts = { |
617 | | - family: len(vectors) |
618 | | - for family, vectors in training_data.items() |
619 | | - if vectors |
620 | | - } |
621 | | - training_data, target_count = balance_grouped_samples( |
622 | | - training_data, seed=balance_seed |
623 | | - ) |
624 | | - click.echo( |
625 | | - f"\nBalanced each family to {target_count} samples " |
626 | | - f"(seed={balance_seed}):" |
627 | | - ) |
628 | | - for family, vectors in sorted(training_data.items()): |
629 | | - click.echo( |
630 | | - f" {family}: {original_counts[family]} -> {len(vectors)}" |
631 | | - ) |
632 | | - |
633 | 609 | click.echo("\n📊 Training data:") |
634 | 610 | total = 0 |
635 | 611 | for fam, vecs in sorted(training_data.items()): |
@@ -1045,12 +1021,8 @@ def fingerprint(ctx, backend, endpoint, api_key, request_file, model, repeats, o |
1045 | 1021 | @cli.command('build-templates') |
1046 | 1022 | @click.option('--ood-ratio', default=0.80, type=float, show_default=True, |
1047 | 1023 | help='OOD ratio threshold (lower = stricter OOD detection).') |
1048 | | -@click.option('--balance/--no-balance', default=True, show_default=True, |
1049 | | - help='Downsample each family to the same number of fingerprints.') |
1050 | | -@click.option('--balance-seed', default=42, type=int, show_default=True, |
1051 | | - help='Random seed used for reproducible family balancing.') |
1052 | 1024 | @click.pass_context |
1053 | | -def build_templates(ctx, ood_ratio, balance, balance_seed): |
| 1025 | +def build_templates(ctx, ood_ratio): |
1054 | 1026 | """Build open-set template classifier from training fingerprints. |
1055 | 1027 |
|
1056 | 1028 | Templates let you classify new families without retraining the ensemble — |
@@ -1078,24 +1050,6 @@ def build_templates(ctx, ood_ratio, balance, balance_seed): |
1078 | 1050 | click.echo(" Run 'simulate' first") |
1079 | 1051 | sys.exit(1) |
1080 | 1052 |
|
1081 | | - if balance: |
1082 | | - original_counts = { |
1083 | | - family: len(vectors) |
1084 | | - for family, vectors in training_data.items() |
1085 | | - if vectors |
1086 | | - } |
1087 | | - training_data, target_count = balance_grouped_samples( |
1088 | | - training_data, seed=balance_seed |
1089 | | - ) |
1090 | | - click.echo( |
1091 | | - f"\nBalanced each family to {target_count} samples " |
1092 | | - f"(seed={balance_seed}):" |
1093 | | - ) |
1094 | | - for family, vectors in sorted(training_data.items()): |
1095 | | - click.echo( |
1096 | | - f" {family:12s} {original_counts[family]} -> {len(vectors)}" |
1097 | | - ) |
1098 | | - |
1099 | 1053 | click.echo("\n📊 Training data:") |
1100 | 1054 | for fam, vecs in sorted(training_data.items()): |
1101 | 1055 | click.echo(f" {fam:12s} {len(vecs)} samples") |
|
0 commit comments