Skip to content

Add Hilbert Space Student T Process #6997

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

Closed
wants to merge 1 commit into from
Closed

Add Hilbert Space Student T Process #6997

wants to merge 1 commit into from

Conversation

ferrine
Copy link
Member

@ferrine ferrine commented Nov 7, 2023

Closes #6920


📚 Documentation preview 📚: https://pymc--6997.org.readthedocs.build/en/6997/

@ferrine ferrine force-pushed the hstp branch 3 times, most recently from 218f574 to 8ee10ce Compare November 7, 2023 15:11
Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Attention: Patch coverage is 94.73684% with 1 line in your changes missing coverage. Please review.

Project coverage is 92.12%. Comparing base (ec4407d) to head (e597d7d).
Report is 385 commits behind head on main.

Files with missing lines Patch % Lines
pymc/gp/hsgp_approx.py 94.11% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6997      +/-   ##
==========================================
+ Coverage   87.78%   92.12%   +4.33%     
==========================================
  Files         100      100              
  Lines       16896    16911      +15     
==========================================
+ Hits        14832    15579     +747     
+ Misses       2064     1332     -732     
Files with missing lines Coverage Δ
pymc/gp/__init__.py 100.00% <100.00%> (ø)
pymc/gp/hsgp_approx.py 92.43% <94.11%> (+0.05%) ⬆️

... and 8 files with indirect coverage changes

@ricardoV94 ricardoV94 requested a review from bwengals November 7, 2023 19:15
@ricardoV94 ricardoV94 added GP Gaussian Process enhancements labels Nov 7, 2023
@bwengals
Copy link
Contributor

bwengals commented Nov 7, 2023

After seeing this there's a couple things that make me prefer the option of passing nu as an optional kwarg to HSGP.__init__. Mostly am concerned that Periodic HSGP #6877 won't fit within this pattern, which is a bit difficult because it's structured differently itself (an approximate spectral density and a different basis). Also it's a bit unfortunate that the docstring is split, so now it ends up being mostly boilerplate for the t-process version.

What about nu as a kwarg for HSGP, with a default of None? And use the _base_dist idea that you have to set it. The docstring of HSGP can explain the nu argument. Then we could add a function to be an alias for HSTP, like

def HSTP(mean_func, cov_func, nu):
    """ Hilbert Space Student-t process

    Reference: ...
    """
    return HSGP(...)

Then we don't need to think about an inheritance structure or refactor again so it works with HSGP Periodic, especially because it'd be great to have HSTP Periodic.

RE _base_dist, could it be anything? I would expect it'd only be Normal or StudentT. Might be nice to be explicit about that.

But I'm super excited to use this, I think HSTP will be used as a default before HSGP in a lot of cases. What do you think @ferrine?

mean_func=mean_func,
cov_func=scale_func,
)
self.nu = pt.as_tensor_variable(nu)
Copy link
Member

@ricardoV94 ricardoV94 Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Referencing variables in the scope of the class is what's messing up with #6883

Is there another way?

PS: I know this is just the tip of the iceberg but would be great to figure it out sooner rather than later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there another way?

Yeah, probably for the GP classes it's possible, but I think for the covariance functions is where it will be a lot harder.

@ferrine
Copy link
Member Author

ferrine commented Dec 2, 2023

Let's wait the #6883 and then continue, so it will be one round of refactoring

@bwengals
Copy link
Contributor

Let's wait the #6883 and then continue, so it will be one round of refactoring

Are you sure? Pytensorifying the GP and covariance function library is a huge refactor. I think that it'd be great to get HSTP's in ASAP, and a refactor isn't necessary to do so (see my comment from Nov 7 above here).

@ricardoV94
Copy link
Member

I agree with @bwengals, it might take a while to do the other changes.

@ferrine
Copy link
Member Author

ferrine commented Dec 13, 2023

Still not sure what should be the design choice, and should this eve stop me from taking any branch I find more appealing. We'll anyway refactor everything as far as I get it

@bwengals
Copy link
Contributor

What about just keeping the _base_dist idea like you have, and have nu be a optional kwarg to HSGP? Then _base_dist can either be StudentT if nu is not None or Normal if nu is None. That would keep it all within HSGP, and you could just modify the docstring once there. I think it'd make HSTPs easier for users to discover. Then if you wanted to make an quick alias for HSTP you could. wdyt?

@ferrine ferrine closed this Jul 9, 2024
@ferrine
Copy link
Member Author

ferrine commented Jul 9, 2024

After all the refactorings in HSGP, it makes sense to create the PR from scratch

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

Successfully merging this pull request may close these issues.

HSTP
3 participants