yonder: A python package for data denoising and reconstruction

We present a standalone implementation of a data-deconvolution method based on singular value decomposition. The tool is written in python and packaged in the open-source yonder package. yonder receives as input two matrices, one for the data and another for the errors, and outputs a denoised version of the original dataset. In this Research Note, we briefly describe the methodology and show a demonstration of the yonder on a simulated dataset.


INTRODUCTION
Measurement errors are ubiquitous in Astronomy.While plenty of methodologies exist to handle them on linear regression problems (Kelly 2007), there is a shortage of ready-to-use packages to perform data pre-processing and machine learning-related tasks in the presence of measurement errors (but see, e.g.Bovy et al. 2011;Reis et al. 2018).It is of particular interest to estimate a latent matrix X based on noisy observations.Here, we consider the case of tabular-like data representing different objects as rows and their particular features as columns, and a matrix of similar dimensions encodes the uncertainties of each measurement.X obs = X + X sd , where X obs is the noisy measurement, and X sd a stochastic noise matrix with zero mean.To help alleviate this problem, we wrote yonder, a python package for data denoising and reconstruction.This report briefly introduces the package and illustrates how the method works in practice.

ANALYSIS AND DISCUSSION
Given a data matrix X , its singular value decomposition (SVD) is given by: Where UΣ gives the principal components, and the columns of V the corresponding coefficients of the linear combination of the original variables.In the case of a nosy matrix X obs with respective measurement errors X sd , there is an iterative solution described in Wentzell & Lohnes (1999); Wentzell & Hou (2012).yonder implements the case of independent and identically distributed heteroscedastic errors.To illustrate how yonder works, we simulate a noise model similar to Wentzell & Hou (2012), with errors-in-measurements sampled from a log-normal distribution.Figure 1 illustrates the workflow.The mock data X obsnm = X nm + N (0, σ 2 nm ) consists of m = 20 columns, n = 300 rows, and three distinct groups with 100 members each.The top left panel shows the error-free data: the top right panel the noisy data and respective error bars.yonder uses as input the noisy matrix and the associated error matrix and approximates the position of the unobserved denoised data.The presence of errors blurs the discrimination of the groups, which is recovered after running yonder.The method will be more beneficial for cases of highly correlated data for which a low-rank approximation is guaranteed, for example, in multi-band photometric surveys.
The code takes an input matrix X obs , and respective error matrix X sd ≡ σ nm , and outputs the SVD of the latent denoised matrix X = Û Σ V ≈ X .This work showcases that accounting for uncertainties can further benefit machine learning algorithms by correcting the data projection and enhancing the distinguishability between groups.Possible applications include the use in multi-band surveys to find stellar clusters in color-color and colour-magnitude diagrams (Chies-Santos et al. 2022).
Installation and similar software yonder is available as an open-source software package on GitHub 1 and Zenodo 2 .The code can be installed via pip command 3 .Additionally to this python version, there is also a R implementation of the same algorithm available on CRAN 4 .Software: scipy (Virtanen et al. 2020), numpy (Harris et al. 2020).

Figure 1 .
Figure 1.Example of the effects of measurement errors on mock data.Top left: scatter plot of the error-free data; top right: scatter plot with the noisy mock data and respective error-bars; bottom left: scatter plot of the noisy mock data, with arrows pointing from the data to the predicted position by yonder; bottom right: scatter plot of the denoised data.