diff_diff.SieveLearner#
- class diff_diff.SieveLearner[source]#
Bases:
objectPolynomial-sieve regressor with information-criterion degree selection.
For each candidate total degree
K = 1..k_max(autok_max = floor(n_pos**0.2), floored at 1, wheren_posis the positive-weight support count; degrees whose basis dimension reachesn_posare inadmissible), builds the monomial basis via the EfficientDiD sieve helper, fits by (W)LS, and scoresIC(K) = n_pos * log(RSS_w / n_pos) + c_n * p_Kwithc_n = 2(AIC) orlog(n_pos)(BIC). Degrees with an ill-conditioned (weighted) design Gram are skipped (one consolidatedUserWarning). If EVERY degree is inadmissible on a non-empty support, falls back to an intercept-only (weighted-mean) fit with aUserWarning; genuinely degenerate inputs (empty data, fewer than 2 positive-weight rows) raise a targetedValueErrorinstead (the fail-closed sibling contract).The standardization statistics
center_/scale_are UNWEIGHTED even undersample_weight— the helper standardizes for numerical conditioning only, and fitted values are standardization-invariant. Fitted state is plain floats/ndarrays (deep-copyable, picklable);fitfully re-initializes it (sklearn fit-reset semantics).Methods
__init__([k_max, criterion])fit(X, y[, sample_weight])predict(X)- classmethod __new__(*args, **kwargs)#