From 0ae71f892f198110386bf6b4d8b15232a5acf8ac Mon Sep 17 00:00:00 2001 From: wt Date: Thu, 27 Aug 2020 13:59:01 +0100 Subject: [PATCH 1/3] Relax test assumptions --- src/test_utils.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test_utils.jl b/src/test_utils.jl index 4c144b4..6a8c126 100644 --- a/src/test_utils.jl +++ b/src/test_utils.jl @@ -6,7 +6,7 @@ testing downstream dependencies, and [`test_interface`](@ref) for testing the Mo been correctly implemented. """ module TestUtils -using Distributions: Normal, MultivariateNormal +using Distributions using Models using NamedDims using StatsBase @@ -75,7 +75,7 @@ function FakeTemplate{DistributionEstimate, SingleOutput}() FakeTemplate{DistributionEstimate, SingleOutput}() do num_variates, inputs @assert(num_variates == 1, "$num_variates != 1") inputs = NamedDimsArray{(:features, :observations)}(inputs) - return Normal.(zeros(size(inputs, :observations))) + return NoncentralT.(3.0, zeros(size(inputs, :observations))) end end @@ -88,7 +88,7 @@ distribution (with zero-vector mean and identity covariance matrix) for each obs function FakeTemplate{DistributionEstimate, MultiOutput}() FakeTemplate{DistributionEstimate, MultiOutput}() do num_variates, inputs std_dev = ones(num_variates) - return [MultivariateNormal(std_dev) for _ in 1:size(inputs, 2)] + return [Product(Normal.(0, std_dev)) for _ in 1:size(inputs, 2)] end end @@ -158,7 +158,7 @@ function test_interface( inputs=rand(5, 5), outputs=rand(1, 5), ) predictions = test_common(template, inputs, outputs) - @test predictions isa Vector{<:Normal{<:Real}} + @test predictions isa Vector{<:ContinuousUnivariateDistribution} @test length(predictions) == size(outputs, 2) @test all(length.(predictions) .== size(outputs, 1)) end @@ -168,7 +168,7 @@ function test_interface( inputs=rand(5, 5), outputs=rand(3, 5) ) predictions = test_common(template, inputs, outputs) - @test predictions isa Vector{<:MultivariateNormal{<:Real}} + @test predictions isa Vector{<:ContinuousMultivariateDistribution} @test length(predictions) == size(outputs, 2) @test all(length.(predictions) .== size(outputs, 1)) end From 3c6a302e1fad947c0c391b384038949725c9d472 Mon Sep 17 00:00:00 2001 From: wt Date: Thu, 27 Aug 2020 14:01:00 +0100 Subject: [PATCH 2/3] Bump patch --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 033e237..49a43f8 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Models" uuid = "e6388cff-ecff-480c-9b53-83211bf7812a" authors = ["Invenia Technical Computing Corporation"] -version = "0.2.2" +version = "0.2.3" [deps] Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" From 3eab6af62418551c09e598bac696f807030a32b1 Mon Sep 17 00:00:00 2001 From: wt Date: Thu, 27 Aug 2020 14:56:10 +0100 Subject: [PATCH 3/3] Relax Vector to AbstractVector --- src/test_utils.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test_utils.jl b/src/test_utils.jl index 6a8c126..e33d173 100644 --- a/src/test_utils.jl +++ b/src/test_utils.jl @@ -158,7 +158,7 @@ function test_interface( inputs=rand(5, 5), outputs=rand(1, 5), ) predictions = test_common(template, inputs, outputs) - @test predictions isa Vector{<:ContinuousUnivariateDistribution} + @test predictions isa AbstractVector{<:ContinuousUnivariateDistribution} @test length(predictions) == size(outputs, 2) @test all(length.(predictions) .== size(outputs, 1)) end @@ -168,7 +168,7 @@ function test_interface( inputs=rand(5, 5), outputs=rand(3, 5) ) predictions = test_common(template, inputs, outputs) - @test predictions isa Vector{<:ContinuousMultivariateDistribution} + @test predictions isa AbstractVector{<:ContinuousMultivariateDistribution} @test length(predictions) == size(outputs, 2) @test all(length.(predictions) .== size(outputs, 1)) end