File size: 2,444 Bytes
4d89104
 
 
 
 
 
 
 
 
c65ce49
4d89104
23be25d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27a2e02
23be25d
af1525b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
license: cc-by-nc-4.0
---

A curation of datasets for educations purposes.

### California Housing

Since SciKit Learn's [California Housing dataset](https://scikit-learn.org/stable/datasets/real_world.html#california-housing-dataset) often fails to download this is the Data Frame of the data in CSV format.  
By default [SciKit Learn use some pre processing](https://github.com/scikit-learn/scikit-learn/blob/d3898d9d57aeb1e960d266613a2e31b07bca39d7/sklearn/datasets/_california_housing.py#L208-L220) of the [original data](https://web.archive.org/web/20250912205745/https://www.dcc.fc.up.pt/~ltorgo/Regression/cal_housing.html).  
This CSV is the data after the processing of SciKit Learn.

### CIFAR 10

Since using SciKit Learn's `fetch_openml()` fails to download the `CIFAR_10` dataset this is an alternative.  
It was generated by:

```python
dsTrain = torchvision.datasets.CIFAR10(root = dataFolderPath, train = True,  download = True)
dsVal   = torchvision.datasets.CIFAR10(root = dataFolderPath, train = False, download = True)

numSamples = len(dsTrain)
tXTrain = np.zeros((numSamples, 32, 32, 3), dtype = np.uint8)
vYTrain = np.zeros((numSamples,), dtype = np.uint8)

for ii in range(numSamples):
    tXi, valY = dsTrain[ii]
    tXTrain[ii] = tXi
    vYTrain[ii] = valY

numSamples = len(dsVal)
tXVal = np.zeros((numSamples, 32, 32, 3), dtype = np.uint8)
vYVal = np.zeros((numSamples,), dtype = np.uint8)

for ii in range(numSamples):
    tXi, valY = dsVal[ii]
    tXVal[ii] = tXi
    vYVal[ii] = valY

tX = np.concatenate((tXTrain, tXVal), axis = 0)
vY = np.concatenate((vYTrain, vYVal), axis = 0)

mX = np.reshape(tX, (tX.shape[0], -1))

dfData = pd.DataFrame(np.concatenate((mX, vY[:, np.newaxis]), axis = 1), columns = [f'Pixel_{ii:04d}' for ii in range(mX.shape[1])] + ['Label'])
dfData.to_parquet('CIFAR10.parquet', index = False)
```

### MNIST

A dataframe where the first 60,000 rows are the train set and the last 10,000 are the test set.  
The last column is the label.  
Images are row major, hence a `np.reshape(dfX.iloc[0, :-1], (28, 28))` will generate the image. 

Generated by:

```python
import numpy as np
from sklearn.datasets import fetch_openml

dfX, dsY = fetch_openml('mnist_784', version = 1, return_X_y = True, as_frame = True)

dfX.columns = [f'{ii:04d}' for ii in range(dfX.shape[1])]
dfX['Label'] = dsY.astype(np.uint8)
dfX = dfX.astype(np.uint8)

dfX.to_parquet('MNIST.parquet', index = False)
```