pyttb.gcp_opt

Generalized CP Decomposition.

pyttb.gcp_opt.gcp_opt(data: tensor | sptensor, rank: int, objective: Objectives | Tuple[Callable[[ndarray, ndarray], ndarray], Callable[[ndarray, ndarray], ndarray], float], optimizer: StochasticSolver | LBFGSB, init: Literal['random'] | ktensor | Sequence[ndarray] = 'random', mask: tensor | ndarray | None = None, sampler: GCPSampler | None = None, printitn: int = 1) Tuple[ktensor, ktensor, Dict][source]

Fits Generalized CP decomposition with user-specified function.

Parameters:
  • data – Tensor to decompose.

  • rank – Rank of desired CP decomposition.

  • objective – Objective function to minimize for the CP decomposition. Either a pre-defined objective or a tuple of function_handle, gradient_handle, and lower_bound.

  • optimizer – Optimizer class for solving the decompistion problem defined.

  • init – Initial solution to the problem.

  • mask – A binary mask to note missing rather than sparse data. (Only valid for dense, LBFGSB solves)

  • sampler – Class that defined sampling strategy for stochastic solves.

  • printitn – Controls verbosity of printing throughout the solve

Returns:

Solution, Initial Guess, Dictionary of meta data