UT-CHG / BET

Python package for data-consistent stochastic inverse and forward problems.
http://ut-chg.github.io/BET
Other
11 stars 21 forks source link

TODO 03.03.2017 #288

Open smattis opened 7 years ago

smattis commented 7 years ago
lcgraham commented 7 years ago

Can you elaborate a little more on what you mean by integration module? Thanks. On Fri, Mar 3, 2017 at 4:07 PM Steven Mattis notifications@github.com wrote:

  • integration module
  • example using Voronoi surrogate
  • look over selecting qois using sensitivity package and examples
  • jupyter notebook examples

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/UT-CHG/BET/issues/288, or mute the thread https://github.com/notifications/unsubscribe-auth/AC3o7e-jq0kiMgvF3lpLGOg_Pm2ZFg2Xks5riIErgaJpZM4MSv3Y .

--

Lindley Graham, Ph.D. 2015

smattis commented 7 years ago

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

lcgraham commented 7 years ago

Thank you. I can add this, I already have separate code that does this in pyMFMC.

On Mar 7, 2017, at 1:59 AM, Steven Mattis notifications@github.com wrote:

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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

mpilosov commented 7 years ago

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 commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

@lcgraham would you mind adding @mathematicalmichael? It’s my primary account now.

On Jan 23, 2019, at 8:50 AM, Lindley Graham notifications@github.com wrote:

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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/UT-CHG/BET/issues/288#issuecomment-456853641, or mute the thread https://github.com/notifications/unsubscribe-auth/AmfwtwtQSiil6IuCSju0kWhvLIqq86z4ks5vGITAgaJpZM4MSv3Y.

lcgraham commented 5 years ago

@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 commented 5 years ago

just got it and accepted. thanks!

On Jan 23, 2019, at 9:02 AM, Lindley Graham notifications@github.com wrote:

@mathematicalmichael https://github.com/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 https://github.com/smattis and @eecsu https://github.com/eecsu should have the same permissions to add you.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/UT-CHG/BET/issues/288#issuecomment-456858863, or mute the thread https://github.com/notifications/unsubscribe-auth/Amfwt9x0frUB4pz-dztLnxih-fzgfm8Yks5vGIeRgaJpZM4MSv3Y.

mathematicalmichael commented 5 years ago

@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 commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

So is pyMFMC something I should upgrade to Python 3 as well?

Not sent from my computer.

On Jan 23, 2019, at 09:59, Steven Mattis notifications@github.com<mailto:notifications@github.com> wrote:

pyMFMC is completely written by @lcgrahamhttps://github.com/lcgraham. I don't think there was ever a plan to integrate it into BET, but it does depend on BET. Once @scottw13https://github.com/scottw13 and @lcgrahamhttps://github.com/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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/UT-CHG/BET/issues/288#issuecomment-456882016, or mute the threadhttps://github.com/notifications/unsubscribe-auth/APidDj6irzBLRFgV4XFcsW81KcmN4Cpsks5vGJTggaJpZM4MSv3Y.

lcgraham commented 5 years ago

Definitely, no need to update pyMFMC to Python 3! I don't think there are any current users. If you do re-use or copy code from some of it into BET that you find useful then you'll have to update those portions, but only if you do that and find those portions of code useful.

On Wed, Jan 23, 2019 at 11:21 AM Michael Pilosov notifications@github.com wrote:

So is pyMFMC something I should upgrade to Python 3 as well?

Not sent from my computer.

On Jan 23, 2019, at 09:59, Steven Mattis <notifications@github.com<mailto: notifications@github.com>> wrote:

pyMFMC is completely written by @lcgrahamhttps://github.com/lcgraham. I don't think there was ever a plan to integrate it into BET, but it does depend on BET. Once @scottw13https://github.com/scottw13 and @lcgraham< https://github.com/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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub< https://github.com/UT-CHG/BET/issues/288#issuecomment-456882016>, or mute the thread< https://github.com/notifications/unsubscribe-auth/APidDj6irzBLRFgV4XFcsW81KcmN4Cpsks5vGJTggaJpZM4MSv3Y>.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/UT-CHG/BET/issues/288#issuecomment-456931916, or mute the thread https://github.com/notifications/unsubscribe-auth/AC3o7ZaMoZRU4uci07IqcAm3wqeACX4bks5vGLYfgaJpZM4MSv3Y .