Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do Python have a model which is similar to nnetar in R's package forecast?

R's package 'forecast' has a function nnetar, which uses feed-forward neural networks with a single hidden layer to predict in time series.

Now I am using Python to do the similar analysis. I want to use neural network which does not need to be as complex as deep learning. Maybe 2 layers and a couple of nodes are good enough for my case.

So, does Python have a model of simple neural networks which can be used in time series lik nnetar? If not, how to deal with this problem?

like image 684
Feng Chen Avatar asked May 27 '19 03:05

Feng Chen


1 Answers

Any NN model that uses 1 or more hidden layers is a multi-layer perceptron model, and for that case it is trivial to make it extendable to N layers. So any library that you pick will support it. My guess for you not picking a complex library like pytorch/Tensorflow is its size.

  1. Tensorflow does have TF-Lite which can work for smaller IOT devices.
  2. Sklearn does have MLPRegressor that can train NNs if that is more to your liking.
  3. You can always write your model. There are plenty of examples for this that use numpy and are plenty fast for cpu computation.( Single Hidden layer NN I am guessing will be more memory bound than computation bound)
  4. Use another ML algorithm. Single Hidden layer NNs will not perform nearly as well as other other simpler algorithms.

If there are other reasons for not using a standard library like tensorflow/pytorch then you should mention them.

like image 123
Niteya Shah Avatar answered Sep 18 '22 13:09

Niteya Shah