classification¶
Experimental learner-aware classification with independent fitted feature plans.
This opt-in API does not change AutoFeatureEngineer. CPU LogisticRegression and LGBMClassifier are verified; other cloneable numeric/OHE probabilistic classifiers must satisfy the same interface. There is no automatic learner/mode policy, native CatBoost representation, calibration, external evaluation, or provider access.
FeatureEnsembleClassifier
¶
Bases: ClassifierMixin, BaseEstimator
Experimental prediction artifact with independent fitted feature plans.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
estimator
|
sklearn classifier
|
Bare cloneable probabilistic classifier. CPU LogisticRegression and LGBMClassifier are verified; supply native learner randomness/thread/device controls explicitly. No native categorical learner adapter is selected. |
required |
parameter_candidates
|
sequence of dict
|
Exactly three native-parameter dictionaries for each member's inner search. Class-weight dictionaries use original labels, including NumPy scalar keys; unknown class keys fail before model fitting. |
required |
mode
|
('single', 'subsample85', 'raw_fe_average')
|
Required explicit mode. Single refits the winner on all supplied training rows. Subsample85 fits three 85% bags and averages native probabilities; it never fits a calibrator or a subsequent all-training model. Raw_fe_average independently fits complete raw then FE procedures on all supplied TRAIN and uses a fixed 50:50 probability average. No blend-weight optimization, OOF weight fitting, or calibration is performed. |
"single"
|
engineered
|
bool
|
Enable the fixed extended/frequency, importance, paired-gain FE procedure. False is the matched raw control. In raw_fe_average mode it fits only one raw full-TRAIN procedure, with weight one and no FE procedure. |
True
|
random_state
|
int
|
Split and FE seed, not an override of the bare estimator's random state. |
42
|
n_jobs
|
int
|
Positive FE/threadpool limit; members fit sequentially. |
8
|
stability_repeats
|
int
|
Internal FE holdout repeats (one to ten). |
3
|
max_added_features
|
int
|
Per-member added-feature cap (zero to fifty), never a feature union cap. |
50
|
max_candidates
|
int
|
FE candidate cap (one to one thousand). |
1000
|
numeric_clip_quantiles
|
tuple[float, float]
|
Shared post-generation fitted min/max clipping. Other policies are rejected. |
(0.0, 1.0)
|
categorical_encoding
|
('one_hot', 'target')
|
Categorical model representation, shared by feature selection and final prediction. Target mode uses fixed five-fold cross-fitting, requires sklearn >=1.4 only for active categorical blocks, and adds no feature operators. It preserves raw category types before feature generation, unlike OHE's legacy string normalization. Fitted categorical literals may differ. |
"one_hot"
|
Attributes:
| Name | Type | Description |
|---|---|---|
estimators_ |
tuple[NestedBaseClassifier, ...]
|
Actual fitted complete procedures, each with its own raw schema and FE plan. |
classes_ |
ndarray
|
Original class labels in probability-column order. |
member_reports_ |
list[dict]
|
Compact per-member selection, feature, timing and sampling diagnostics. |
weights_ |
tuple[float, ...]
|
Present only for raw_fe_average: (0.5, 0.5), or (1.0,) for its raw control. |
member_roles_ |
tuple[str, ...]
|
Present only for raw_fe_average, in fitted order: ("raw", "fe") or ("raw",). |
Notes
DataFrame-only, IID classification. Group/time metadata, sample weights, external validation sets and all additional fit arguments are rejected. This is a prediction artifact: there is no common transform or union feature plan. Pickle/joblib artifacts contain private fitted maps and should be treated as trusted models; diagnostics() excludes vocabularies and raw rows. In-memory prediction does not require pickle support: nonserializable state has a null diagnostic fingerprint and an explicit unavailable reason. Raw_fe_average preserves normalized member probabilities and performs no additional normalization of their convex average. Its raw control uses that same member normalization, unlike single's native-probability convention. Development evidence for this mode is limited to one-hot LightGBM; it is not a SOTA, no-harm, or target-encoding improvement claim and changes no default.
Source code in featcopilot/classification.py
662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 | |
diagnostics()
¶
Return a JSON-safe report, excluding models, vocabularies and predictions.
Source code in featcopilot/classification.py
fit(X, y, **fit_params)
¶
Fit independent complete TRAIN-local members, publishing state atomically.
Source code in featcopilot/classification.py
get_feature_plans()
¶
Return independent defensive member plans, never a fabricated union.
predict(X)
¶
Return one-dimensional original labels by mean-probability argmax.
predict_proba(X)
¶
Average aligned probabilities of the actual retained fitted members.
Source code in featcopilot/classification.py
set_params(**params)
¶
Set parameters without mutating the caller's estimator prototype.
NestedBaseClassifier
¶
Bases: ClassifierMixin, BaseEstimator
A reusable, cloneable complete inner search and winning refit procedure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
estimator
|
sklearn classifier
|
Bare cloneable classifier with predict_proba, not a Pipeline or regressor. CPU LogisticRegression and LGBMClassifier are verified. Supply learner seed, thread/device settings and iteration limits explicitly. |
required |
parameter_candidates
|
sequence of dict
|
Exactly three dictionaries of native estimator parameters, evaluated in order. First minimum inner log loss wins. Inputs are never mutated. Class-weight dictionary keys refer to original labels; owned trial/refit copies map them to encoded classes. Unknown keys are rejected; partial dictionaries retain the learner's default weight for omitted classes. |
required |
engineered
|
bool
|
Enable extended/frequency candidates with importance screening, importance_resamples=1 and paired_gain selection. |
True
|
random_state
|
int
|
Fixed split and feature-selection seed, not an override of learner seeds. |
42
|
n_jobs
|
int
|
Positive FE job/threadpool limit. Base procedures are fitted sequentially. |
8
|
stability_repeats
|
int
|
Feature-selection holdout repeats, from one to ten. |
3
|
max_added_features
|
int
|
Per-member added-feature cap, from zero to fifty. |
50
|
max_candidates
|
int
|
Feature candidate cap, from one to one thousand. |
1000
|
numeric_clip_quantiles
|
tuple[float, float]
|
Shared fitted min/max policy; other quantile policies are not supported. |
(0.0, 1.0)
|
categorical_encoding
|
('one_hot', 'target')
|
Fixed cross-fitted target encoding is opt-in and requires at least five rows per class in every actual categorical TRAIN fit. Numeric-only inputs require no target encoder. Feature definitions are unchanged. Target mode preserves raw category types before generation and encoding; stored categorical-pair literals can therefore differ from OHE's legacy string-normalized literals, without changing the operator catalog. |
"one_hot"
|
Notes
Only IID classification is supported. Any fit metadata, sample weights, or external validation arguments are rejected. Each fit owns a 75/25 inner split, three FE/model trials and an independent winning refit on all supplied TRAIN rows. Normalization is stateless; preprocessing is fitted locally.
Source code in featcopilot/classification.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | |
decision_function(X)
¶
Expose native margins only if this member's fitted pipeline supports them.
Source code in featcopilot/classification.py
diagnostics(*, warn_on_unavailable=True)
¶
Return diagnostics with explicit unavailable hashes for unpickleable state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
warn_on_unavailable
|
bool
|
Log once per fitted member if pickle cannot fingerprint its state. The enclosing public classifier suppresses member warnings and emits one aggregate warning per fit instead. Exporting the actual model still uses ordinary pickle/joblib behavior and may fail. |
True
|
Source code in featcopilot/classification.py
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | |
fit(X, y, **fit_params)
¶
Fit on supplied TRAIN only; unsupported metadata fails before any fitting.
Source code in featcopilot/classification.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 | |
get_feature_plan()
¶
Return this member's defensive fitted plan, including private fitted maps.
Source code in featcopilot/classification.py
predict(X)
¶
Return one-dimensional original class labels by native probability argmax.
predict_proba(X)
¶
Transform through this member's own FE plan and fitted preprocessing.
set_params(**params)
¶
aligned_probability(probability, actual_classes, expected_classes, rows, *, normalize=True)
¶
Validate and align class probabilities without fabricating missing classes.
Source code in featcopilot/classification.py
classification_target(y, rows)
¶
Require nonmissing one-dimensional classification labels aligned by position.
Source code in featcopilot/classification.py
inner_split(y, seed, scope)
¶
Construct the fixed stratified 75/25 split and validate both class sets.
Source code in featcopilot/classification.py
make_subsample85_splits(y, seed=42)
¶
Return three fixed, ordered stratified 85% bags and their complements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
Series or ndarray
|
Classification labels in original training order. |
required |
seed
|
int
|
Inner seed. Sampling starts at seed + 32452843 modulo 2**32, with consecutive seeds. All complements and inner splits must retain classes. |
42
|
Returns:
| Type | Description |
|---|---|
list[tuple[ndarray, ndarray]]
|
Three training/complement position pairs. Overlap and repeated bags are allowed; there is no redraw, row deduplication, or OOF coverage promise. |
Source code in featcopilot/classification.py
positions_report(positions, y, classes, *, membership=False)
¶
Describe positional membership by counts and hashes, never raw indices.
Source code in featcopilot/classification.py
require_classes(target, classes, scope)
¶
Reject partitions missing classes without reducing folds or retrying.
Source code in featcopilot/classification.py
validate_probabilities(probability, rows, n_classes, *, normalize=True)
¶
Validate probabilities; optionally preserve legal native single-model roundoff.