Example script to run the HARDy Package¶
This page shows the description for running the HARDy package using minimal settings
Import the package¶
import hardy.run_hardy as run
Provide the path to the configurations:¶
Note: the configuration path shown are the default path. These can be modified if the configuration files used are stored ina different folder
- The raw .csv data
raw_data_path = 'path/to/raw/data/'
- The configuration file containing the transformations
tform_config_path = './hardy/arbitrage/tform_config.yaml'
- The configuration file for the classifier
classifier_config_path = './hardy/recognition/'
Execute the hardy_main function to run the code¶
run.hardy_main(raw_data_path, tform_config_path, classifier_config_path, batch_size=64, scale=0.2, num_test_files_class=750, target_size=(500, 500), iterator_mode='arrays', classifier='tuner', n_threads=1, classes=['class_1', 'class_2', 'class_3'], project_name='my_project_name')
Following arguments are acceptable in the hardy_main function:
raw_data_path: data_path for the .csv files or imagestform_config_path: path for transformation configuration files (.yaml)classifier_config_path: path for hyperparameter search (.yaml)batch_size: batch size for splitting of training and testing of data in machine learning modelscale: the scale to which plots are reducenum_test_files_class: The number of test files per class. These files would be reserved for final testing of machine learning modeltarget_size: number of data points in the csv files or dimension of imagesiterator_mode:classifier: tuner or cnn model. Tuner means hyperparameter search while other options execute pre-defined convolutional neural network.n_thread: number of threads used for parallel transformation of dataclasses: labels or categories in data. If .csv files are used, the label must be present in the filename. If images are used, the images must be contained in respective foldersproject_name: name for the project. Folder with same name will be created in theraw_data_pathcontaining all the results for the runplot_format: format of the plot to be used for training and testing of data.RGBrgbcorresponds to usage of RGB images while any other argument will use cartesian coordinate system.skiprows: Used to skip the metadata contained in the csv files. It must be of same length for all classes.split: The fraction of data used for training and testing of machine learning model. This is different fromnum_test_files_classsince the later one is never fed into machine learning model until the best hyperparameter search is done.seed: the seed used for random-selection ofnum_test_files_classk_fold: Boolean value indicating whether k-fold validation need to be performed or notk: value indicating how many k-folds need to be performed