Package: easyesn
easyesneasyesnis a library for recurrent neural networks using echo state networks (ESNs,  also calledreservoir computing) with a high level easy to use API that is closely oriented towardssklearn. It aims to make the use ofESNas easy as possible, by providing algorithms for automatic gradient based hyperparameter tuning (of ridge regression penalty, spectral radius, leaking rate and feedback scaling), as well as transient time estimation. Furtheremore, it incorporates the ability to use spatio temporalESNs for prediction and classification of geometrically extended input signals.easyesncan either use the CPU or make use of the GPU thanks tocupy. At the moment the use of the CPU is recommended though!This project is based on research results for the gradient based hyperparameter optimization and transient time estimation of Luca Thiede and the spatio temporal prediction and classification techniques of Roland Zimmermann.Getting startedInstallationTheeasyesnlibrary is built usingpython 3. You cannot use it in apython 2.xenvironment. The recommended way to installeasyesnat the moment is viapip. Nevertheless, you can also installeasyesnon your own withoutpip.pipYou can installeasyesnviapipby executingpip install easyesnfrom a validpython 3.xenvironment, which will automatically installeasyesnand its dependencies.manuallyTo install the library withoutpip, there are four steps you have to perform:Go to thepypipageofeasyesnand download the latest version as a*.tar.gzarchive.Extract the archive.Open your command line/terminal and cd into the directory containing thesetup.py.Executepython setup.py installto start the installation.First stepsAs already mentioned, the API is very similar to the one of sklearn, which makes it as easy as possible for beginners.
For every task there is a specialized module, e.g.ClassificationESNfor the classification of input signals,PredictionESNfor the prediction or generation (that is a several step ahead prediction by always feeding the previous prediction back in),RegressionESNfor mapping a signal to a real number, orSpatioTemporalESNfor the prediction of geometrically extended input signals (for example the electric excitation on the heart surface or video frames).Import the module typingfromeasyesnimportPredictionESNNow simply fit the esn usingesn.fit(x_train,y_train,transientTime=100,verbose=1)and predict by usingy_test_pred=esn.predict(x_test,transientTime=100,verbose=1)For automatic hyperparamter optimization importfromeasyesn.optimizersimportGradientOptimizerfromeasyesn.optimizersimportGridSearchOptimizerNext create a new objectesn=PredictionESN(n_input=1,n_output=1,n_reservoir=500,leakingRate=0.2,spectralRadius=0.2,regressionParameters=[1e-2])whith a penalty1e-2for the ridge regression. To optimize the hyperparameter also create an optimizer objectopt=GradientOptimizer(esn,learningRate=0.001)and use it withvalidationLosses,fitLosses,inputScalings,spectralRadiuses,leakingRates,learningRates=opt.optimizeParameterForTrainError(inputDataTraining,outputDataTraining,inputDataValidation,outputDataValidation,epochs=150,transientTime=100)validationLosses,fitLosses,penalties=opt.optimizePenalty(inputDataTraining,outputDataTraining,inputDataValidation,outputDataValidation,epochs=150,transientTime=100)More extensive examples can be found in the examples directory.BackendsAs already mentioned in the beginning,easyesncan be used either on the CPU or on the GPU. To achieve this, all low level calculations are outsourced into  a backend (similiar to the backend technology ofkeras). To change thebackendto another backend namedbackendName, there are currently two ways:Modify the settings file, stored at~/.easyesn/easyesn.jsonto contain to look like this:{"backend":"backendName"}and useeasyesnwithout any further modification inside your code.Set theEASYESN_BACKENDenvironment variable tobackendNameand useeasyesnwithout any further modification inside your code.At the moment, these are supported backend names:backend namebackend typeNotesnumpynumpy(CPU)npnumpy(CPU)cupycupy(GPU)no eig & arange function which is limiting the speedcpcupy(GPU)no eig & arange function which is limiting the speedtorchtorch(CPU/GPU)experimental(Blasting fast but tested/developed for only on PredictionESN)To set which device thetorchbackend should use, use the followingeasyesn.jsonconfig:{"backend":"torch","backend_config":{"device":"cpu"}}wherecpucan be replaced with any validtorch.device, e.g.cuda.NotesAs of right now, theGradientOptimizerdoes not fully work - we are looking into this and try to fix the issue.DocumentationDevelopTodoAt the moment theeasyesnlibrary covers not only all basic features of reservoir computing but also some new, state of the art methods for its application. Nevertheless, there are still some more things which should be implemented in future versions. In the following, these feature requests and ideas are listed together which their progress:Ensemble ESNs (25%)Adding support for deep learning methods as the output method (still open)Improved GPU computing performance (still partially open, predictionESN done)