# TMVA parameter fitting with known function

Hi All,

Does anyone have an example of ANN regression to extract a set of parameters using a known function? This seems like it would be a popular thing to do but I haven’t found a good example to model off of yet.

Assume you know the functional form with a set of unknown parameters. You want to train an ANN to extract the best parameters the way you would in a chi^2 minimization fit. So you would want to make your own cost function based on the functional form you are starting out with.

I guess for a particular ANN method you can find the error and install your functional form to use in the back-propagation but this can’t be the easiest way to do this for a problem that must be quite popular:

For MethodMLP.cxx
Double_t error = ( GetOutputNeuron( itgt )->GetActivationValue() - desired )*eventWeight;

rewrite:
Double_t error = ( F(GetOutputNeuron( itgt )->GetActivationValue()) - F(desired) )*eventWeight;

Where F(x,…) is the functional form and ‘F(desired)’ is the experimental data I’m using to extract the unknown set of parameters.

Thank You

Hi,

Not sure what you want to do here. (E.g. why not use non-linear least squares?) Do you want to make a model that reimplements parameter estimation?

My understanding is that this would require the derivative of the cost function (something not possible in the current TMVA).

Using a tool that supports automatic differentiation would help you here. Support for this is under consideration for ROOT, but integration is still some time off.

Cheers,
Kim

Hi Kim,

The task at hand is a function built of helicity amplitudes where there are several free parameters that connect the amplitudes to a physical interpretation. These parameters change over a range of kinematics so the standard method is using a non-linear least squares fit over many segments of the data broken up into various kinematic ranges. But this results in a lot of error in the parameters.

A ANN does a much better job with something like this but you must be able to build your own cost function. The derivative can help in some cases but most of the time the function is very complex and the numerical derivative slows things down a lot. There are other ways but it all requires implementing your own cost function. This is possible in things like tensorflow but TMVA seems to be less flexible which is a bit disappointing being so powerful for other applications.

thanks
SM