Learning observer and observable with a sample