Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hard deps and CSV->DelimitedFiles #78

Merged
merged 7 commits into from
Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ version = "0.7.3"
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
LossFunctions = "30fc2ffe-d236-52d8-8643-a9d8f7c094a7"
Missings = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand All @@ -17,23 +18,20 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"

[compat]
CategoricalArrays = "<0.5.3, 0.7"
Distributions = "0.21.3"
Missings = "0.4.3"
CategoricalArrays = "^0.7"
LossFunctions = "^0.5"
OrderedCollections = "1.1"
Requires = "^0.5.2"
ScientificTypes = "0.2.0"
StatsBase = "0.32"
Tables = "<0.1.19, 0.2"
ScientificTypes = "^0.2"
StatsBase = "^0.32"
Tables = "^0.2"
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", "Distances", "LossFunctions", "Test", "TypedTables"]
test = ["CSV", "DataFrames", "Distances", "Test", "TypedTables"]
28 changes: 16 additions & 12 deletions src/MLJBase.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Users of this module should first read the document
# https://alan-turing-institute.github.io/MLJ.jl/dev/adding_models_for_general_use/
module MLJBase
module MLJBase

export MLJType, Model, Supervised, Unsupervised
export Deterministic, Probabilistic, Interval
Expand Down Expand Up @@ -58,24 +58,23 @@ import Base: @__doc__

using Tables
using OrderedCollections # already a dependency of StatsBase
import Distributions
import Distributions: pdf, mode
using CategoricalArrays
using OrderedCollections
import CategoricalArrays
using ScientificTypes
import ScientificTypes: trait

# to be extended:
import StatsBase: fit, predict, fit!
import Missings.levels

import Distributions
import Distributions: pdf, mode

using ScientificTypes

# from Standard Library:

using Statistics
using Random
using InteractiveUtils

using LossFunctions

## CONSTANTS

Expand All @@ -88,13 +87,11 @@ const DEFAULT_SHOW_DEPTH = 0

include("utilities.jl")


## BASE TYPES

abstract type MLJType end
include("equality.jl") # equality for MLJType objects


## ABSTRACT MODEL TYPES

# for storing hyperparameters:
Expand Down Expand Up @@ -178,7 +175,6 @@ function best end
# message):
clean!(model::Model) = ""


## TRAITS

"""
Expand Down Expand Up @@ -218,6 +214,14 @@ include("mlj_model_macro.jl")
include("metadata_utilities.jl")

# __init__() function:
include("init.jl")
# include("init.jl")

ScientificTypes.TRAIT_FUNCTION_GIVEN_NAME[:supervised_model] =
x-> x isa Supervised
ScientificTypes.TRAIT_FUNCTION_GIVEN_NAME[:unsupervised_model] =
x-> x isa Unsupervised
ScientificTypes.TRAIT_FUNCTION_GIVEN_NAME[:measure] = is_measure

include("loss_functions_interface.jl")

end # module
32 changes: 20 additions & 12 deletions src/init.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
using Requires
# using Requires

function __init__()
ScientificTypes.TRAIT_FUNCTION_GIVEN_NAME[:supervised_model] =
x-> x isa Supervised
ScientificTypes.TRAIT_FUNCTION_GIVEN_NAME[:unsupervised_model] =
x-> x isa Unsupervised
ScientificTypes.TRAIT_FUNCTION_GIVEN_NAME[:measure] = is_measure
@require(CSV="336ed68f-0bac-5ca0-87d4-7b16caf5d00b",
include("datasets_requires.jl"))
@require(LossFunctions="30fc2ffe-d236-52d8-8643-a9d8f7c094a7",
include("loss_functions_interface.jl"))
end
ScientificTypes.TRAIT_FUNCTION_GIVEN_NAME[:supervised_model] =
x-> x isa Supervised
ScientificTypes.TRAIT_FUNCTION_GIVEN_NAME[:unsupervised_model] =
x-> x isa Unsupervised
ScientificTypes.TRAIT_FUNCTION_GIVEN_NAME[:measure] = is_measure

include("loss_functions_interface.jl")

# function __init__()
# ScientificTypes.TRAIT_FUNCTION_GIVEN_NAME[:supervised_model] =
# x-> x isa Supervised
# ScientificTypes.TRAIT_FUNCTION_GIVEN_NAME[:unsupervised_model] =
# x-> x isa Unsupervised
# ScientificTypes.TRAIT_FUNCTION_GIVEN_NAME[:measure] = is_measure
# # @require(CSV="336ed68f-0bac-5ca0-87d4-7b16caf5d00b",
# # include("datasets_requires.jl"))
# # @require(LossFunctions="30fc2ffe-d236-52d8-8643-a9d8f7c094a7",
# # include("loss_functions_interface.jl"))
# end
6 changes: 3 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ end
@test include("info.jl")
end

@testset "datasets" begin
@test include("datasets.jl")
end
# @testset "datasets" begin
# @test include("datasets.jl")
# end

tlienart marked this conversation as resolved.
Show resolved Hide resolved
@testset "tasks" begin
@test include("tasks.jl")
Expand Down