pyttb.gcp.fg_est

Evaluate Functions And Gradients based on Subsamples.

pyttb.gcp.fg_est.estimate(model: ktensor, data_subs: ndarray, data_vals: ndarray, weights: ndarray, function_handle: Literal[None], gradient_handle: Callable[[ndarray, ndarray], ndarray], lambda_check: bool = True, crng: ndarray | None = None) List[ndarray][source]
pyttb.gcp.fg_est.estimate(model: ktensor, data_subs: ndarray, data_vals: ndarray, weights: ndarray, function_handle: Callable[[ndarray, ndarray], ndarray], gradient_handle: Literal[None] = None, lambda_check: bool = False, crng: ndarray | None = None) float
pyttb.gcp.fg_est.estimate(model: ktensor, data_subs: ndarray, data_vals: ndarray, weights: ndarray, function_handle: Callable[[ndarray, ndarray], ndarray], gradient_handle: Callable[[ndarray, ndarray], ndarray], lambda_check: bool, crng: ndarray | None) Tuple[float, List[ndarray]]

Estimate the GCP function and gradient with a subsample.

Parameters:
  • model – Current decomposition.

  • data_subs – Subscripts of data sample.

  • data_vals – Values of data sample.

  • function_handle – Handle to evaluate objective function.

  • gradient_handle – Handle to evaluate gradient of objective function.

  • lambda_check – Whether or not to check decomposition weights are all ones. (Which is assumed in implementation details)

  • crng – Range of indices for correct/adjustment when zeros are sampled accidentally.

Returns:

  • Estimated objective function value and/or estimated gradient value with

  • respect to the model.

pyttb.gcp.fg_est.estimate_helper(factors: List[ndarray], subs: ndarray) Tuple[ndarray, List[ndarray]][source]

Extract model values at sample locations and exploded Zk’s.

Parameters:
  • factors – Factor matrices from model.

  • subs – Subscripts to extract from model.

Returns:

Model values at subs and exploded Zk’s