@@ -5,10 +5,6 @@ const API_URL = "https://www.openml.org/api/v1/json"
5
5
# https://github.com/openml/OpenML/tree/master/openml_OS/views/pages/api_new/v1/xsd
6
6
# https://www.openml.org/api_docs#!/data/get_data_id
7
7
8
- # TODO :
9
- # - Use e.g. DataDeps to cache data locally
10
- # - Put the ARFF parser to a separate package or use ARFFFiles when
11
- # https://github.com/cjdoris/ARFFFiles.jl/issues/4 is fixed.
12
8
13
9
"""
14
10
Returns information about a dataset. The information includes the name,
@@ -58,9 +54,17 @@ df = DataFrame(table);
58
54
```
59
55
"""
60
56
function load (id:: Int ; parser = :arff )
61
- response = load_Dataset_Description (id)
62
- arff_file = HTTP. request (" GET" , response[" data_set_description" ][" url" ])
63
- data = ARFFFiles. load (IOBuffer (arff_file. body))
57
+ dir = first (Artifacts. artifacts_dirs ())
58
+ toml = joinpath (dir, " OpenMLArtifacts.toml" )
59
+ hash = artifact_hash (string (id), toml)
60
+ if hash === nothing || ! artifact_exists (hash)
61
+ hash = Artifacts. create_artifact () do artifact_dir
62
+ url = load_Dataset_Description (id)[" data_set_description" ][" url" ]
63
+ download (url, joinpath (artifact_dir, " $id .arff" ))
64
+ end
65
+ bind_artifact! (toml, string (id), hash)
66
+ end
67
+ data = ARFFFiles. load (joinpath (artifact_path (hash), " $id .arff" ))
64
68
if parser == :auto
65
69
return coerce (data, autotype (data))
66
70
else
0 commit comments