stnmf.callbacks.residual
- stnmf.callbacks.residual(self, i, itor, callback_data, interval=100)
Callback function to view and record the course of the reconstruction residual
The residual is displayed continuously and is afterwards provided as a
numpy.ndarraystored in the key ‘res’ in the dictionary callback_data.- Parameters:
interval (
int, optional) – Compute the residual every interval iterations. Default is 100
Notes
This callback function is not specific to
stnmf.STNMFand can be used in conjunction with othersnmt.mfclasses.Examples
>>> from stnmf import STNMF >>> from stnmf.callbacks import residual >>> results = dict() >>> stnmf = STNMF(ste, callback=residual, callback_data=results, ... callback_kwargs=dict(interval=100)) >>> print(results['res'])