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

Relax test assumptions #21

Merged
merged 3 commits into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
10 changes: 5 additions & 5 deletions src/test_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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)]
willtebbutt marked this conversation as resolved.
Show resolved Hide resolved
end
end

Expand Down Expand Up @@ -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
Expand All @@ -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}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do these have to be Continuous?

Copy link
Member

Choose a reason for hiding this comment

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

Because multivariate classification isn't a thing we care about supporting?
We barely support classification.

@test predictions isa Vector{<:ContinuousMultivariateDistribution}
willtebbutt marked this conversation as resolved.
Show resolved Hide resolved
@test length(predictions) == size(outputs, 2)
@test all(length.(predictions) .== size(outputs, 1))
end
Expand Down