File tree Expand file tree Collapse file tree 4 files changed +39
-0
lines changed Expand file tree Collapse file tree 4 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ using Test
2
+ using LearnAPI
3
+
4
+ @testset " `obs` fallback" begin
5
+ @test obs (" some learner" , 42 ) == 42
6
+ end
7
+
8
+ true
Original file line number Diff line number Diff line change
1
+ using Test
2
+ using LearnAPI
3
+
4
+ struct Cherry end
5
+
6
+ LearnAPI. fit (learner:: Cherry , data; verbosity= 1 ) = Ref (learner)
7
+ LearnAPI. learner (model:: Base.RefValue{Cherry} ) = model[]
8
+ LearnAPI. predict (model:: Base.RefValue{Cherry} , :: Point , x) = 2 x
9
+ @trait Cherry kinds_of_proxy= (Point (),)
10
+
11
+ struct Ripe end
12
+
13
+ LearnAPI. fit (learner:: Ripe , data; verbosity= 1 ) = Ref (learner)
14
+ LearnAPI. learner (model:: Base.RefValue{Ripe} ) = model[]
15
+ LearnAPI. predict (model:: Base.RefValue{Ripe} , :: Distribution ) = " a distribution"
16
+ LearnAPI. features (:: Ripe , data) = nothing
17
+ @trait Ripe kinds_of_proxy= (Distribution (),)
18
+
19
+ @testset " `predict` with no kind of proxy specified" begin
20
+ model = fit (Cherry (), " junk" )
21
+ @test predict (model, 42 ) == 84
22
+
23
+ model = fit (Ripe (), " junk" )
24
+ @test predict (model) == " a distribution"
25
+ end
26
+
27
+ true
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ test_files = [
4
4
" tools.jl" ,
5
5
" traits.jl" ,
6
6
" clone.jl" ,
7
+ " predict_transform.jl" ,
8
+ " obs.jl" ,
7
9
" accessor_functions.jl" ,
8
10
" target_features.jl" ,
9
11
# "patterns/regression.jl",
Original file line number Diff line number Diff line change @@ -71,3 +71,5 @@ import .FruitSalad
71
71
@testset " name" begin
72
72
@test LearnAPI. name (FruitSalad. RedApple (1 )) == " RedApple"
73
73
end
74
+
75
+ true
You can’t perform that action at this time.
0 commit comments