| --- |
| 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) |
| ``` |