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

GPR #119

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

GPR #119

wants to merge 9 commits into from

Conversation

MarlaJahari
Copy link

added two gpr fit() functions, struct and dependencies

@ayushpatnaikgit
Copy link
Member

Can you add some test cases? Can you see how tests are done for the other functions?

@sourish-cmi
Copy link
Collaborator

Can you add some test cases? Can you see how tests are done for the other functions?

Sure - I will add some tests.

Copy link
Collaborator

@sourish-cmi sourish-cmi left a comment

Choose a reason for hiding this comment

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

looks fine

.vscode/launch.json Outdated Show resolved Hide resolved
src/bayesian/gaussian_processes_regression.jl Show resolved Hide resolved
@sourish-cmi
Copy link
Collaborator

I will share some test in a day or two

src/CRRao.jl Outdated Show resolved Hide resolved
Space after comma

Co-authored-by: Ayush Patnaik <[email protected]>
@ayushpatnaikgit
Copy link
Member

All tests are failing @sourish-cmi, but they aren't related to this PR. We need to spend some time and fix the package.

@sourish-cmi
Copy link
Collaborator

Sorry guys I will try to put some test cases asap

@sourish-cmi
Copy link
Collaborator

@ayushpatnaikgit @MarlaJahari @ShouvikGhosh2048

Here are some tests - we should try:

Test 1:

container=fit(@formula(MPG ~0+ HP),df,GaussianProcessesRegression(),[:MPG, :HP],MeanZero(), SE(0.0,0.0),Euclidean())

Test 1a:
Kernel parameters should provide values:
5.464908573213355 and 3.3936838718120708

Test 1b:
Variance of observation noise = 9.667961411202336

Test 1c:
Marginal Log-Likelihood = -89.745

@MarlaJahari
Copy link
Author

@sourish-cmi These (exact parameters) tests were run on the function before PR was made. We got the specified values (documented as a part of test cases before function definition).

@sourish-cmi
Copy link
Collaborator

@sourish-cmi These (exact parameters) tests were run on the function before PR was made. We got the specified values (documented as a part of test cases before function definition).

I think that should be fine. The test case should be developed based on the same.

@ShouvikGhosh2048 can you please add test case?

@ShouvikGhosh2048
Copy link
Collaborator

Should I add it to this branch, or add it after this PR is merged?

@sourish-cmi
Copy link
Collaborator

Should I add it to this branch, or add it after this PR is merged?

I think you can add this test to this branch. Once the PR is merged - give a KT to @MarlaJahari - then she can add other tests as separate PR later.

@ShouvikGhosh2048
Copy link
Collaborator

I don't have the required permissions.

Changes to be made:

  1. Create a new file test/numerical/bayesian/GaussianProcessesRegression.jl and add the following:
mtcars = dataset("datasets", "mtcars")

CRRao.set_rng(StableRNG(123))
model = fit(@formula(MPG ~ 0 + HP), mtcars, GaussianProcessesRegression(), [:MPG, :HP], MeanZero(), SE(0.0, 0.0), Euclidean())

@test get_params(model.chain)[2:3]  [5.464908573213355, 3.3936838718120708]
@test noise_variance(model.chain)  9.667961411202336
@test model.chain.target  -89.74473360543863
  1. Change test/Project.toml to:
[deps]
Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
GLM = "38e38edf-8417-5370-95a0-9cbb8c7f171a"
GaussianProcesses = "891a1506-143c-57d2-908e-e1f8e92e6de9"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
RDatasets = "ce6b1742-4840-55fa-b093-852dadbb1d8b"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsModels = "3eaba693-59b7-5ba5-a881-562e759f1c8d"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
  1. Change test/runtests.jl to:
using CRRao, Test, StableRNGs, Logging, RDatasets, StatsModels, GLM, Statistics, Distances
using GaussianProcesses: MeanZero, SE, get_params, noise_variance

Logging.disable_logging(Logging.Warn)

CRRao.setprogress!(false)
CRRao.set_rng(StableRNG(123))

@testset "CRRao.jl" begin
    @testset "Basic Tests" begin
        @testset "Linear Regression" begin
            include("basic/LinearRegression.jl")
        end

        @testset "Logistic Regression" begin
            include("basic/LogisticRegression.jl")
        end

        @testset "Poisson Regression" begin
            include("basic/PoissonRegression.jl")
        end

        @testset "Negative Binomial Regression" begin
            include("basic/NegBinomialRegression.jl")
        end
    end

    @testset "Numerical Tests" begin
        @testset "Random Number Generator" begin
            include("numerical/RandomNumberGenerator.jl")
        end

        @testset "Frequentist" begin
            include("numerical/frequentist/tests.jl")
        end

        @testset "Bayesian" begin
            @testset "Gaussian Processes Regression" begin
                include("numerical/bayesian/GaussianProcessesRegression.jl")
            end

            @testset "Linear Regression" begin
                include("numerical/bayesian/LinearRegression.jl")
            end

            @testset "Logistic Regression" begin
                include("numerical/bayesian/LogisticRegression.jl")
            end

            @testset "Poisson Regression" begin
                include("numerical/bayesian/PoissonRegression.jl")
            end

            @testset "Negative Binomial Regression" begin
                include("numerical/bayesian/NegBinomialRegression.jl")
            end
        end
    end
end

@sourish-cmi
Copy link
Collaborator

@ShouvikGhosh2048 @ayushpatnaikgit -- some checks are failing. Maybe some version issue. Not sure. What to do?

@sourish-cmi sourish-cmi added this to the Gaussian Processes milestone Jul 25, 2023
@ShouvikGhosh2048
Copy link
Collaborator

Similar issue occurs in #123

The GPR tests pass in the CI.

@sourish-cmi
Copy link
Collaborator

Similar issue occurs in #123

The GPR tests pass in the CI.

Yes - this is a recurring issue. How do we solve it?

@MarlaJahari
Copy link
Author

@sourish-cmi I think it comes from ADgradient() function of the LogDensityProblemsAD.jl package. For every regression problem we're trying to specify "gradientconfig" as a parameter- but it returns that is an unsupported keyword argument. It might be possible they've made updates or changes in the version we're trying to call.

@MarlaJahari
Copy link
Author

@sourish-cmi It might also be possible the Turing version (when supplying parameters in func) we're using doesn't support the keyword

@sourish-cmi
Copy link
Collaborator

@sourish-cmi It might also be possible the Turing version (when supplying parameters in func) we're using doesn't support the keyword

@MarlaJahari Strange - but possible. I think we should try to figure out exactly what changes in Turing.jl or ADgradient() are causing the problem

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

Successfully merging this pull request may close these issues.

4 participants