/
MLJ.jl
143 lines (116 loc) · 4.59 KB
/
MLJ.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
module MLJ
## METHOD EXPORT
export MLJ_VERSION
# utilities.jl:
export @curve, @pcurve
# ensembles.jl:
export EnsembleModel
# model_matching.jl:
export matching
## METHOD RE-EXPORT
# re-export from Random, Statistics, Distributions, CategoricalArrays:
export pdf, mode, median, mean, shuffle!, categorical, shuffle,
levels, levels!, std, support, sampler
# re-exports from (MLJ)ScientificTypes via MLJBase
export Scientific, Found, Unknown, Known, Finite, Infinite,
OrderedFactor, Multiclass, Count, Continuous, Textual,
Binary, ColorImage, GrayImage, Image, Table
export scitype, scitype_union, elscitype, nonmissing, trait
export coerce, coerce!, autotype, schema, info
# re-export from MLJBase:
export nrows, nfeatures, color_off, color_on,
selectrows, selectcols, restrict, corestrict, complement,
SupervisedTask, UnsupervisedTask, MLJTask,
Deterministic, Probabilistic, Unsupervised, Supervised, Static,
DeterministicNetwork, ProbabilisticNetwork, UnsupervisedNetwork,
target_scitype, input_scitype, output_scitype,
predict, predict_mean, predict_median, predict_mode,
transform, inverse_transform, evaluate, fitted_params, params,
@constant, @more, HANDLE_GIVEN_ID, UnivariateFinite,
classes, table, report, rebind!,
partition, unpack,
default_measure, measures,
@load_boston, @load_ames, @load_iris, @load_reduced_ames, @load_crabs,
load_boston, load_ames, load_iris, load_reduced_ames, load_crabs,
Machine, NodalMachine, machine, AbstractNode,
source, node, fit!, freeze!, thaw!, Node, sources, origins,
machines, sources, anonymize!, @from_network, fitresults,
@pipeline,
ResamplingStrategy, Holdout, CV,
StratifiedCV, evaluate!, Resampler, iterator,
default_resource, pretty,
OpenML
export measures,
orientation, reports_each_observation,
is_feature_dependent, aggregation,
aggregate,
default_measure, value,
mav, mae, rms, rmsl, rmslp1, rmsp, l1, l2,
confusion_matrix, confmat,
cross_entropy, BrierScore,
misclassification_rate, mcr, accuracy,
balanced_accuracy, bacc, bac,
matthews_correlation, mcc,
auc, area_under_curve, roc_curve, roc,
TruePositive, TrueNegative, FalsePositive, FalseNegative,
TruePositiveRate, TrueNegativeRate, FalsePositiveRate, FalseNegativeRate,
FalseDiscoveryRate, Precision, NPV, FScore,
TPR, TNR, FPR, FNR,
FDR, PPV,
Recall, Specificity, BACC,
truepositive, truenegative, falsepositive, falsenegative,
true_positive, true_negative, false_positive, false_negative,
truepositive_rate, truenegative_rate, falsepositive_rate,
true_positive_rate, true_negative_rate, false_positive_rate,
falsenegative_rate, negativepredictive_value,
false_negative_rate, negative_predictive_value,
positivepredictive_value, positive_predictive_value,
tpr, tnr, fpr, fnr,
falsediscovery_rate, false_discovery_rate, fdr, npv, ppv,
recall, sensitivity, hit_rate, miss_rate,
specificity, selectivity, f1score, f1, fallout
# re-export from MLJTuning:
export Grid, RandomSearch, Explicit, TunedModel,
learning_curve!, learning_curve
# re-export from MLJModels:
export models, localmodels, @load, load, info,
ConstantRegressor, ConstantClassifier, # builtins/Constant.jl
StaticTransformer, FeatureSelector, # builtins/Transformers.jl
UnivariateStandardizer, Standardizer,
UnivariateBoxCoxTransformer,
OneHotEncoder, ContinuousEncoder, UnivariateDiscretizer,
FillImputer
# re-export from ComputaionalResources:
export CPU1, CPUProcesses, CPUThreads
## METHOD IMPORT
# from the Standard Library:
import Distributed: @distributed, nworkers, pmap
import Pkg
import Pkg.TOML
# from the MLJ universe:
using MLJBase
import MLJBase.save
using MLJTuning
using MLJModels
using Tables, CategoricalArrays
import Distributions
import Distributions: pdf, mode
import Statistics, StatsBase, LinearAlgebra, Random
import Random: AbstractRNG, MersenneTwister
using ProgressMeter
using ComputationalResources
using ComputationalResources: CPUProcesses
# to be extended:
import MLJBase: fit, update, clean!, fit!, predict, fitted_params,
show_as_constructed, ==
import MLJModels: models
import MLJScientificTypes
## CONSTANTS
const srcdir = dirname(@__FILE__)
const CategoricalElement = Union{CategoricalString,CategoricalValue}
## INCLUDE FILES
include("version.jl") # defines MLJ_VERSION constant
include("ensembles.jl") # homogeneous ensembles
include("model_matching.jl")# inferring model search criterion from data
include("scitypes.jl") # extensions to ScientificTypes.scitype
end # module