ramess101 / RJMC_LJ_Ethane

1 stars 1 forks source link

OM code questions #3

Closed ocmadin closed 5 years ago

ocmadin commented 6 years ago

I will post questions/comments about the code here:

        for j in range(n_params):

            # Get current value for parameter j
            params = current_params.copy() # This approach updates previous param values

            # Propose new values
            if j == 0: #If proposing a new model
                if not i%swap_freq:
                    mod_ran = np.random.random()
                    if mod_ran < 1./3: #Use new models with equal probability
                        proposed_model = 0
                    elif mod_ran < 2./3:
                        proposed_model = 1
                    elif mod_ran < 1:
                        proposed_model = 2
                    if proposed_model != current_model:
                        model_swap_attempts += 1
                        params[0] = proposed_model
                        params[1] *= Tmatrix_eps[current_model,proposed_model]
                        params[2] *= Tmatrix_sig[current_model,proposed_model]
            else:        
params[j] = rnorm(current_params[j], prop_sd[j])

I am confused as to how the j==0 corresponds to choosing a new model. Won't this just always attempt to choose a model?

ocmadin commented 6 years ago

LBond is not changed in the MC sampling, correct? The three models are all only dependent on eps and sig, with different forms of each equation.

ocmadin commented 6 years ago

In the gen_Tmatrix function, is the function choosing the transition ratios by choosing values that maximize the posterior (in a predetermined range around the initial guess)? Are there any issues with doing this for all three models at the same time?

ramess101 commented 5 years ago

@ocmadin

Sorry, I never saw these. I don't think I get notifications unless you tag me in the post (which is strange since I created this repository I thought I would get notified about everything).

ramess101 commented 5 years ago

@ocmadin

I am confused as to how the j==0 corresponds to choosing a new model. Won't this just always attempt to choose a model?

j loops over the n_params. It should only be zero for the first pass of this loop.

ramess101 commented 5 years ago

@ocmadin

LBond is not changed in the MC sampling, correct? The three models are all only dependent on eps and sig, with different forms of each equation.

Correct, at least back when I originally wrote the code, I don't know about now.

ramess101 commented 5 years ago

@ocmadin

In the gen_Tmatrix function, is the function choosing the transition ratios by choosing values that maximize the posterior (in a predetermined range around the initial guess)? Are there any issues with doing this for all three models at the same time?

Yes, it is using the maximum likelihood to determine how to scale each property. What type of issues are you referring to? If this question is still relevant, let me know.

ocmadin commented 5 years ago

I think I forgot I had posted these and sorted them out as I understood the code better. Thanks for responding, though!