@@ -4,6 +4,7 @@ using Test
4
4
using CategoricalDistributions
5
5
using CategoricalArrays
6
6
using StableRNGs
7
+ using FillArrays
7
8
using ScientificTypes
8
9
import Random
9
10
55
56
augment= true ,
56
57
pool= missing ))
57
58
59
+ # Test construction from non `Array` `AbstractArray`
60
+ v = categorical ([' x' , ' x' , ' y' , ' x' , ' z' , ' w' ])
61
+ probs_fillarray = FillArrays. Ones (100 , 3 )
62
+ probs_array = ones (100 , 3 )
63
+
64
+ probs1_fillarray = FillArrays. Fill (0.2 , 100 , 2 )
65
+ probs1_array = fill (0.2 , 100 , 2 )
66
+
67
+ u_from_array = UnivariateFinite ([' x' , ' y' , ' z' ], probs_array, pool= v)
68
+ u_from_fillarray = UnivariateFinite ([' x' , ' y' , ' z' ], probs_fillarray, pool= v)
69
+
70
+ u1_from_array = UnivariateFinite (
71
+ [' x' , ' y' , ' z' ], probs1_array, pool= v, augment= true
72
+ )
73
+ u1_from_fillarray = UnivariateFinite (
74
+ [' x' , ' y' , ' z' ], probs1_fillarray, pool= v, augment= true
75
+ )
76
+
77
+ @test u_from_array. prob_given_ref == u_from_fillarray. prob_given_ref
78
+ @test u1_from_array. prob_given_ref == u1_from_fillarray. prob_given_ref
79
+
58
80
# autosupport:
59
81
u = UnivariateFinite (probs, pool= missing , augment= true );
60
82
probs = probs ./ sum (probs)
0 commit comments