An interface for functions over sparse parameters.
the point is to run this online, and data control is passed to the optimizer
K is probably a String or an int
selectedData are the data points used in the current evaluation,
which is more naturally handled by the minimizers instead of the implementation
though if one prefers, one can implement that elsewhere, and make valueAt,
derivativeAt independent of selectedData