Is there a machine learning framework that supports partial evaluation?

For example:

We train on [model, year, km, ..., colour, price].

Today we call
get_prediction(model, year, km, ..., colour)
It returns the value of price, ie a number (or a probability for a label).

Say I would like to call
get_prediction_function(model, year, ..., colour)
It should return a function price(km). (That function returns a number.)

Essentially we are pulling out a dimension or two.

In theory of course it gives us nothing, it just postpones some calculation. (In practice this small specialised object is very useful in some production applications.)

  • $\begingroup$ A probabilistic generative model can do this through marginalization. $\endgroup$
    – Emre
    Nov 5, 2016 at 18:42
  • $\begingroup$ @Emre Thanks, it is logical that it can be done and I assume it has been done. The question is really which production-ready frameworks support it today. One could also approximate it with brute force. $\endgroup$ Nov 5, 2016 at 20:21
  • $\begingroup$ When you say framework, what do you mean exactly? Would programming languages be frameworks here? You can use MatLab to create a function that returns a function, where the function you create stores the parameters you enter to be used in the function that is output. This can be done in R as well. $\endgroup$
    – grldsndrs
    Nov 8, 2016 at 6:27
  • $\begingroup$ No. For example, Python does partial evaluation. But the resulting function is not self-contained and thus not trivially serialisable. So it's a syntactic capability, but does not make it possible to easily send the result over the wire, or call it a million times. (As opposed to something like price = lambda km: max(0, 300000 - km) * 42 + 1234.) $\endgroup$ Nov 8, 2016 at 9:55


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.