Package: pyIAAS
pyIAAS: Software for Multivariate Time-series Forecasting Model Development with an Intelligent Automated NAS optimization frameworkWhat is pyIAAS?pyIAAS is an open-source Python package that exploits one of the latest neural architecture search (NAS) frameworks, intelligent automated achitecture search (IAAS) (Yang et al. 2022), for the multivariate time-series forecasting (MTF) model development. The aim of the pyIAAS is to facilitate the future researchers in building a high-quality MTF model efficiently and effectively when considering the optimality of the network structures. pyIAAS contains four network modules as searching candidates, namley, convolutional neural networks (CNN), recurrent neural networks (RNN), long-short term memory (LSTM) neural networks and fully connected neural networks (FCN). During the searching process, reinforcement learning (RL) based meta-controllers are designed to sequentially make decisions to update the network structures. Please refer toYang et al. (2022)for more detailed information about the IAAS framework.InstallationWithout GPU accelerationIn an environment 3.8+, pyIAAS can be installed viapipinstallpyIAASWith GPU accelerationFirst, install the GPU version of PyTorchpip3installtorchtorchvisiontorchaudio--extra-index-urlhttps://download.pytorch.org/whl/cu113For more information of  PyTorch, please checkthisThen, install the pyIAAS packagepipinstallpyIAASUsage of pyIAASCommand lineCommand line tool supplies two functions: search and predictTo search networks given a dataset (use the example in example/1. basic)# Start the searching process of pyIAASpyIAASsearch-cNASConfig.json-fVT_summer.csv-tRT_DemandNote that the output directory should be empty!After the searching process, the neural architectures are stored in the directoryexamples/1. basic/out_dirTo predict with the best searched model# Perform a prediction task given a dataset VT_summer_predict.csvpyIAASpredict-cNASConfig.json-fVT_summer_predict.csv-tRT_Demand-dout_dir-oprediction.csvPython APITo search the neural architectures, then perform a prediction task with the best searched modelimportpyIAAS# set the basic information of the searching processconfig_file='NASConfig.json'input_file='VT_summer.csv'target_name='RT_Demand'test_ratio=0.2# the proportion of the test dataset in the whole dataset. It can be adjusted by users themself for specific tasks# start the searching processpyIAAS.run_search(config_file,input_file,target_name,test_ratio)# set the basic information of a prediction taskconfig_file='NASConfig.json'input_file='VT_summer.csv'target_name='RT_Demand'output_dir='out_dir'prediction_file='VT_summer_predict.csv'# perform the predicting task in VT_summer_predict.csvpyIAAS.run_predict(config_file,input_file,target_name,output_dir,prediction_file)Output file explanationsmodel.db: detailed records of all searched modelseach searched model contains:prediction results of the test datasettransformation tablemodel parameters of type.pthtraining loss curveCustomized module listThe modules used in the searching process is given in the configuration
file. The default configuration is{"MaxLayers":50,"timeLength":168,"predictLength":24,"IterationEachTime":50,"MonitorIterations":40,"NetPoolSize":5,"BATCH_SIZE":256,"EPISODE":200,"GPU":true,"OUT_DIR":"out_dir","Modules":{"dense":{"out_range":[4,8,12,16,24,32,48,64,80,108,144],"editable":true},"rnn":{"out_range":[4,8,12,16,24,32,48,64,80,108,144],"editable":true},"lstm":{"out_range":[4,8,12,16,24,32,48,64,80,108,144],"editable":true},"conv":{"out_range":[4,8,12,16,24,32,48,64,80,108,144],"editable":true}}}The meaning of each term:MaxLayers : number of the maximum layers of the searched neural architecturetimeLength : length of the input time-series datapredictLength : prediction time length, e.g., two-hour aheadIterationEachTime : number of the training epochs at each searching episodeMonitorIterations : epoch interval to print out the training information, e.g., training lossNetPoolSize : size of the net poolBATCH_SIZE : batch size used in the training processEPISODE : searching times of the reinforcement learning actorsPruning : enable pruning functionality during search (Pruning implementation inspired byMovement Pruning)PruningRatio : pruning ratio(topV strategy used here)GPU : use GPU or not; if true, the environment should use the GPU version of PyTorchOUT_DIR : output directoryModules : module informationout_range : list of the output unit numbereditable : whether this module can be widened or notExtending new moduleTo create a new module, users should create a subclass ofpyIAAS.model.module.NasModule, and implement
these reserved abstract functionsfrompyIAAS.model.moduleimportNasModule# this is a sample subclassing of NasModule  to# illustrate how to customize a new module in the pyIAAS packageclassNewModule(NasModule):@propertydefis_max_level(self):# return: True if this module reaches the max width level, False otherwiseraiseNotImplementedError()@propertydefnext_level(self):# return: width of next levelraiseNotImplementedError()definit_param(self,input_shape):# initialize the parameters of this moduleself.on_param_end(input_shape)raiseNotImplementedError()defidentity_module(self,cfg,name,input_shape:tuple):# generate an identity mapping moduleraiseNotImplementedError()defget_module_instance(self):# generate a model instance once and use it for the rest proceduresraiseNotImplementedError()@propertydeftoken(self):# return: string type token of this moduleraiseNotImplementedError()defperform_wider_transformation_current(self):# generate a new wider module by the wider function-preserving transformation# this function is called by layer i and returns the realized random mapping to the IAAS framework for the next layer's wider transformation.raiseNotImplementedError()defperform_wider_transformation_next(self,mapping_g:list,scale_g:list):# generate a new wider module by the wider function-preserving transformation# this function is called by the layer i + 1raiseNotImplementedError()Add the module information to the configuration file as follows{"MaxLayers":50,"timeLength":168,"predictLength":24,"IterationEachTime":50,"MonitorIterations":40,"NetPoolSize":5,"BATCH_SIZE":256,"EPISODE":200,"GPU":true,"OUT_DIR":"out_dir","Modules":{"dense":{"out_range":[4,8,12,16,24,32,48,64,80,108,144],"editable":true},"new_module":{"out_range":[4,8,12,16,24,32,48,64,80,108,144],"editable":true}}}Register this new module in the running codefrompyIAASimport*fromnew_moduleimportNewModulecfg=Config('NASConfig.json')# register a new module to the global configurationcfg.register_module('new_module',NewModule)Additional informationFor more details of this algorithm, seeYang et al. (2022)For more details of pyIAAS, seedocRepository ishere