diana-hep / carl-notebooks

2 stars 5 forks source link

decomposition + parametrization #6

Open cranmer opened 8 years ago

cranmer commented 8 years ago

I'm working on example now that looks like amp_Gaus(x | mu, sigma) + (1-amp)_Uniform(x)

true_amp, true_mass, true_width = .2, 0., 0.3

amp = theano.shared(true_amp) 
mass = theano.shared(true_mass) 
width = theano.shared(true_width)

components = [
    Normal(mu=mass, sigma=width, random_state=0),   # c0
    Uniform(low=-5,high=5),
]

p0 = Mixture(components=components, weights=[amp, 1-amp], random_state=10)
p1 = Mixture(components=components[1:], weights=[1], random_state=11)

It is parametrized by amp, mu, sigma. I'd like to use a 2-d parametrized classifier in mu,sigma to classify Gaus vs. Uniform and then use the decomposition on top of that.

Also, it would need to be able to deal with Gaus(x | mu, sigma) vs. Gaus(x | mu' , sigma')

Not sure if this is possible.

glouppe commented 8 years ago

Also, it would need to be able to deal with Gaus(x | mu, sigma) vs. Gaus(x | mu' , sigma')

Unless I am misunderstanding, in this case you need to define mu and mu' using distinct theano variables. If you use the same python object, then the parameter will be shared across distributions, and this may not be what you want to do. Similarly, you should think if you really want to share the same components objects.

glouppe commented 8 years ago

(Maybe it would be best to move that issue to carl instead)

glouppe commented 8 years ago

It is parametrized by amp, mu, sigma. I'd like to use a 2-d parametrized classifier in mu,sigma to classify Gaus vs. Uniform and then use the decomposition on top of that.

Unfortunately, it is not yet possible to combine the decomposition with a prefit classifier. Not sure how to best do that easily, since you would need in this case to provide all pairwise classifiers. I'll think about it, but suggestions are welcome!