Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TODO 03.03.2017 #288

Open
4 tasks
smattis opened this issue Mar 3, 2017 · 14 comments
Open
4 tasks

TODO 03.03.2017 #288

smattis opened this issue Mar 3, 2017 · 14 comments
Assignees

Comments

@smattis
Copy link
Contributor

smattis commented Mar 3, 2017

  • integration module
  • example using Voronoi surrogate
  • look over selecting qois using sensitivity package and examples
  • jupyter notebook examples
@lcgraham
Copy link
Contributor

lcgraham commented Mar 3, 2017 via email

@smattis
Copy link
Contributor Author

smattis commented Mar 7, 2017

A module for measure-theoretic integration. Integrating measurable functions in input and output spaces.

@lcgraham
Copy link
Contributor

lcgraham commented Mar 7, 2017 via email

@mpilosov
Copy link
Contributor

mpilosov commented Jun 14, 2017

speaking of integration, I found in some examples I was running that probabilities in the input_sample_set didn't sum to 1. In fact, they summed to the proportion of (bins in the output space that had samples land in them) to (total bins in output space). Issue only showed up in problems of dimensions > 2, across several varieties of defining the output distribution and different input space sampling methods.
I changed calculateP.prob (locally) to the following in order to fix it:

def prob(discretization, globalize=True): 
    r"""
    Calculates :math:`P_{\Lambda}(\mathcal{V}_{\lambda_{samples}})`, the
    probability assoicated with a set of  cells defined by the model
    solves at :math:`(\lambda_{samples})` where the volumes of these 
    cells are provided.

    :param discretization: An object containing the discretization information.
    :type discretization: class:`bet.sample.discretization`
    :param bool globalize: Makes local variables global.

    """

    # Check Dimensions
    discretization.check_nums()
    op_num = discretization._output_probability_set.check_num()

    # Check for necessary attributes
    if discretization._io_ptr_local is None:
        discretization.set_io_ptr(globalize=False)

    # Calculate Probabilities
    if discretization._input_sample_set._values_local is None:
        discretization._input_sample_set.global_to_local()
    P_local = np.zeros((len(discretization._io_ptr_local),))
    op_bins, op_pos = 0, 0 # count number of nonempty bins
    for i in xrange(op_num):
        if discretization._output_probability_set._probabilities[i] > 0.0:
            op_bins += 1
            Itemp = np.equal(discretization._io_ptr_local, i)
            Itemp_sum = np.sum(discretization._input_sample_set.\
                    _volumes_local[Itemp])
            Itemp_sum = comm.allreduce(Itemp_sum, op=MPI.SUM)
            if Itemp_sum > 0:    
                op_pos += 1        
                P_local[Itemp] = discretization._output_probability_set.\
                        _probabilities[i]*discretization._input_sample_set.\
                        _volumes_local[Itemp]/Itemp_sum
    # P_local=op_bins*np.divide(P_local,op_pos) # normalize
    P_local*=np.float(op_bins)/op_pos
    if globalize:
        discretization._input_sample_set._probabilities = util.\
                                        get_global_values(P_local)
    discretization._input_sample_set._probabilities_local = P_local

which resulted in the proper integrals but of course I cannot figure out how to submit a successful pull request at this point even with a simple change, so something more substantial like that seems above my head despite being a quick fix. I'm also surprised we didn't have a unit test that caught this.

@mathematicalmichael
Copy link
Collaborator

@mpilosov oh how time flies... a year and a half later, I can definitely address this change myself as part of an upgrade, but I want to review it first. I have a feeling that we want the integration to not sum to 1, but I feel this should come with a warning statement. Please advise.

@lcgraham
Copy link
Contributor

I don't know if it's helpful or relevant anymore, but I've updated the privileges in
https://github.com/lcgraham/pyMFMC and
https://github.com/UT-CHG/pyMFMC in case there's anything helpful in there for y'all.

@mathematicalmichael
Copy link
Collaborator

mathematicalmichael commented Jan 23, 2019 via email

@lcgraham
Copy link
Contributor

@mathematicalmichael I've invited you to the bet-dev team on GitHub under the UT-CHG org/group. If the invite doesn't work of go through. I can try again and @smattis and @eecsu should have the same permissions to add you.

@mathematicalmichael
Copy link
Collaborator

mathematicalmichael commented Jan 23, 2019 via email

@mathematicalmichael
Copy link
Collaborator

@lcgraham is pyMFMC still in dev or has it been shelved? Was the idea to possibly add it into BET? Seems unnecessary since the integration functionality seems self-contained. @smattis what were your thoughts originally for use?

@lcgraham
Copy link
Contributor

@mathematicalmichael unfortunately pyMCMC has pretty much been shelved. I don’t think it would make sense to add to BET since it as built to be self-contained separate from BET. You might want to just add in the integration subpackage if you’d find that helpful.

@smattis
Copy link
Contributor Author

smattis commented Jan 23, 2019

pyMFMC is completely written by @lcgraham. I don't think there was ever a plan to integrate it into BET, but it does depend on BET. Once @scottw13 and @lcgraham left academia, and I left UT most of the active development stopped, hence this TODO never being finished. However, the stable version has a lot of good stuff that I still use all of the time.

@mpilosov
Copy link
Contributor

mpilosov commented Jan 23, 2019 via email

@lcgraham
Copy link
Contributor

lcgraham commented Jan 23, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants