QInfer / python-qinfer

Library for Bayesian inference via sequential Monte Carlo for quantum parameter estimation.
BSD 3-Clause "New" or "Revised" License
92 stars 31 forks source link

Add unknown T₂, Gaussian hyperparameterized models. #146

Closed cgranade closed 6 years ago

cgranade commented 6 years ago

This PR adds two new models, one which learns Rabi frequencies with unknown T₂ processes, the other of which decorates two-outcome models with Gaussian hyperparameters based on a latent two-outcome variable. This allows for using QInfer to learn T₂ in cases where single-shot measurements are not directly observed, but are only observed through a secondary process that is Gaussian distributed.

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-0.6%) to 74.549% when pulling acbd0c9cd4cfe440e4a214278acd7e8e9e8923e4 on cgranade/unknown-T2 into 64d9b2f7fe38f19e1261ef8ba0a14f306bc1c690 on master.

ihincks commented 6 years ago

The 4 CI failures look like they have nothing to do with this PR. Are they due to a new numpy thing?

cgranade commented 6 years ago

Thanks for the review, @ihincks! I'll go on and fix those ASAP. As far as the CI failures, I think that's leftover from #135, and is due to NumPy finally making something an error that was a FutureWarning for a long time. I'll investigate in #135, then, so that I can start clearing out the backlog of PRs contingent on CI failures.

ihincks commented 6 years ago

Consider throwing a test or two into test_concrete_models.py. Untested:

class TestGaussianHyperparameterizedModel(ConcreteModelTest, DerandomizedTestCase):
    """
    Tests GaussianHyperparameterizedModel with CoinModel as the underlying model
    (underlying model has no expparams).
    """

    def instantiate_model(self):
        return GaussianHyperparameterizedModel(CoinModel())
    def instantiate_prior(self):
        return ProductDistribution(
               BetaDistribution(mean=0.5, var=0.1),
               ...
        )
    def instantiate_expparams(self):
return np.arange(100, 120).astype(self.model.expparams_dtype)
taalexander commented 6 years ago

This looks great. I agree with @ihincks it is a good addition. It seems as we move forward experimentally there is an increasing focus on continuous outcome distributions. Once I find more time I want to focus on explicitly supporting continuous outcomes (right now IIRC it is maybe hinted at in the documentation but left to the user to figure out how to support them). This would also include supporting the branch me and Ian have been working on to support continuous outcomes natively include experiment design in smc.py. I will try and clean this up and get tests passing later this week so that I can submit a PR. There will be a decent amount of documentation and testing to get it in working condition. I hope that after @ihincks defends he might be able to help me review this and come up with a plan.

cgranade commented 6 years ago

Sounds great, @taalexander! Thanks as well for the typo catch, @ihincks. I think this might be good to go once I can get the CI builds working. Would anyone mind if I merge in #135, since CI seems to work there again? That would mean deprecating 3.3 in favor of Python 2.7 or ≥ 3.4. Since 3.3 is now approximately six years old, I don't think that should be a problem...

cgranade commented 6 years ago

Awesome, thanks for everything! 💕