It seems to me that what you are doing in `compute_kde` should be done in the `train` method.