Fitted sklearn features

class protspect.sklearn.SequenceTransformer(*, embedding=None, method='fourier', length=None, normalization='none', center=False, standardize_channels=False, component='amplitude', transform_options=None, selector=None, kinds=('coefficients',), paired=False)[source]

Fit one coefficient-feature schema for every transform and single/paired inputs.

method selects fourier, z, mellin, or wavelet. embedding defaults to BLOSUM100. length defaults to the next power of two covering training chains only. Longer held-out chains raise. normalization and center operate on each real chain before padding. standardize_channels learns training-residue moments.

component is amplitude, phase, real, imaginary, or an ordered tuple thereof. kinds selects coefficients and/or cross_coefficients. selector receives a dictionary of coordinate arrays and returns a same-shape boolean mask; an explicit boolean mask is also accepted. It is evaluated only at fit, copied, and frozen. Transform-specific options (radius, mellin_c, wavelet, level, mode) go in transform_options. With paired=True, X contains (A, B) samples and features describe all ordered A/B channel products. Non-Fourier products remain coefficient products rather than frequency-domain cross-spectra.

Use inside a Pipeline so grid and channel moments fit within each CV fold. get_feature_metadata returns independent JSON-safe provenance. set_output supports pandas. Constructor mutations apply only after refitting; set_params invalidates fit. The SpectralTransformer compatibility subclass delegates here while preserving the original Fourier names, selection, and closure.

set_params(**params)[source]

Change settings and invalidate the fitted schema until the next fit.

fit(X, y=None)[source]

Freeze training-only grid, channel moments, selection, and column order.

transform(X)[source]

Apply only frozen settings without changing grids, moments, or selection.

fit_transform(X, y=None, **fit_params)[source]

Materialize generators only once, then use the same fit/transform path.

get_feature_names_out(input_features=None)[source]

Return independent feature names in output-column order.

get_feature_metadata()[source]

Return independent JSON-safe grids, scores, moments, controls, and names.