Giter Club home page Giter Club logo

nnfor's People

Contributors

mitchelloharawild avatar trnnick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nnfor's Issues

When difforder=0, output has it as NULL

Hi,

When using the mlp function and setting difforder=0, the resulting model doesn't include differencing, however, the output indicates the difforder is NULL not 0. This then creates issues when fitting the same model to new data as difforder is set as NULL and not 0.

Please see the code example:

X = rnorm(500)
X = X+seq(0, 10, length.out=500)
model = nnfor::mlp(as.ts(X[1:400]),
                   xreg = cbind(1:500),
                   xreg.lags=list(0),
                   xreg.keep=list(TRUE),
                   difforder=0)
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
#Model fits without differencing
model
## MLP fit with 5 hidden nodes and 20 repetitions.
## Univariate lags: (2)
## 1 regressor included.
## - Regressor 1 lags: (0)
## Forecast combined using the median operator.
## MSE: 1.0234.
# However, difforder is NULL
model$difforder
## NULL
model.refit = nnfor::mlp(as.ts(X),
                         model=model,
                         xreg = cbind(1:500),
                         xreg.lags = list(0),
                         xreg.keep=list(TRUE),
                         difforder=0)
#Model now includes differencing
model.refit
## MLP fit with 5 hidden nodes and 20 repetitions.
## Series modelled in differences: D1.
## Univariate lags: (2)
## 1 regressor included.
## - Regressor 1 lags: (0)
## Forecast combined using the median operator.
## MSE: 6.9452.
model.refit$difforder
## [1] 1

tutorial link broken

I just tried to navigate to the tutorial linked in the README and received a page stating:

Error establishing a database connection

This might be out of your control, but it seemed worthwhile to report.

Specification of lag parameter in mlp function

I want to specify both number of nodes in hidden layers and number of lags in the mlp model.
When I specify number of lags as 3 then why does it take the value of 1 as you can see in summary(fit) below.
fit <- mlp(AirPassengers,hd=c(5,2,1),lags=3)

summary(fit)
Length Class Mode
net 13 nn list
hd 3 -none- numeric
lags 1 -none- numeric
xreg.lags 0 -none- NULL
difforder 1 -none- numeric
sdummy 1 -none- logical
ff.det 1 -none- numeric
det.type 1 -none- character
y 144 ts numeric
minmax 4 -none- list
xreg.minmax 0 -none- NULL
comb 1 -none- character
fitted 140 ts numeric
MSE 1 -none- numeric
MSEH 0 -none- NULL

Also, I tried in the another dataset. When I specify both number of lags and hidden layer size then it gives following error.
Warning message:
In preprocess(y, m, lags, keep, difforder, sel.lag, allow.det.season, :
No inputs left in the network after pre-selection, forcing AR(1).
Can you please help me in this issue

Moving "forecast" from "Depends" to "Imports"

I was wondering if the forecast package could be moved from "Depends" to "Imports" in the DESCRIPTION file. I am building a package around nnfor and it is giving me an error, probably because some forecast function is being overwritten by another package in my "imports" list. I found an article that states that "imports" is safer than "depends", hence this request.

https://stackoverflow.com/questions/8637993/better-explanation-of-when-to-use-imports-depends

Thanks,
Nikhil

Error in apply(y, 1L, rank) : dim(X) must have a positive length

It seems that if your ts object doesn't populated at the very beginning of your time, the error Error in apply(y, 1L, rank) : dim(X) must have a positive length will be thrown.

like this:

testdata <- ts(data = as.vector(mydata$V4), start = c(2016,3), frequency = 12)
fit <- mlp(testdata)
Error in apply(y, 1L, rank) : dim(X) must have a positive length

Error in if (ncol.matrix < rep) { : argument is of length zero

I get the error message from the title when running the following code:

library(tidyverse)
library(nnfor)
library(cranlogs)

rdieharder <- cran_downloads("RDieHarder", from = "2017-01-01")

train_data <- rdieharder %>%
  filter(date < as.Date("2019-01-01")) %>%
  pull(count) %>%
  ts()

# I replace this value, because this is just for testing purposes, and this value is unusually high
train_data[train_data==373] <- 3

test_data <- rdieharder %>%
  filter(date >= as.Date("2019-01-01"))

croston_model <- crost(train_data, h = 365)

nn_model <- mlp(train_data, hd.auto.type = "cv")

Same if I replace "cv" by "valid", but no issue if I add "reps = 1", or reps = "2". Any ideas?

How to do out of sample forecast by SVM in r?

hi,
I am doing uni variate forecasting by using SVM in r. I did my in sample forecast precisely but when i do forecast for some next time period it gives the same values. here are codes.
lagged_data<-y[complete.cases(y),]
View(lagged_data)
n<-dim(lagged_data)[1]
train_data<-lagged_data[1:(n-24),]
test_data<-lagged_data[(n-23):n,]
modelsvm = svm(inflation~.,train_data)
predYsvm = predict(modelsvm, test_data)
forecast<-data.frame(test_data$inflation, predYsvm)
till now it did good but it is in sample forecast but when i do for out sample forecast it repeats the training values.
out_predYsvm = predict(modelsvm, h=24)

mlp and elm don't work with vectors as xreg

It would be great to allow this to work:
mlp(BJsalesInsample,xreg=window(BJsales.lead,1,120))

Instead xreg only accepts matrix, so this needs to be done all the time:
mlp(BJsalesInsample,xreg=as.matrix(window(BJsales.lead,1,120)))

Maybe do that transformation in the code automatically if !is.matrix(xreg)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.