@@ -66,7 +66,7 @@ this list, do `LearnAPI.functions()`.
66
66
See also [`LearnAPI.Algorithm`](@ref).
67
67
68
68
"""
69
- functions (:: Type ) = ()
69
+ functions (:: Any ) = ()
70
70
71
71
72
72
"""
@@ -104,13 +104,13 @@ Then we can declare
104
104
which is shorthand for
105
105
106
106
```julia
107
- LearnAPI.preferred_kind_of_proxy(::Type{<: MyNewAlgorithmType} ) = LearnAPI.Distribution()
107
+ LearnAPI.preferred_kind_of_proxy(::MyNewAlgorithmType) = LearnAPI.Distribution()
108
108
```
109
109
110
110
For more on target variables and target proxies, refer to the LearnAPI documentation.
111
111
112
112
"""
113
- preferred_kind_of_proxy (:: Type ) = nothing
113
+ preferred_kind_of_proxy (:: Any ) = nothing
114
114
115
115
"""
116
116
LearnAPI.position_of_target(algorithm)
@@ -122,7 +122,7 @@ If this number is `0`, then no target is expected. If this number exceeds `lengt
122
122
then `data` is understood to exclude the target variable.
123
123
124
124
"""
125
- position_of_target (:: Type ) = 0
125
+ position_of_target (:: Any ) = 0
126
126
127
127
"""
128
128
LearnAPI.position_of_weights(algorithm)
@@ -135,7 +135,7 @@ If this number is `0`, then no weights are expected. If this number exceeds
135
135
uniform.
136
136
137
137
"""
138
- position_of_weights (:: Type ) = 0
138
+ position_of_weights (:: Any ) = 0
139
139
140
140
descriptors () = [
141
141
:regression ,
@@ -180,7 +180,7 @@ Lists one or more suggestive algorithm descriptors from this list: $DOC_DESCRIPT
180
180
This trait should return a tuple of symbols, as in `(:classifier, :probabilistic)`.
181
181
182
182
"""
183
- descriptors (:: Type ) = ()
183
+ descriptors (:: Any ) = ()
184
184
185
185
"""
186
186
LearnAPI.is_pure_julia(algorithm)
@@ -192,7 +192,7 @@ Returns `true` if training `algorithm` requires evaluation of pure Julia code on
192
192
The fallback is `false`.
193
193
194
194
"""
195
- is_pure_julia (:: Type ) = false
195
+ is_pure_julia (:: Any ) = false
196
196
197
197
"""
198
198
LearnAPI.pkg_name(algorithm)
@@ -208,7 +208,7 @@ $DOC_UNKNOWN
208
208
Must return a string, as in `"DecisionTree"`.
209
209
210
210
"""
211
- pkg_name (:: Type ) = " unknown"
211
+ pkg_name (:: Any ) = " unknown"
212
212
213
213
"""
214
214
LearnAPI.pkg_license(algorithm)
@@ -217,7 +217,7 @@ Return the name of the software license, such as `"MIT"`, applying to the packag
217
217
core algorithm for `algorithm` is implemented.
218
218
219
219
"""
220
- pkg_license (:: Type ) = " unknown"
220
+ pkg_license (:: Any ) = " unknown"
221
221
222
222
"""
223
223
LearnAPI.doc_url(algorithm)
@@ -231,7 +231,7 @@ $DOC_UNKNOWN
231
231
Must return a string, such as `"https://en.wikipedia.org/wiki/Decision_tree_learning"`.
232
232
233
233
"""
234
- doc_url (:: Type ) = " unknown"
234
+ doc_url (:: Any ) = " unknown"
235
235
236
236
"""
237
237
LearnAPI.load_path(algorithm)
@@ -250,7 +250,7 @@ $DOC_UNKNOWN
250
250
251
251
252
252
"""
253
- load_path (:: Type ) = " unknown"
253
+ load_path (:: Any ) = " unknown"
254
254
255
255
256
256
"""
@@ -268,7 +268,7 @@ $DOC_ON_TYPE
268
268
269
269
270
270
"""
271
- is_wrapper (:: Type ) = false
271
+ is_wrapper (:: Any ) = false
272
272
273
273
"""
274
274
LearnAPI.human_name(algorithm)
@@ -284,7 +284,7 @@ to return `"K-nearest neighbors regressor"`. Ideally, this is a "concrete" noun
284
284
`"ridge regressor"` rather than an "abstract" noun like `"ridge regression"`.
285
285
286
286
"""
287
- human_name (M:: Type{} ) = snakecase (name (M), delim= ' ' ) # `name` defined below
287
+ human_name (M) = snakecase (name (M), delim= ' ' ) # `name` defined below
288
288
289
289
"""
290
290
LearnAPI.iteration_parameter(algorithm)
@@ -297,7 +297,7 @@ iterative.
297
297
Implement if algorithm is iterative. Returns a symbol or `nothing`.
298
298
299
299
"""
300
- iteration_parameter (:: Type ) = nothing
300
+ iteration_parameter (:: Any ) = nothing
301
301
302
302
"""
303
303
LearnAPI.fit_keywords(algorithm)
@@ -314,7 +314,7 @@ Here's a sample implementation for a classifier that implements a `LearnAPI.fit`
314
314
with signature `fit(algorithm::MyClassifier, verbosity, X, y; class_weights=nothing)`:
315
315
316
316
```
317
- LearnAPI.fit_keywords(::Type {<:MyClassifier}) = (:class_weights,)
317
+ LearnAPI.fit_keywords(::Any {<:MyClassifier}) = (:class_weights,)
318
318
```
319
319
320
320
or the shorthand
@@ -325,7 +325,7 @@ or the shorthand
325
325
326
326
327
327
"""
328
- fit_keywords (:: Type ) = ()
328
+ fit_keywords (:: Any ) = ()
329
329
330
330
"""
331
331
LearnAPI.fit_scitype(algorithm)
@@ -353,7 +353,7 @@ See also [`LearnAPI.fit_type`](@ref), [`LearnAPI.fit_observation_scitype`](@ref)
353
353
Optional. The fallback return value is `Union{}`. $DOC_ONLY_ONE
354
354
355
355
"""
356
- fit_scitype (:: Type ) = Union{}
356
+ fit_scitype (:: Any ) = Union{}
357
357
358
358
"""
359
359
LearnAPI.fit_observation_scitype(algorithm)
@@ -386,7 +386,7 @@ See also See also [`LearnAPI.fit_type`](@ref), [`LearnAPI.fit_scitype`](@ref),
386
386
Optional. The fallback return value is `Union{}`. $DOC_ONLY_ONE
387
387
388
388
"""
389
- fit_observation_scitype (:: Type ) = Union{}
389
+ fit_observation_scitype (:: Any ) = Union{}
390
390
391
391
"""
392
392
LearnAPI.fit_type(algorithm)
@@ -413,7 +413,7 @@ See also [`LearnAPI.fit_scitype`](@ref), [`LearnAPI.fit_observation_type`](@ref)
413
413
Optional. The fallback return value is `Union{}`. $DOC_ONLY_ONE
414
414
415
415
"""
416
- fit_type (:: Type ) = Union{}
416
+ fit_type (:: Any ) = Union{}
417
417
418
418
"""
419
419
LearnAPI.fit_observation_type(algorithm)
@@ -446,7 +446,7 @@ See also See also [`LearnAPI.fit_type`](@ref), [`LearnAPI.fit_scitype`](@ref),
446
446
Optional. The fallback return value is `Union{}`. $DOC_ONLY_ONE
447
447
448
448
"""
449
- fit_observation_type (:: Type ) = Union{}
449
+ fit_observation_type (:: Any ) = Union{}
450
450
451
451
DOC_INPUT_SCITYPE (op) =
452
452
"""
@@ -543,22 +543,22 @@ DOC_OUTPUT_TYPE(op) =
543
543
"""
544
544
545
545
" $(DOC_INPUT_SCITYPE (:predict )) "
546
- predict_input_scitype (:: Type ) = Union{}
546
+ predict_input_scitype (:: Any ) = Union{}
547
547
548
548
" $(DOC_INPUT_TYPE (:predict )) "
549
- predict_input_type (:: Type ) = Union{}
549
+ predict_input_type (:: Any ) = Union{}
550
550
551
551
" $(DOC_INPUT_SCITYPE (:transform )) "
552
- transform_input_scitype (:: Type ) = Union{}
552
+ transform_input_scitype (:: Any ) = Union{}
553
553
554
554
" $(DOC_OUTPUT_SCITYPE (:transform )) "
555
- transform_output_scitype (:: Type ) = Any
555
+ transform_output_scitype (:: Any ) = Any
556
556
557
557
" $(DOC_INPUT_TYPE (:transform )) "
558
- transform_input_type (:: Type ) = Union{}
558
+ transform_input_type (:: Any ) = Union{}
559
559
560
560
" $(DOC_OUTPUT_TYPE (:transform )) "
561
- transform_output_type (:: Type ) = Any
561
+ transform_output_type (:: Any ) = Any
562
562
563
563
564
564
# # TWO-ARGUMENT TRAITS
@@ -591,7 +591,7 @@ const DOC_PREDICT_OUTPUT(s) =
591
591
regressor type `MyRgs` that only predicts actual values of the target:
592
592
593
593
LearnAPI.predict(alogrithm::MyRgs, ::LearnAPI.LiteralTarget, data...) = ...
594
- LearnAPI.predict_output_$(s) (::Type{<: MyRgs} , ::LearnAPI.LiteralTarget) =
594
+ LearnAPI.predict_output_$(s) (::MyRgs, ::LearnAPI.LiteralTarget) =
595
595
AbstractVector{ScientificTypesBase.Continuous}
596
596
597
597
The fallback method returns `Any`.
@@ -607,9 +607,9 @@ predict_output_type(algorithm, kind_of_proxy) = Any
607
607
608
608
# # DERIVED TRAITS
609
609
610
- name (A:: Type ) = string (typename (A))
610
+ name (A) = string (typename (A))
611
611
612
- is_algorithm (A:: Type ) = ! isempty (functions (A))
612
+ is_algorithm (A) = ! isempty (functions (A))
613
613
614
614
const DOC_PREDICT_OUTPUT2 (s) =
615
615
"""
@@ -651,11 +651,3 @@ predict_output_type(algorithm) =
651
651
for T in CONCRETE_TARGET_PROXY_TYPES)
652
652
653
653
654
- # # FALLBACK FOR INSTANCES
655
-
656
- for trait in TRAITS
657
- ex = quote
658
- $ trait (x) = $ trait (typeof (x))
659
- end
660
- eval (ex)
661
- end
0 commit comments