Quick Start
In carefree-learn, it's easy to train and serialize a model for all tasks.
Training
Machine Learning ๐
- With NumPy
- With File
This yields:
carefree-learn can also easily fit / predict / evaluate directly on files (file-in, file-out). Suppose we have an xor.txt file with following contents:
Then carefree-learn can be utilized with only few lines of code:
info
delimrefers to 'delimiter', andhas_column_namesrefers to whether the file has column names (or, header) or not.- Please refer to carefree-data if you're interested in more details.
This yields:
When we fit from files, we can predict on either files or lists:
Computer Vision ๐ผ๏ธ
- Preset (torchvision) Dataset
- Custom Image Folder Dataset
For custom image folder dataset, carefree-learn provides a Preparation-style API for you to prepare your data. In this demo, we'll show you how to use it for image classification tasks. Suppose we have the following file structure:
Where labels.csv file contains the labels of each image:
Then we should define a Preparation, which tells carefree-learn how to interpret the data:
It's worth mentioning that carefree-learn will automatically achieve many common practices for you, such as:
- Split out validation set properly.
- Save the mappings between indices and original labels to some
jsonfiles.
note
In addition, for classification tasks, carefree-learn will ensure that:
- The class distribution of validation dataset is the same as the one of training dataset.
- Validation dataset has at least one sample per class.
The 'prepared' file structure will be as follows:
Where
tip
See ImageFolderData for more details.
After the data is prepared, we can define a model to fit it, which is fairly easy for carefree-learn:
Serializing
Saving
carefree-learn pipelines can be saved easily, into a .zip file (for both ml & cv tasks) !
It's worth mentioning that carefree-learn supports a two-stage style serializing:
- A
_logsfolder (with timestamps as its subfolders) will be created after training.
carefree-learncould therefore 'pack' the corresponding (timestamp) folder into a.zipfile.
note
This pack API is a 'unified' API, which means you can use it to serialize either Machine Learning pipelines or Computer Vision pipelines!
Loading
Of course, loading carefree-learn pipelines are easy as well!
note
- This is also a 'unified' API.
.zipfile exported from eithersaveAPI orpackAPI can be loaded in this way.