Bayesian inference : what if one of input value and output value are the measurement data

  • I want to do UQ with Bayesian inference.
  • I studied the examples in uqlab, and I found out prey and predator model example almost fits my problem.
  • The big difference between the example and mine is one of the input value and output value are the measurement data
  • I tried to set ID for both measurement data (input, output of the test function) with MoMap and set the output of model motion mfile as [input,output].
  • The error message says the the dimension of arrays being concatend are not consistent.
    Dimensions of arrays being concatenated are not consistent.

Error in uq_initialize_uq_inversion (line 173)
Opt.Value(ii).MOMap = [ones(1,NoutCurr);Opt.Value(ii).MOMap];

Error in uq_porosity_210622 (line 128)
myBayesianAnalysis = uq_createAnalysis(BayesOpts);

Could I get any help for this problem?

Dear Yesol,

welcome to UQWorld.

I fear that one would need to see more of your code generating this error message to give help for dealing with this error message.

Moreover, I am not sure what you mean by "The big difference between the example and mine is one of the input value and output value are the measurement data."

  • The interpretation leading to the simplest solution would be that your function in the mfile returns also the values of the input given to mfile as part of the output. Here I would suggest to write a further mfile as a wrapper file and that in this wrapper file your mfile is called and the output is saved in two variables. The first one should be ignored and the second one should be the output variable of the function in the wrapper file. You may have to adapt your settings for MOMAP afterwards
    Caution: I suggest to avoid input / output as names for variables since this may conflict with matlab functions/variables. I usually would use myInput / myOutput or would put a part of my name in the names of the variables, ending up with oklInput /oklOutput.
  • The second interpretation is that in addition to the unknown/partially known input parameters you want to identify somwhow by using UQLab (which is typically denoted as input in the UQ-community) , you have some further parameter are directly derived derived from a measurement that you need to know for the model evaluation (which I will denote as non-UQ-input in the following.) If this is the case you may formulate a prior that has a constant output for one (or several of) its components, see Section 2.2.2 of the UQLab Bayeisn inversion manual or follow the considerations for dealing with problems as in equation (1.2) at the end of section 1.2 in the UQLab Model manual (Therein “my” non-UQ-input is just the set of deterministic parameters that are used to properly configure a model.)

If your situations does not fit in the possibilities discussed above, please provide further information.


1 Like

Thank you for your detailed comment. It really helped me a lot. However, the warning message says that the constant input accepts only one parameter. I think this is because I set the measurement data (input) as a constant value in the prior distribution setup part. Is there any way that I can set the measurement data as one of the input value of function? :slight_smile: I found out that Input. structure in the user manual, but it’s kind of difficult to apply this to my code… should I just directly enter it into the function?


Dear Yesul,

I am sorry, but I still have not completely understood the situation your are considering.
Maybe you could compare your situation with the one in the reference model in the Section 2.1 of the UQLab Bayeisn inversion manual to help me (and others) to understand your situation.
In this situation, we have simply supported beam and it holds:

  • The geometry of the beam is known and can be described by the given values for b, h and L.
  • The beam is subject to a constant distributed load with then known value p.
  • The Young’s Modulus E of the beam is only partially known and the knowledge, expert opinions, beliefs on the value of E prior to measurements one want to evaluate is represented by a prior density with a log-normal distribution with the presented values for the mean and the standard deviation.
  • There is the model in equation (2.1) providing the mid spam deflection for given values of b, h,L, p, and E. This mid spam deflection is also denoted as the model output and in the UQLab formulation the output value of the mfile. What is denoted as input for this model is not uniquely defined. On one hand, in the considerations for UQLab b, h,L, p, and E are input, i.e. the information about these parameters are stored in an INPUT object, see start of section 2.2.2. On the other hand, in other parts of the UQ community only E would be denoted as input while b, h,L, p, would somehow be under the hood parts of the model, and I have used in my post above the notion non-UQ-Input .
  • Some measurements of the mid spam deflection have been performed, leading to the values shown in Table 1. These are values corresponding to observed model outputs, and these values need to be stored in the Data component of the structure description the Bayesian inverse problem, see Section 2.2.4 or the user manual for Bayesian inversion.
  • Bayesian inversion is performed to derive an posterior density for the value for E by combining the prior density and the measurements of the mid spam deflection, i.e. of the model output.

So maybe you could compare your measurement data (input) to the situation above. As you may have realized, one would need to treat measured value for the model input and the model output different.