liesel icon indicating copy to clipboard operation
liesel copied to clipboard

Predictions in Liesel

Open jobrachem opened this issue 1 year ago • 0 comments

This issue serves as a reminder and a tracker for the discussion about convenience functionality for predictions in Liesel. Currently, we do not really offer much in that regard.

I propose that we could let certain lsl.Group child-classes know about how they want to be used for prediction, for example:

class PSpline(lsl.Group):

    def predict(self, samples, new_data) -> Array:
    
        coef_samples = samples[self.coef.name]
        basis_matrix = self.basis_matrix.eval_basis_funs(new_data)
        smooth = np.tensordot(
            basis_matrix, coef_samples, axes=([1], [-1])
        )

        return np.moveaxis(smooth, 0, -1) # makes axes fit to samples

What's more, @wiep mentioned that it may be nice to utilize the model graph for predictions.

jobrachem avatar Mar 22 '23 17:03 jobrachem