|
1 | 1 | """ |
2 | | - make_binary() |
| 2 | + make_binary(; row_table=false) |
3 | 3 |
|
4 | 4 | Return data `(X, y)` for the crabs dataset, restricted to the two features `:FL`, |
5 | 5 | `:RW`. Target is `Multiclass{2}`. |
6 | 6 |
|
| 7 | +The table `X` is a named tuple of vectors. For a vector of named tuples, set |
| 8 | +`row_table=true`. |
| 9 | +
|
7 | 10 | """ |
8 | | -function make_binary() |
| 11 | +function make_binary(; row_table=false) |
9 | 12 | data = MLJBase.load_crabs() |
10 | 13 | y_, X = unpack(data, ==(:sp), col->col in [:FL, :RW]) |
11 | 14 | y = coerce(y_, MLJBase.OrderedFactor) |
12 | | - return X, y |
| 15 | + row_table ? (MLJBase.Tables.rowtable(X), y) : (X, y) |
13 | 16 | end |
14 | 17 |
|
15 | 18 | """ |
16 | | - make_multiclass() |
| 19 | + make_multiclass(; row_table=false) |
17 | 20 |
|
18 | 21 | Return data `(X, y)` for the unshuffled iris dataset. Target is `Multiclass{3}`. |
19 | 22 |
|
20 | 23 | """ |
21 | | -make_multiclass() = MLJBase.@load_iris |
| 24 | +function make_multiclass(; row_table=false) |
| 25 | + X, y = MLJBase.@load_iris |
| 26 | + row_table ? (MLJBase.Tables.rowtable(X), y) : (X, y) |
| 27 | +end |
22 | 28 |
|
23 | 29 | """ |
24 | | - make_regression() |
| 30 | + make_regression(; row_table=false) |
25 | 31 |
|
26 | 32 | Return data `(X, y)` for the Boston dataset, restricted to the two features `:LStat`, |
27 | 33 | `:Rm`. Target is `Continuous`. |
28 | 34 |
|
| 35 | +The table `X` is a named tuple of vectors. For a vector of named tuples, set |
| 36 | +`row_table=true`. |
| 37 | +
|
29 | 38 | """ |
30 | | -function make_regression() |
| 39 | +function make_regression(; row_table=false) |
31 | 40 | data = MLJBase.load_boston() |
32 | 41 | y, X = unpack(data, ==(:MedV), col->col in [:LStat, :Rm]) |
33 | | - return X, y |
| 42 | + row_table ? (MLJBase.Tables.rowtable(X), y) : (X, y) |
34 | 43 | end |
35 | 44 |
|
36 | 45 | """ |
37 | | - make_count() |
| 46 | + make_count(; row_table=false) |
38 | 47 |
|
39 | 48 | Return data `(X, y)` for the Boston dataset, restricted to the two features `:LStat`, |
40 | 49 | `:Rm`, with the `Continuous` target converted to `Count` (integer). |
41 | 50 |
|
| 51 | +The table `X` is a named tuple of vectors. For a vector of named tuples, set |
| 52 | +`row_table=true`. |
| 53 | +
|
42 | 54 | """ |
43 | | -function make_count() |
| 55 | +function make_count(; row_table=false) |
44 | 56 | X, y_ = make_regression() |
45 | 57 | y = map(η -> round(Int, η), y_) |
46 | | - return X, y |
| 58 | + row_table ? (MLJBase.Tables.rowtable(X), y) : (X, y) |
47 | 59 | end |
0 commit comments