lale.lib.autogen.sparse_pca module

class lale.lib.autogen.sparse_pca.SparsePCA(*, n_components=None, alpha=1, ridge_alpha=0.01, max_iter=1000, tol=1e-08, method='lars', n_jobs=1, U_init=None, V_init=None, verbose=False, random_state=None)

Bases: PlannedIndividualOp

Combined schema for expected data and hyperparameters.

This documentation is auto-generated from JSON schemas.

Parameters
  • n_components (union type, default None) –

    Number of sparse atoms to extract.

    • integer, >=2 for optimizer, <=256 for optimizer, uniform distribution

    • or None

  • alpha (float, >=1e-10 for optimizer, <=1.0 for optimizer, loguniform distribution, default 1) – Sparsity controlling parameter

  • ridge_alpha (float, not for optimizer, default 0.01) – Amount of ridge shrinkage to apply in order to improve conditioning when calling the transform method.

  • max_iter (integer, >=10 for optimizer, <=1000 for optimizer, uniform distribution, default 1000) – Maximum number of iterations to perform.

  • tol (float, >=1e-08 for optimizer, <=0.01 for optimizer, default 1e-08) – Tolerance for the stopping condition.

  • method (‘lars’ or ‘cd’, default ‘lars’) – lars: uses the least angle regression method to solve the lasso problem (linear_model.lars_path) cd: uses the coordinate descent method to compute the Lasso solution (linear_model.Lasso)

  • n_jobs (union type, not for optimizer, default 1) –

    Number of parallel jobs to run

    • integer

    • or None

  • U_init (union type, not for optimizer, default None) –

    Initial values for the loadings for warm restart scenarios.

    • array of items : array of items : float

    • or None

  • V_init (union type, not for optimizer, default None) –

    Initial values for the components for warm restart scenarios.

    • array of items : array of items : float

    • or None

  • verbose (union type, not for optimizer, default False) –

    Controls the verbosity; the higher, the more messages

    • integer

    • or boolean

  • random_state (union type, not for optimizer, default None) –

    If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.

    • integer

    • or numpy.random.RandomState

    • or None

Notes

constraint-1 : negated type of ‘X/isSparse’

A sparse matrix was passed, but dense data is required. Use X.toarray() to convert to a dense numpy array.

fit(X, y=None, **fit_params)

Train the operator.

Note: The fit method is not available until this operator is trainable.

Once this method is available, it will have the following signature:

Parameters
  • X (array of items : array of items : float) – Training vector, where n_samples in the number of samples and n_features is the number of features.

  • y (any type) –

transform(X, y=None)

Transform the data.

Note: The transform method is not available until this operator is trained.

Once this method is available, it will have the following signature:

Parameters
  • X (array of items : array of items : float) – Test data to be transformed, must have the same number of features as the data used to train the model.

  • ridge_alpha (float, optional, default 0.01) – Amount of ridge shrinkage to apply in order to improve conditioning

Returns

result – Transformed data.

Return type

Any