# Derivative of predictor function

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?

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.