Skip to content

Commit 7adad1a

Browse files
authored
Merge pull request #11 from alan-turing-institute/dev
Update to MLJBase 0.11.1
2 parents 869a38e + c053257 commit 7adad1a

File tree

9 files changed

+19
-21
lines changed

9 files changed

+19
-21
lines changed

Project.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "MLJTuning"
22
uuid = "03970b2e-30c4-11ea-3135-d1576263f10f"
33
authors = ["Anthony D. Blaom <anthony.blaom@gmail.com>"]
4-
version = "0.1.2"
4+
version = "0.1.3"
55

66
[deps]
77
ComputationalResources = "ed09eef8-17a6-5b46-8889-db040fac31e3"
@@ -11,17 +11,18 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1111
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
1212

1313
[compat]
14-
julia = "^1"
15-
MLJBase = "^0.10.1"
1614
ComputationalResources = "^0.3"
17-
RecipesBase = "^0.7"
15+
MLJBase = "^0.11.1"
16+
RecipesBase = "^0.8"
17+
julia = "^1"
1818

1919
[extras]
2020
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
2121
DecisionTree = "7806a523-6efd-50cb-b5f6-3fa6f1930dbb"
2222
Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
2323
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
2424
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
25+
MLJModelInterface = "e80e1ace-859a-464e-9ed9-23947d8ae3ea"
2526
MultivariateStats = "6f286f6a-111f-5878-ab1e-185364afe411"
2627
NearestNeighbors = "b8a86587-4115-5ab1-83bc-aa920d37bbce"
2728
ScientificTypes = "321657f4-b219-11e9-178b-2701a2544e81"
@@ -31,4 +32,4 @@ Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
3132
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
3233

3334
[targets]
34-
test = ["CategoricalArrays", "DecisionTree", "Distances", "Distributions", "LinearAlgebra", "MultivariateStats", "NearestNeighbors", "ScientificTypes", "Statistics", "StatsBase", "Tables", "Test"]
35+
test = ["CategoricalArrays", "DecisionTree", "Distances", "Distributions", "LinearAlgebra", "MLJModelInterface", "MultivariateStats", "NearestNeighbors", "ScientificTypes", "Statistics", "StatsBase", "Tables", "Test"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ learning models.
1010
### Contents
1111

1212
- [Who is this repo for?](#who-is-this-repo-for)
13-
- [What's provided here?](#what's-provided-here)
13+
- [What's provided here?](#what-is-provided-here)
1414
- [How do I implement a new tuning strategy?](#How-do-I-implement-a-new-tuning-strategy)
1515

1616
*Note:* This component of the [MLJ
@@ -46,7 +46,7 @@ MLJTuning is a component of the [MLJ
4646
there.
4747

4848

49-
## What's provided here?
49+
## What is provided here?
5050

5151
This repository contains:
5252

src/strategies/explicit.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
mutable struct Explicit <: TuningStrategy end
1+
mutable struct Explicit <: TuningStrategy end
22

33
# models! returns all available models in the range at once:
44
MLJTuning.models!(tuning::Explicit, model, history::Nothing,

test/models.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
module Models
88

99
using MLJBase
10+
import MLJModelInterface: @mlj_model, metadata_model, metadata_pkg
11+
import MLJModelInterface
1012

1113
include("models/Constant.jl")
1214
include("models/DecisionTree.jl")

test/models/Constant.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export ConstantClassifier, ConstantRegressor,
55
ProbabilisticConstantClassifer
66

77
import MLJBase
8-
import MLJBase: metadata_pkg, metadata_model
98
import Distributions
109

1110
"""

test/models/DecisionTree.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
export DecisionTreeClassifier, DecisionTreeRegressor
22

3-
import MLJBase
4-
import MLJBase: @mlj_model, metadata_pkg, metadata_model
5-
63
using ScientificTypes
74

85
using CategoricalArrays

test/models/MultivariateStats.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
export RidgeRegressor, PCA
22

3-
import MLJBase
4-
import MLJBase: @mlj_model, metadata_model, metadata_pkg
53
# using Distances
64
using LinearAlgebra
75
using Tables, ScientificTypes

test/models/NearestNeighbors.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export KNNRegressor, KNNClassifier
22

3-
import MLJBase: @mlj_model, metadata_model, metadata_pkg
43
using Distances
54

65
import NearestNeighbors

test/models/Transformers.jl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export FeatureSelector,
55
UnivariateBoxCoxTransformer,
66
OneHotEncoder, UnivariateDiscretizer
77

8+
import MLJModelInterface: @mlj_model, metadata_model, metadata_pkg
9+
810
using Statistics
911

1012
const N_VALUES_THRESH = 16 # for BoxCoxTransformation
@@ -158,15 +160,15 @@ function MLJBase.fit(transformer::UnivariateDiscretizer, verbosity::Int,X)
158160
return res, cache, report
159161
end
160162

163+
161164
# acts on scalars:
162165
function transform_to_int(
163-
result::UnivariateDiscretizerResult{<:CategoricalElement{R}},
164-
r::Real) where R
165-
166-
k = R(1)
167-
for q in result.odd_quantiles
166+
result::UnivariateDiscretizerResult{<:CategoricalValue{R}},
167+
r::Real) where R
168+
k = oneR = R(1)
169+
@inbounds for q in result.odd_quantiles
168170
if r > q
169-
k += R(1)
171+
k += oneR
170172
end
171173
end
172174
return k

0 commit comments

Comments
 (0)