ssmit1986 / BayesianInference

Wolfram Language application for Bayesian inference and Gaussian process regression
MIT License
37 stars 4 forks source link

Regression with WeightedData #14

Closed MyLiIt closed 2 years ago

MyLiIt commented 2 years ago

Hi

Thanks for your nice code.

I was looking at one example you report in your examples-file to do the regression with nested-sampling:

BlockRandom[
 SeedRandom[1];
 testdata = (# -> (# + 2 RandomReal[])) & /@ RandomReal[{-1, 1}, 20];
 ]

obj = defineInferenceProblem[
  "Data" -> testdata,
  "GeneratingDistribution" -> NormalDistribution[
    a x + b,
    sigma
    ],
  "Parameters" -> {{a, -10, 10}, {b, -10, 10}, {sigma, 0.1, 10}},
  "IndependentVariables" -> {x},
  "PriorDistribution" -> {"LocationParameter", "LocationParameter", 
    "ScaleParameter"}
  ]

result = nestedSampling[obj]

How should I change it to add some weights on the starting data? E.g., how can I use Mathematica's WeightedData? Or in general, all real data in Physics come with errors. How can I include them in a regression process?

Thank you in advance for your kind help!

ssmit1986 commented 2 years ago

Hello,

Due to family circumstances, I am unable to help you right now. I'll get back to you when I'm back in the office.

Thank you for understanding, Sjoerd

On Fri, 11 Feb 2022 at 19:00, MyLiIt @.***> wrote:

Hi

Thanks for your nice code.

I was looking at one example you report in your examples-file to do the regression with nested-sampling:

BlockRandom[ SeedRandom[1]; testdata = (# -> (# + 2 RandomReal[])) & /@ RandomReal[{-1, 1}, 20]; ]

obj = defineInferenceProblem[ "Data" -> testdata, "GeneratingDistribution" -> NormalDistribution[ a x + b, sigma ], "Parameters" -> {{a, -10, 10}, {b, -10, 10}, {sigma, 0.1, 10}}, "IndependentVariables" -> {x}, "PriorDistribution" -> {"LocationParameter", "LocationParameter", "ScaleParameter"} ]

result = nestedSampling[obj]

How should I change it to add some weights on the starting data? E.g., how can I use Mathematica's WeightedData? Or in general, all real data in Physics come with errors. How can I include them in a regression process?

Thank you in advance for your kind help!

— Reply to this email directly, view it on GitHub https://github.com/ssmit1986/BayesianInference/issues/14, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHYRCRQBJCZNIGMWBC2RI33U2VMFNANCNFSM5OFCV4QQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

MyLiIt commented 2 years ago

Hi,

I hope everything is solved for the best for you! I found my way to the problem and I can close this issue.

All the best.

MyLiit