|
1 | 1 | # frozen_string_literal: true |
2 | 2 |
|
3 | 3 | require 'rumale' |
4 | | -require 'datasets-numo-narray' |
5 | 4 |
|
6 | 5 | def iris |
7 | | - dataset = Datasets::LIBSVM.new('iris').to_narray |
8 | | - x = dataset[true, 1..-1] |
9 | | - y = Numo::Int32.cast(dataset[true, 0]) |
10 | | - |
11 | | - ss = Rumale::ModelSelection::StratifiedShuffleSplit.new(n_splits: 1, test_size: 0.2, random_seed: 38) |
12 | | - train_ids, test_ids = ss.split(x, y)[0] |
13 | | - |
14 | | - { x_train: x[train_ids, true].dup, |
15 | | - y_train: y[train_ids].dup, |
16 | | - x_test: x[test_ids, true].dup, |
17 | | - y_test: y[test_ids].dup } |
| 6 | + Marshal.load(File.binread('spec/iris.dat')) # rubocop:disable Security/MarshalLoad |
18 | 7 | end |
19 | 8 |
|
20 | 9 | def housing |
21 | | - dataset = Datasets::LIBSVM.new('housing', note: 'scaled to [-1,1]').to_narray |
22 | | - x = dataset[true, 1..-1] |
23 | | - y = dataset[true, 0] |
24 | | - |
25 | | - ss = Rumale::ModelSelection::ShuffleSplit.new(n_splits: 1, test_size: 0.1, random_seed: 38) |
26 | | - train_ids, test_ids = ss.split(x, y)[0] |
27 | | - |
28 | | - { x_train: x[train_ids, true].dup, |
29 | | - y_train: y[train_ids].dup, |
30 | | - x_test: x[test_ids, true].dup, |
31 | | - y_test: y[test_ids].dup } |
| 10 | + Marshal.load(File.binread('spec/housing.dat')) # rubocop:disable Security/MarshalLoad |
32 | 11 | end |
33 | 12 |
|
34 | 13 | RSpec.configure do |config| |
|
0 commit comments