-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from alan-turing-institute/dev
Merge dev branch for a 0.5.1 release
- Loading branch information
Showing
11 changed files
with
446 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "MLJBase" | ||
uuid = "a7f614a8-145f-11e9-1d2a-a57a1082229d" | ||
authors = ["Anthony D. Blaom <[email protected]>"] | ||
version = "0.5.0" | ||
version = "0.5.1" | ||
|
||
[deps] | ||
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597" | ||
|
@@ -27,9 +27,10 @@ julia = "1" | |
[extras] | ||
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" | ||
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" | ||
Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7" | ||
LossFunctions = "30fc2ffe-d236-52d8-8643-a9d8f7c094a7" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
TypedTables = "9d95f2ec-7b3d-5a63-8d20-e2491e220bb9" | ||
|
||
[targets] | ||
test = ["CSV", "DataFrames", "LossFunctions", "Test", "TypedTables"] | ||
test = ["CSV", "DataFrames", "Distances", "LossFunctions", "Test", "TypedTables"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
""" | ||
docstring_ext | ||
Helper function to generate the docstring for a package. | ||
""" | ||
function docstring_ext(T; descr::String="") | ||
package_name = MLJBase.package_name(T) | ||
package_url = MLJBase.package_url(T) | ||
model_name = MLJBase.name(T) | ||
# the message to return | ||
message = "$descr" | ||
message *= "\n→ based on [$package_name]($package_url)" | ||
message *= "\n→ do `@load $model_name` to use the model" | ||
message *= "\n→ do `?$model_name` for documentation." | ||
end | ||
|
||
""" | ||
metadata_pkg | ||
Helper function to write the metadata for a package. | ||
""" | ||
function metadata_pkg(T; name::String="unknown", uuid::String="unknown", url::String="unknown", | ||
julia::Union{Missing,Bool}=missing, license::String="unknown", | ||
is_wrapper::Bool=false) | ||
ex = quote | ||
package_name(::Type{<:$T}) = $name | ||
package_uuid(::Type{<:$T}) = $uuid | ||
package_url(::Type{<:$T}) = $url | ||
is_pure_julia(::Type{<:$T}) = $julia | ||
package_license(::Type{<:$T}) = $license | ||
is_wrapper(::Type{<:$T}) = $is_wrapper | ||
end | ||
eval(ex) | ||
end | ||
|
||
""" | ||
metadata_model | ||
Helper function to write the metadata for a single model of a package (complements | ||
[`metadata_ext`](@ref)). | ||
""" | ||
function metadata_model(T; input=Unknown, target=Unknown, | ||
output=Unknown, weights::Bool=false, | ||
descr::String="", path::String="") | ||
if isempty(path) | ||
path = "MLJModels.$(package_name(T))_.$(name(T))" | ||
end | ||
ex = quote | ||
input_scitype(::Type{<:$T}) = $input | ||
output_scitype(::Type{<:$T}) = $output | ||
target_scitype(::Type{<:$T}) = $target | ||
supports_weights(::Type{<:$T}) = $weights | ||
docstring(::Type{<:$T}) = docstring_ext($T, descr=$descr) | ||
load_path(::Type{<:$T}) = $path | ||
end | ||
eval(ex) | ||
end |
Oops, something went wrong.