TransWikia.com

Derivative of predictor function

Mathematica Asked by pawel_winzig on June 30, 2021

Given some data dat, we would like to generate a predictor function. Therefore we use

 pdata = Map[#[[1]] -> #[[2]] &, dat];
 p = Predict[pdata, Method -> "NeuralNetwork", PerformanceGoal -> "Quality"];

If one tries to take the derivative of p[x] via (here as an example at 2.)

 ND[p[x], x, 2.]

Mathematica returns PredictorFunction::bfttype: "Invalid argument x. feature1 is a Numerical feature. How can one perform a derivation of the PredictorFunction?

One Answer

I found it: It is the same case as with the integration of compiled functions. One has to use a wrapper: foo[x_?NumericQ] := p[x]; The function foo can now be differentiated using ND.

Answered by pawel_winzig on June 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP