melvinstorbacka / REACLIB-SOLNAR

1 stars 1 forks source link

Add good fit function of QT-Rate surface #13

Closed melvinstorbacka closed 5 months ago

melvinstorbacka commented 7 months ago

Fitting 7*7 parameters did not really work at all, though maybe worth revisiting if new idea fails.

New idea (feels better, though perhaps slower?): make one temperature fit for each Q-value, then fit a curve for each parameter vs Q-value. Basically the same, just "manual" steps.

Chongkth commented 7 months ago

I think that will give the same result, as you said. We need maybe larger mesh points

Best regards, Chong


From: melvinstorbacka @.> Sent: Tuesday, December 19, 2023 5:04:11 PM To: melvinstorbacka/REACLIB-SOLNAR @.> Cc: Subscribed @.***> Subject: [melvinstorbacka/REACLIB-SOLNAR] Add good fit function of QT-Rate surface (Issue #13)

Fitting 7*7 parameters did not really work at all, though maybe worth revisiting if new idea fails.

New idea (feels better, though perhaps slower?): make one temperature fit for each Q-value, then fit a curve for each parameter vs Q-value. Basically the same, just "manual" steps.

— Reply to this email directly, view it on GitHubhttps://github.com/melvinstorbacka/REACLIB-SOLNAR/issues/13, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC7KMVJAP4HAG4F4QRRPMHLYKG3HXAVCNFSM6AAAAABA3NICYGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA2DQOJWGM4DOMQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>

melvinstorbacka commented 7 months ago

OK, I seem to have a working prototype for fitting data using a NN. Here is one result (the only one I tested so far):

test3.png

The fit looks nice, but there are a few steps left:

  1. Make sure the fit is good. Plot some curves of known T/Q and compare.
  2. Try to do the same with some more exotic nuclei. E.g. heavy tin isotopes that I have tested have very weird patterns that are also hard to fit to the reaclib polynomial, so that will be the next challenge.
  3. Make a good database structure of saving and loading the NN and see how long it takes to load and run predictions for a mass iteration.

Will probably continue late afternoon. Just happy to have the NN working OK for now :)

P.S. The loss (mean square error) is very large, but I don't think that's very weird, given that the rates are of order 1e8-1e9.

melvinstorbacka commented 7 months ago

P.P.S.: The current architecture for the NN is:

Model: "sequential"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 dense (Dense)               (None, 128)               384       

 dense_1 (Dense)             (None, 128)               16512     

 dense_2 (Dense)             (None, 64)                8256      

 dense_3 (Dense)             (None, 32)                2080      

 dense_4 (Dense)             (None, 1)                 33        

=================================================================
Total params: 27265 (106.50 KB)
Trainable params: 27265 (106.50 KB)
Non-trainable params: 0 (0.00 Byte)

with the only inputs being Q-value [MeV] and Temperature [GK].

melvinstorbacka commented 7 months ago

OK, changed the architecture and now it seems to work quite well, with OK fits. The fit is done with the logarithm of the rates, so when rates are zero, they are instead set to -30, which will have to approximate 0. This seems to work OK, for now.

melvinstorbacka commented 7 months ago

Have now tested different fits for standard neural net, bayesian neural net with "randomized results" and finally probabilistic bayesian neural network (producing distributions with uncertainties).

The probabilistic fit is shown here, with loss evolution here. I think it's quite nice :)

Next step is for me to write up a working fit code with options for making the different fits. I would suspect that standard and bayesian would be most applicable for r-process simulations, but is nice to include all three?

melvinstorbacka commented 5 months ago

We now have a good fit using NNs for the standard, and also working BNNs, though they are costly.