File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -32,21 +32,28 @@ this package is the class pool of a `CategoricalArray`:
32
32
``` julia
33
33
using CategoricalDistributions
34
34
using CategoricalArrays
35
+ import Distributions
35
36
julia> data = rand ([" yes" , " no" , " maybe" ], 10 ) |> categorical
36
37
10 - element CategoricalArray{String,1 ,UInt32}:
37
- " maybe"
38
- " maybe"
39
38
" no"
40
39
" yes"
41
- " maybe"
42
40
" no"
41
+ " maybe"
42
+ " maybe"
43
43
" no"
44
+ " maybe"
44
45
" no"
45
46
" no"
46
- " yes"
47
+ " maybe"
48
+
49
+ julia> d = Distributions. fit (UnivariateFinite, data)
50
+ UnivariateFinite{Multiclass{3 }}
51
+ ┌ ┐
52
+ maybe ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.4
53
+ no ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.5
54
+ yes ┤■■■■■■■ 0.1
55
+ └ ┘
47
56
48
- julia> d = fit (UnivariateFinite, data)
49
- UnivariateFinite {Multiclass{3}} (maybe=> 0.3 , no=> 0.5 , yes=> 0.2 )
50
57
51
58
julia> pdf (d, " no" )
52
59
0.5
You can’t perform that action at this time.
0 commit comments