API choice: `inversePredict(mod,Xnew)` vs `predict(mod,Xnew;inv=true)`?

For a ML library, which would be the arguments in favour to use a new specific function name for the inverse prediction for a model (e.g. a zero-mean/unit variance scaler), something like inversePrediction(mod,Xnew), and which arguments would be in favour to just use a keyword argument to the already employed predict function, something like predict(mod,Xnew;inv=true) ?

Some context:

  • I use only predict(mod) (and eventually predict(mod,Xnew) for models that generalise to new data) for unsupervised models and so-called transformers without distinguishing between them
  • I use camel case
  • MLJ and scikit-learn use inverse_transform
  • I care more to user-friendly than performance

I think a keyword argument is not ideal because, in general, the “inverse” operation operates on different types, and outputs objects of different types. I don’t generally expect keyword options to effect behaviour in that way.

From a user’s perspective I cannot see much difference.

If you do go for kwarg, I’d vote for “inverse=” rather than “inv=”.

My only other comment is that the use of camelCase for function names in Julia is not recommended but I guess you know that already :slight_smile:


Oh, and I think StatsAPI and elsewhere, reconstruct is used, which I think is a good name, since generally the inverse is not really an inverse, but only a one-sided inverse, or approximate, and so forth.