1
- module MLJExampleInterface
1
+ module MLJText
2
2
3
- # Example.jl doesn't actually provide machine learning models, so we
4
- # provide a module below with the same name to furnish us with simple
5
- # constant probabilistic classification. Note that `Example.fit`
6
- # ignores the training features `Xmatrix`.
3
+ # The following is just boostrap code to get a working template. You
4
+ # will remove this and replace "import .TextAnalysis" with "import
5
+ # TextAnalysis" and any other deps you need.
7
6
8
- module Example
7
+ module TextAnalysis
9
8
10
9
function fit (Xmatrix:: Matrix , yint:: AbstractVector{<:Integer} )
11
10
classes = sort (unique (yint))
@@ -36,11 +35,11 @@ end # of module
36
35
37
36
# ## CONTINUATION OF TEMPLATE
38
37
39
- import . Example # substitute model-providing package name here (no dot)
38
+ import . TextAnalysis # substitute model-providing package name here (no dot)
40
39
import MLJModelInterface
41
40
import ScientificTypesBase
42
41
43
- const PKG = " Example " # substitute model-providing package name
42
+ const PKG = " TextAnalysis " # substitute model-providing package name
44
43
const MMI = MLJModelInterface
45
44
const STB = ScientificTypesBase
46
45
@@ -66,7 +65,7 @@ function MMI.fit(::CoolProbabilisticClassifier, verbosity, X, y)
66
65
decode = MMI. decoder (y[1 ]) # for decoding int repr.
67
66
classes_seen = decode (sort (unique (yint))) # ordered by int repr.
68
67
69
- Θ = Example . fit (Xmatrix, yint) # probability vector
68
+ Θ = TextAnalysis . fit (Xmatrix, yint) # probability vector
70
69
fitresult = (Θ, classes_seen)
71
70
report = (n_classes_seen = length (classes_seen),)
72
71
cache = nothing
@@ -79,7 +78,7 @@ function MMI.predict(::CoolProbabilisticClassifier, fitresult, Xnew)
79
78
Xmatrix = MMI. matrix (Xnew)
80
79
81
80
Θ, classes_seen = fitresult
82
- prob_matrix = Example . predict (Xmatrix, Θ)
81
+ prob_matrix = TextAnalysis . predict (Xmatrix, Θ)
83
82
84
83
# `classes_seen` is a categorical vector whose pool actually
85
84
# includes *all* classes. The `UnivariateFinite` constructor
100
99
MMI. metadata_pkg (CoolProbabilisticClassifier,
101
100
name= " $PKG " ,
102
101
uuid= " 7876af07-990d-54b4-ab0e-23690620f79a" ,
103
- url= " https://github.com/JuliaLang/Example .jl" ,
102
+ url= " https://github.com/JuliaLang/TextAnalysis .jl" ,
104
103
is_pure_julia= true ,
105
104
license= " MIT" ,
106
105
is_wrapper= false
0 commit comments