Skip to content

Commit 4444745

Browse files
authored
Merge pull request #15 from JuliaAI/dev
For a 0.2 release
2 parents 818a825 + 4f83595 commit 4444745

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

Project.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
name = "OpenML"
22
uuid = "8b6db2d4-7670-4922-a472-f9537c81ab66"
33
authors = ["Diego Arenas <[email protected]>", "Anthony D. Blaom <[email protected]>"]
4-
version = "0.1.1"
4+
version = "0.2.0"
55

66
[deps]
77
ARFFFiles = "da404889-ca92-49ff-9e8b-0aa6b4d38dc8"
88
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
99
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
1010
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
1111
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
12-
ScientificTypes = "321657f4-b219-11e9-178b-2701a2544e81"
1312

1413
[compat]
1514
ARFFFiles = "1.3"
1615
HTTP = "0.8, 0.9"
1716
JSON = "0.21"
18-
ScientificTypes = "2"
1917
julia = "1"
2018

2119
[extras]

src/OpenML.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
module OpenML
1+
module OpenML
22

33
using HTTP
44
using JSON
55
import ARFFFiles
6-
import ScientificTypes: Continuous, Count, Textual, Multiclass, coerce, autotype
76
using Markdown
87
if VERSION > v"1.3.0"
98
using Pkg.Artifacts

src/data.jl

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,34 +28,35 @@ function load_Dataset_Description(id::Int; api_key::String="")
2828
println("No access granted. This dataset is not shared with you.")
2929
end
3030
catch e
31-
println("Error occurred : $e")
31+
println("Error occurred. Check if there exists a dataset with id $id.")
32+
println("See e.g. OpenML.list_datasets()\n")
33+
println(e)
3234
return nothing
3335
end
3436
return nothing
3537
end
3638

3739
"""
38-
OpenML.load(id; parser = :arff)
40+
OpenML.load(id)
3941
4042
Load the OpenML dataset with specified `id`, from those listed by
4143
[`list_datasets`](@ref) or on the [OpenML site](https://www.openml.org/search?type=data).
42-
With `parser = :arff` (default) the ARFFFiles.jl parser is used.
43-
With `parser = :auto` the output of the ARFFFiles parser is coerced to
44-
automatically detected scientific types.
4544
46-
Datasets are saved as julia artifacts so that they persist locally once loaded.
45+
Datasets are saved as julia artifacts so that they persist locally once loaded.
4746
4847
Returns a table.
4948
5049
# Examples
5150
5251
```julia
5352
using DataFrames
54-
table = OpenML.load(61);
55-
df = DataFrame(table);
53+
table = OpenML.load(61)
54+
df = DataFrame(table) # transform to a DataFrame
55+
using ScientificTypes
56+
df2 = coerce(df, autotype(df)) # corce to automatically detected scientific types
5657
```
5758
"""
58-
function load(id::Int; parser = :arff)
59+
function load(id::Int)
5960
if VERSION > v"1.3.0"
6061
dir = first(Artifacts.artifacts_dirs())
6162
toml = joinpath(dir, "OpenMLArtifacts.toml")
@@ -73,12 +74,7 @@ function load(id::Int; parser = :arff)
7374
filename = tempname()
7475
download(url, filename)
7576
end
76-
data = ARFFFiles.load(filename)
77-
if parser == :auto
78-
return coerce(data, autotype(data))
79-
else
80-
return data
81-
end
77+
ARFFFiles.load(filename)
8278
end
8379

8480

@@ -321,7 +317,14 @@ julia> OpenML.describe_dataset(6)
321317
cited above for more details.
322318
```
323319
"""
324-
describe_dataset(id) = Markdown.parse(load_Dataset_Description(id)["data_set_description"]["description"])
320+
function describe_dataset(id)
321+
description = load_Dataset_Description(id)["data_set_description"]["description"]
322+
if isa(description, AbstractString)
323+
Markdown.parse(description)
324+
else
325+
"No description found."
326+
end
327+
end
325328

326329
# Flow API
327330

test/data.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ end
4141
end
4242

4343
if VERSION > v"1.3.0"
44-
using Pkg.Artifacts
44+
using Pkg
4545
@testset "artifacts" begin
46-
dir = first(Artifacts.artifacts_dirs())
46+
dir = first(Pkg.Artifacts.artifacts_dirs())
4747
toml = joinpath(dir, "OpenMLArtifacts.toml")
48-
hash = artifact_hash("61", toml)
49-
@test artifact_exists(hash)
48+
hash = Pkg.Artifacts.artifact_hash("61", toml)
49+
@test Pkg.Artifacts.artifact_exists(hash)
5050
end
5151
end
5252

0 commit comments

Comments
 (0)