/** For internal use only */ export declare type PolynomialFeaturesConfig = { degree: number; homogeneous: boolean; interactionOnly: boolean; nFeaturesIn: number; }; /** * Transforms feature vectors to vectors of certain monomials thereof. * * E.g. after setting options (degree, homogeneous, interactionOnly), and * *fit()*ing, *transform()*s lists of feature vectors like [a, b, c], where a, * b and c are numbers, into the following possible outputs * * - [a^2, ba, ca, a, b^2, cb, b, c^2, c, 1] (degree = 2), that is, all * monomials in a, b, c up to degree two. * * - [a^2, ba, ca, b^2, cb, c^2] (degree = 2, homogeneous = true), that is, all * monomials in a, b, c of degree exactly equal to two. * * - [ab, ac, bc] (degree = 2, homogeneous = true, interactionOnly = true), that * is, all monomials in a, b, c of degree exactly equal to two and no feature * raised to a power larger than one. * * - [ab, ac, a, bc, b, c, 1] (degree = 2, homogeneous = false, interactionOnly * = true), that is, all monomials in a, b, c of degree at most two and no * feature raised to a power larger than one. * * Of course, the number of features is not restricted to three, but must be the * same in each feature vector of the list to be *transformed()*. */ export declare class PolynomialFeatures { private _degree; private _nFeaturesIn; private _homogeneous; private _interactionOnly; /** * Basic configuration. You can skip configuration by providing no arguments. * * In case no arguments are given you have to use the method fromConfig(...) * to set up a configuration in order to use the methods fit(...), * transform(...) and fitTransform(...). * * @param degree Highest order of the monomials * @param homogeneous Whether to include only highest order monomials * @param interactionOnly Whether to disallow higher powers of single features */ constructor(degree?: number, homogeneous?: boolean, interactionOnly?: boolean); /** Configuration option 'degree' */ get degree(): number; /** Configuration option 'homogenous' */ get homogenous(): boolean; /** Configuration option 'interactionOnly' */ get interactionOnly(): boolean; /** * Number of input features. * * The only configuration option which is set by the fit method. */ get nFeaturesIn(): number; /** Saves configuration to a simple option-bag. * * The configuration specifies the internal state of PolynomialFeatures * completely. Hence the config of the transformer can be used to save it to a * file. */ get config(): PolynomialFeaturesConfig; /** Loads configuration from simple option-bag. */ fromConfig(config: PolynomialFeaturesConfig): void; /** Sets the number of input features. * * Call this method before transform(...). Afterwards the transform(...) * method will only accept input with the correct number of features. */ fit(x: number[][]): void; /** * Returns the list of polynomial features corresponding to x. * * @param x List of features vectors (with same number of features each). */ transform(x: number[][]): number[][]; /** * Same as applying first fit(...) and then transform(...) to x. * * @param x List of features vectors. */ fitTransform(x: number[][]): number[][]; /** * Throw error in case of invalid configuration. */ assertValidConfig(): void; }