forked from ppalmes/CombineML.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.jl
39 lines (32 loc) · 1.05 KB
/
types.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# CombineML types.
module Types
export Transformer,
Learner,
TestLearner,
fit!,
transform!
# All transformer types must have implementations
# of function `fit!` and `transform!`.
abstract type Transformer end
# Learner abstract type which all machine learners implement.
abstract type Learner <: Transformer end
# Test learner.
# Used to separate production learners from test.
abstract type TestLearner <: Learner end
# Trains transformer on provided instances and labels.
#
# @param transformer Target transformer.
# @param instances Training instances.
# @param labels Training labels.
function fit!(transformer::Transformer, instances::Matrix, labels::Vector)
error(typeof(transformer), " does not implement fit!")
end
# Trains transformer on provided instances and labels.
#
# @param transformer Target transformer.
# @param instances Original instances.
# @return Transformed instances.
function transform!(transformer::Transformer, instances::Matrix)
error(typeof(transformer), " does not implement transform!")
end
end # module