lale.lib.sklearn.nmf module

class lale.lib.sklearn.nmf.NMF(*, n_components=None, init=None, solver='cd', beta_loss='frobenius', tol=0.0001, max_iter=200, random_state=None, l1_ratio=0.0, verbose=0, shuffle=False, alpha_W=0.0, alpha_H='same')

Bases: PlannedIndividualOp

Non-negative matrix factorization transformer from scikit-learn for linear dimensionality reduction.

This documentation is auto-generated from JSON schemas.

Parameters
  • n_components (union type, default None) –

    Number of components.

    • integer, >=1, >=2 for optimizer, <=’X/items/maxItems’, <=256 for optimizer, uniform distribution

    • or ‘auto’

      The number of components is automatically inferred from W or H shapes.

    • or None

      If not set, keep all components.

  • init (‘custom’, ‘nndsvd’, ‘nndsvda’, ‘nndsvdar’, ‘random’, or None, not for optimizer, default None) – Method used to initialize the procedure.

  • solver (‘cd’ or ‘mu’, not for optimizer, default ‘cd’) –

    Numerical solver to use:

    See also constraint-1.

  • beta_loss (union type, not for optimizer, default 'frobenius') –

    Beta divergence to be minimized, measuring the distance between X and the dot product WH.

    • float, >=-1 for optimizer, <=1 for optimizer

    • or ‘frobenius’, ‘kullback-leibler’, or ‘itakura-saito’

    See also constraint-1.

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

  • max_iter (integer, >=1, >=10 for optimizer, <=1000 for optimizer, uniform distribution, default 200) – Maximum number of iterations before timing out.

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

    Used for initialization and in coordinate descent.

    • integer

    • or numpy.random.RandomState

    • or None

  • l1_ratio (float, >=0.0, <=1.0, not for optimizer, default 0.0) – The regularization mixing parameter.

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

    Whether to be verbose.

    • boolean

    • or integer

  • shuffle (boolean, default False) – If true, randomize the order of coordinates in the CD solver.

  • alpha_W (float, >=1e-10 for optimizer, <=1.0 for optimizer, loguniform distribution, optional, not for optimizer, default 0.0) – Constant that multiplies the regularization terms of W. Set it to zero (default) to have no regularization on W.

  • alpha_H (union type, optional, not for optimizer, default 'same') –

    Constant that multiplies the regularization terms of H. Set it to zero to have no regularization on H. If “same” (default), it takes the same value as alpha_W.

    • ’same’

    • or float, >=1e-10 for optimizer, <=1.0 for optimizer, loguniform distribution

Notes

constraint-1 : union type

beta_loss, only in ‘mu’ solver

  • beta_loss : ‘frobenius’

  • or solver : ‘mu’

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, >=0.0) –

  • y (Any, optional) –

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, >=0.0) –

Returns

result – Transformed data

Return type

array of items : array of items : float