Skip to content

Commit d8ed850

Browse files
committed
adding python scripts to load these datasets
1 parent c524be5 commit d8ed850

7 files changed

+1106
-0
lines changed

__init__.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from .load import load_adult, load_credit, load_magic, load_diabetes, load_iris, load_vehicle, load_satellite, load_redwine, load_forestcov
2+
from .load import load_glass, load_haberman, load_mammographic, load_indian_liver, load_segment, load_ecoli, load_optdigits, load_letterrecog
3+
4+
__all__ = ['load_adult',
5+
'load_iris',
6+
'load_optdigits',
7+
'load_satellite',
8+
'load_vehicle',
9+
'load_segment',
10+
'load_redwine',
11+
'load_letterrecog',
12+
'load_forestcov',
13+
'load_ecoli',
14+
'load_credit',
15+
'load_magic',
16+
'load_diabetes',
17+
'load_glass',
18+
'load_haberman',
19+
'load_mammographic',
20+
'load_indian_liver']

__pycache__/__init__.cpython-37.pyc

794 Bytes
Binary file not shown.

__pycache__/__init__.cpython-39.pyc

738 Bytes
Binary file not shown.

__pycache__/load.cpython-37.pyc

28.5 KB
Binary file not shown.

__pycache__/load.cpython-39.pyc

28.3 KB
Binary file not shown.

example.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#import the datasets
2+
# from datasets import *
3+
from load import *
4+
import numpy as np
5+
import sys
6+
7+
if __name__ == '__main__':
8+
9+
dataset = sys.argv[1]
10+
# load the data
11+
X, origY = eval('load_' + load + '(return_X_y=True)')
12+
n, d = X.shape
13+
14+
# map the values of Y from 0 to r-1
15+
domY= np.unique(origY)
16+
r= len(domY)
17+
Y= np.zeros(X.shape[0], dtype= np.int)
18+
for i,y in enumerate(domY):
19+
Y[origY==y]= i
20+
21+
print('\nThe shape of the dataset is : ' + str(n) + ' x ' + str(d))
22+
23+
print('\nNumber of classes are : ', r)
24+
25+
print('\nThe dataset : ', )
26+
print(X)
27+
28+
print('\nThe labels : ')
29+
print(Y)

0 commit comments

Comments
 (0)