ensign.cp_decomp.get_fit_per_entry¶
-
get_fit_per_entry(decomp, tensor, top_k=None)[source]¶ Calculates fit for each entry of a reconstructed tensor present in the original tensor.
This function evaluates how well each entry of the tensor reconstructed from
decompmatches the entry at the same index intensorThis evaluation is calculated as fit, a floating point number on the interval (-infinity, 1.0]. A fit of 1.0 is an exact match between the reconstructed and original entry. Output is sorted fy fit (ascending).Lower fit values indicate a reconstructed entry is different than the original entry. Low fit values may be indicative of anomalous data.
- Parameters
- decompCPDecomp
Decompostion used to calculate per-element fit. A sparse tensor is reconstructed from
decompusing sum-of-outer-products and the results are compared totensor.- tensorSPTensor
The sparse tensor that is the basis for comparison.
- top_kint, optional
The number of elements to return. If
top_kisNone(default), fit values for all entries are returned. Iftop_kis positive, thetop_klowest fit elements are returned. Iftop_kis negative theabs(top_k)highest fit elements are returned. Iftop_kis zero an emptyndarrayis returned.
- Returns
- fit_valsnumpy.ndarray
A
numpy.ndarrayof the same shape and format astensor.entries. The firsttensor.ordercolumns offit_valsare indices into into each mode oftensor. The final column offit_valscontains the entry’s fit value.