Repository: JuliaAI/MLJBase.jl
Pull request #589 (2021-06-28 06:56:49)

For a 0.18.12 release
#588 


Patch:
diff --git a/LICENSE b/LICENSE
index d0945203..042af9b2 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
 MIT License
 
-Copyright (c) 2018 The Alan Turing Institute
+MIT License Copyright (c) 2021- JuliaAI Copyright (c) until 2021 The Alan Turing Institute
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
diff --git a/Project.toml b/Project.toml
index b2d5ec3a..98cde088 100644
--- a/Project.toml
+++ b/Project.toml
@@ -1,7 +1,7 @@
 name = "MLJBase"
 uuid = "a7f614a8-145f-11e9-1d2a-a57a1082229d"
 authors = ["Anthony D. Blaom <anthony.blaom@gmail.com>"]
-version = "0.18.11"
+version = "0.18.12"
 
 [deps]
 CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
@@ -15,13 +15,13 @@ InvertedIndices = "41ab1584-1d38-5bbf-9106-f11c6c58b48f"
 LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
 LossFunctions = "30fc2ffe-d236-52d8-8643-a9d8f7c094a7"
 MLJModelInterface = "e80e1ace-859a-464e-9ed9-23947d8ae3ea"
-MLJScientificTypes = "2e2323e0-db8b-457b-ae0d-bdfb3bc63afd"
 Missings = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28"
 OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
 Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
 PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
 ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
 Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
+ScientificTypes = "321657f4-b219-11e9-178b-2701a2544e81"
 StatisticalTraits = "64bff920-2084-43da-a3e6-9bb72801c0c9"
 Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
 StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
@@ -33,14 +33,14 @@ ComputationalResources = "0.3"
 Distributions = "0.22, 0.23, 0.24, 0.25"
 InvertedIndices = "1"
 LossFunctions = "0.5, 0.6, 0.7"
-MLJModelInterface = "0.4.1, 1.1"
-MLJScientificTypes = "0.4.1"
+MLJModelInterface = "0.4.1, 1"
 Missings = "0.4, 1"
 OrderedCollections = "1.1"
 Parameters = "0.12"
 PrettyTables = "1"
 ProgressMeter = "1.7.1"
-StatisticalTraits = "1.1"
+ScientificTypes = "2"
+StatisticalTraits = "2"
 StatsBase = "0.32, 0.33"
 Tables = "0.2, 1.0"
 julia = "1"
diff --git a/README.md b/README.md
index da3526b9..2827759e 100644
--- a/README.md
+++ b/README.md
@@ -9,16 +9,16 @@ learning framework.
 | `master` | v1    | [![Continuous Integration (CPU)][gha-img-master]][gha-url] | [![Code Coverage][codecov-img-master]][codecov-url-master] |
 | `dev`    | v1    | [![Continuous Integration (CPU)][gha-img-dev]][gha-url]    | [![Code Coverage][codecov-img-dev]][codecov-url-dev] |
 
-[gha-img-master]: https://github.com/alan-turing-institute/MLJBase.jl/workflows/CI/badge.svg?branch=master "Continuous Integration (CPU)"
-[gha-img-dev]: https://github.com/alan-turing-institute/MLJBase.jl/workflows/CI/badge.svg?branch=dev "Continuous Integration (CPU)"
-[gha-url]: https://github.com/alan-turing-institute/MLJBase.jl/actions/workflows/ci.yml
+[gha-img-master]: https://github.com/JuliaAI/MLJBase.jl/workflows/CI/badge.svg?branch=master "Continuous Integration (CPU)"
+[gha-img-dev]: https://github.com/JuliaAI/MLJBase.jl/workflows/CI/badge.svg?branch=dev "Continuous Integration (CPU)"
+[gha-url]: https://github.com/JuliaAI/MLJBase.jl/actions/workflows/ci.yml
 
-[codecov-img-master]: http://codecov.io/github/alan-turing-institute/MLJBase.jl/coverage.svg?branch=master "Code Coverage"
-[codecov-img-dev]: http://codecov.io/github/alan-turing-institute/MLJBase.jl/coverage.svg?branch=dev "Code Coverage"
-[codecov-url-master]: http://codecov.io/github/alan-turing-institute/MLJBase.jl?branch=master
-[codecov-url-dev]: http://codecov.io/github/alan-turing-institute/MLJBase.jl?branch=dev
+[codecov-img-master]: https://codecov.io/gh/JuliaAI/MLJBase.jl/branch/master/graphs/badge.svg?branch=master "Code Coverage"
+[codecov-img-dev]: https://codecov.io/gh/JuliaAI/MLJBase.jl/branch/dev/graphs/badge.svg?branch=dev "Code Coverage"
+[codecov-url-master]: https://codecov.io/github/JuliaAI/MLJBase.jl?branch=master
+[codecov-url-dev]: https://codecov.io/github/JuliaAI/MLJBase.jl?branch=dev
 
-[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://alan-turing-institute.github.io/MLJBase.jl/stable)
+[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliaai.github.io/MLJBase.jl/stable/)
 
 [MLJ](https://github.com/alan-turing-institute/MLJ.jl) is a Julia
 framework for combining and tuning machine learning models. This
@@ -26,7 +26,7 @@ repository provides core functionality for MLJ, including:
 
 - completing the functionality for methods defined "minimally" in
   MLJ's light-weight model interface
-  [MLJModelInterface](https://github.com/alan-turing-institute/MLJModelInterface.jl)
+  [MLJModelInterface](https://github.com/JuliaAI/MLJModelInterface.jl)
 
 - definition of **machines** and their associated methods, such as
   `fit!` and `predict`/`transform`. Serialization of machines,
@@ -49,7 +49,7 @@ repository provides core functionality for MLJ, including:
 
 - **one-dimensional hyperparameter range types**, constructors and
   associated methods, for use with
-  [MLJTuning](https://github.com/alan-turing-institute/MLJTuning.jl)
+  [MLJTuning](https://github.com/JuliaAI/MLJTuning.jl)
 
 - a [small
   interface](https://alan-turing-institute.github.io/MLJ.jl/dev/performance_measures/#Traits-and-custom-measures-1)
@@ -63,5 +63,5 @@ repository provides core functionality for MLJ, including:
 Previously MLJBase provided the model interface for integrating third
 party machine learning models into MLJ. That role has now shifted to
 the light-weight
-[MLJModelInterface](https://github.com/alan-turing-institute/MLJModelInterface.jl)
+[MLJModelInterface](https://github.com/JuliaAI/MLJModelInterface.jl)
 package.
diff --git a/docs/make.jl b/docs/make.jl
index 7daef8c5..318da608 100644
--- a/docs/make.jl
+++ b/docs/make.jl
@@ -1,6 +1,8 @@
 using Documenter
 using MLJBase
 
+const REPO="https://github.com/JuliaAI/MLJBase.jl"
+
 makedocs(;
     modules=[MLJBase],
     format=Documenter.HTML(prettyurls = get(ENV, "CI", nothing) == "true"),
@@ -11,21 +13,10 @@ makedocs(;
         "Composition" => "composition.md",
         "Datasets" => "datasets.md",
         "Distributions" => "distributions.md",
-        "OpenML" => "openml.md",
         "Utilities" => "utilities.md"
     ],
-    repo="https://github.com/alan-turing-institute/MLJBase.jl/blob/{commit}{path}#L{line}",
+    repo="$REPO/blob/{commit}{path}#L{line}",
     sitename="MLJBase.jl"
 )
 
-# By default Documenter does not deploy docs just for PR
-# this causes issues with how we're doing things and ends
-# up choking the deployment of the docs, so  here we
-# force the environment to ignore this so that Documenter
-# does indeed deploy the docs
-ENV["TRAVIS_PULL_REQUEST"] = "false"
-
-deploydocs(;
-           repo="github.com/alan-turing-institute/MLJBase.jl.git",
-           push_preview=false,
-)
+deploydocs(; repo=REPO, push_preview=false)
diff --git a/docs/src/index.md b/docs/src/index.md
index c6c376f1..c5780f51 100644
--- a/docs/src/index.md
+++ b/docs/src/index.md
@@ -48,8 +48,6 @@ including:
   library, user-defined measures, as well as many natively
   defined measures.
 
-- integration with [OpenML](https://www.openml.org)
-
 
 Previously MLJBase provided the model interface for integrating third
 party machine learning models into MLJ. That role has now shifted to
diff --git a/docs/src/openml.md b/docs/src/openml.md
deleted file mode 100644
index b5de1048..00000000
--- a/docs/src/openml.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# OpenML
-
-```@autodocs
-Modules = [MLJBase, OpenML]
-Pages   = ["openml.jl"]
-```
diff --git a/src/MLJBase.jl b/src/MLJBase.jl
index 6d2bfab1..1310a972 100644
--- a/src/MLJBase.jl
+++ b/src/MLJBase.jl
@@ -7,8 +7,8 @@ import Base: ==, precision, getindex, setindex!
 import Base.+, Base.*
 
 # Scitype
-import MLJScientificTypes.ScientificTypes: TRAIT_FUNCTION_GIVEN_NAME
-using MLJScientificTypes
+import ScientificTypes.ScientificTypesBase: TRAIT_FUNCTION_GIVEN_NAME
+using ScientificTypes
 
 # Traits for models and measures (which are being overloaded):
 using StatisticalTraits
@@ -64,7 +64,7 @@ using Statistics, LinearAlgebra, Random, InteractiveUtils
 ## EXPORTS
 
 # -------------------------------------------------------------------
-# re-exports from MLJModelInterface, MLJScientificTypes
+# re-exports from MLJModelInterface, ScientificTypes
 # NOTE: MLJBase does **not** re-export UnivariateFinite to avoid
 # ambiguities between the raw constructor (MLJBase.UnivariateFinite)
 # and the general method (MLJModelInterface.UnivariateFinite)
@@ -103,7 +103,7 @@ export fit, update, update_data, transform, inverse_transform,
 export matrix, int, classes, decoder, table,
     nrows, selectrows, selectcols, select
 
-# re-exports from MLJScientificTypes
+# re-exports from ScientificTypes
 export Unknown, Known, Finite, Infinite,
     OrderedFactor, Multiclass, Count, Continuous, Textual,
     Binary, ColorImage, GrayImage, Image, Table
diff --git a/src/composition/learning_networks/nodes.jl b/src/composition/learning_networks/nodes.jl
index 248d277b..7f56bbbc 100644
--- a/src/composition/learning_networks/nodes.jl
+++ b/src/composition/learning_networks/nodes.jl
@@ -133,8 +133,8 @@ function _apply(y_plus, input...; kwargs...)
     end
 end
 
-MLJScientificTypes.elscitype(N::Node) = Unknown
-function MLJScientificTypes.elscitype(
+ScientificTypes.elscitype(N::Node) = Unknown
+function ScientificTypes.elscitype(
     N::Node{<:Machine{<:Union{Deterministic,Unsupervised}}})
     if N.operation == MLJBase.predict
         return target_scitype(N.machine.model)
@@ -147,10 +147,10 @@ function MLJScientificTypes.elscitype(
 end
 
 # TODO after
-# https://github.com/alan-turing-institute/ScientificTypes.jl/issues/102 :
+# https://github.com/alan-turing-institute/ScientificTypesBase.jl/issues/102 :
 # Add Probabilistic case to above
 
-MLJScientificTypes.scitype(N::Node) = CallableReturning{elscitype(N)}
+ScientificTypes.scitype(N::Node) = CallableReturning{elscitype(N)}
 
 
 ## FITTING A NODE
diff --git a/src/composition/models/stacking.jl b/src/composition/models/stacking.jl
index 55369034..a8129803 100644
--- a/src/composition/models/stacking.jl
+++ b/src/composition/models/stacking.jl
@@ -52,42 +52,59 @@ const Stack{modelnames, inp_scitype, tg_scitype} =
             ProbabilisticStack{modelnames, inp_scitype, tg_scitype}}
 
 """
-    Stack(;metalearner=nothing, resampling=CV(), named_models...)
+    Stack(;metalearner=nothing, resampling=CV(), name1=model1, name2=model2, ...)
 
-Implements the generalized Stack algorithm introduced by Wolpert
-in https://www.sciencedirect.com/science/article/abs/pii/S0893608005800231 and
-generalized by Van der Laan et al in https://biostats.bepress.com/ucbbiostat/paper222/.
+Implements the two-layer generalized stack algorithm introduced by
+[Wolpert
+(1992)](https://www.sciencedirect.com/science/article/abs/pii/S0893608005800231)
+and generalized by [Van der Laan et al
+(2007)](https://biostats.bepress.com/ucbbiostat/paper222/). Returns an
+instance of type `ProbablisiticStack` or `DeterministicStack`,
+depending on the prediction type of `metalearner`.
 
-Instead of using your favorite model, use them all! The Stack is a metalearning algorithm
-covered by theoretical guarantees.
+When training a machine bound to such an instance:
 
-The stack in a nutshell:
+- The data is split into training/validation sets according to the
+  specified `resampling` strategy.
 
-- The data is split in training/validation sets
-- Each model in the library is trained on each training set and outputs predictions on the validation sets
-- The metalearner is subsequently trained on those predictions and finds the best combination of the models
-in the library.
-- Each model is then retrained on the full data
-- "Stacking" those models and the metalearner results in an end to end fully trained model
+- Each base model `model1`, `model2`, ... is trained on each training
+  subset and outputs predictions on the corresponding validation
+  sets. The multi-fold predictions are spliced together into a
+  so-called out-of-sample prediction for each model.
 
-You are not exempt from evaluating the stack.
+- The adjudicating model, `metalearner`, is subsequently trained on
+  the out-of-sample predictions to learn the best combination of base
+  model predictions.
 
-We currently provide two different stack types the `DeterministicStack` and the `ProbabilisticStack`.
-The type of which is automatically chosen by the constructor based on the provided metalearner.
+- Each base model is retrained on all supplied data for purposes of
+  passing on new production data onto the adjudicator for making new
+  predictions
 
-# Arguments
-- `metalearner::Model`: The model that will optimize the desired criterion based on its internals.
-                        For instance, a LinearRegression model will optimize the squared error.
-- `resampling::Union{CV, StratifiedCV}`: The resampling strategy used to train the metalearner.
-- `named_models`: The models that will be part of the library
+### Arguments
 
-# Examples
+- `metalearner::Supervised`: The model that will optimize the desired
+  criterion based on its internals.  For instance, a LinearRegression
+  model will optimize the squared error.
 
-Let's build a simple DeterministicStack for a continuous target, we show that:
+- `resampling::Union{CV, StratifiedCV}`: The resampling strategy used
+  to prepare out-of-sample predictions of the base learners
 
-- Some members of the library may very well be `Probabilistic` models even though the stack
-is `Deterministic`, the expected value will be taken.
-- Rather than running a hyperparameter search, you can integrate each model in the stack
+- `name1=model1, name2=model2, ...`: the `Supervised` model instances
+  to be used as base learners.  The provided names become properties
+  of the instance created to allow hyper-parameter access
+
+
+### Example
+
+The following code defines a `DeterministicStack` instance for
+learning a `Continuous` target, and demonstrates that:
+
+- Base models can be `Probabilistic` models even if the stack
+  itself is `Deterministic` (`predict_mean` is applied in such cases).
+
+- As an alternative to hyperparameter optimization, one can stack
+  multiple copies of given model, mutating the hyper-parameter used in
+  each copy.
 
 
 ```julia
diff --git a/src/measures/measures.jl b/src/measures/measures.jl
index 6224e554..6d0c68f0 100644
--- a/src/measures/measures.jl
+++ b/src/measures/measures.jl
@@ -51,11 +51,11 @@ end
 show_as_constructed(::Type{<:Measure}) = true
 
 # info (see also src/init.jl):
-function MLJScientificTypes.info(M, ::Val{:measure_type})
+function ScientificTypes.info(M, ::Val{:measure_type})
     values = Tuple(@eval($trait($M)) for trait in MEASURE_TRAITS)
     return NamedTuple{Tuple(MEASURE_TRAITS)}(values)
 end
-MLJScientificTypes.info(m, ::Val{:measure}) = info(typeof(m))
+ScientificTypes.info(m, ::Val{:measure}) = info(typeof(m))
 
 
 ## AGGREGATION
diff --git a/src/sources.jl b/src/sources.jl
index b91f7e18..6edebf73 100644
--- a/src/sources.jl
+++ b/src/sources.jl
@@ -45,8 +45,8 @@ source() = source(nothing)
 
 source(Xs::Source; args...) = Xs
 
-MLJScientificTypes.scitype(X::Source) = CallableReturning{X.scitype}
-MLJScientificTypes.elscitype(X::Source) = X.scitype
+ScientificTypes.scitype(X::Source) = CallableReturning{X.scitype}
+ScientificTypes.elscitype(X::Source) = X.scitype
 nodes(X::Source) = [X, ]
 Base.isempty(X::Source) = X.data === nothing
 nrows_at_source(X::Source) = nrows(X.data)


Test patch:
diff --git a/test/_models/DecisionTree.jl b/test/_models/DecisionTree.jl
index e8ebe83e..4ccc9bc4 100755
--- a/test/_models/DecisionTree.jl
+++ b/test/_models/DecisionTree.jl
@@ -3,7 +3,7 @@ export DecisionTreeClassifier, DecisionTreeRegressor
 import MLJBase
 import MLJBase: @mlj_model, metadata_pkg, metadata_model
 
-using MLJScientificTypes
+using ScientificTypes
 
 using CategoricalArrays
 
diff --git a/test/_models/MultivariateStats.jl b/test/_models/MultivariateStats.jl
index aafc7559..10f70f4d 100644
--- a/test/_models/MultivariateStats.jl
+++ b/test/_models/MultivariateStats.jl
@@ -5,7 +5,7 @@ import MLJBase: @mlj_model, metadata_model, metadata_pkg
 # using Distances
 using LinearAlgebra
 using Tables
-using MLJScientificTypes
+using ScientificTypes
 
 import MultivariateStats
 
diff --git a/test/_models/foobarmodel.jl b/test/_models/foobarmodel.jl
index 4aa6c23a..732a3273 100644
--- a/test/_models/foobarmodel.jl
+++ b/test/_models/foobarmodel.jl
@@ -4,7 +4,7 @@ export FooBarRegressor
 
 import MLJBase
 using LinearAlgebra
-using MLJScientificTypes
+using ScientificTypes
 
 mutable struct FooBarRegressor <: MLJBase.Deterministic
     lambda::Float64
diff --git a/test/composition/models/pipelines.jl b/test/composition/models/pipelines.jl
index 2726e0c9..2ff02d9c 100644
--- a/test/composition/models/pipelines.jl
+++ b/test/composition/models/pipelines.jl
@@ -4,7 +4,7 @@ using MLJBase
 using ..Models
 using Test
 using Statistics
-using MLJScientificTypes
+using ScientificTypes
 using StableRNGs
 
 rng = StableRNG(698790187)
diff --git a/test/data/data.jl b/test/data/data.jl
index 2da8b690..230a2edb 100644
--- a/test/data/data.jl
+++ b/test/data/data.jl
@@ -5,7 +5,7 @@ using Test
 import TypedTables
 using CategoricalArrays
 import Tables
-using MLJScientificTypes
+using ScientificTypes
 
 using Random
 using StableRNGs