Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Legacy code stopped working #25

Open
vonjd opened this issue Mar 8, 2019 · 9 comments
Open

Legacy code stopped working #25

vonjd opened this issue Mar 8, 2019 · 9 comments

Comments

@vonjd
Copy link

vonjd commented Mar 8, 2019

The first example in http://blog.ephorie.de/understanding-the-magic-of-neural-networks stopped working for no apparent reason.

It is a super simple net and gave the right results with compute. Now neither compute nor predict work, only giving NA.

Please advise... Thank you

@mnwright
Copy link
Member

mnwright commented Mar 8, 2019

In that example some weights are NA. In the old version these were just set to 0 and we are now doing the same. The example should work again.

@vonjd
Copy link
Author

vonjd commented Mar 8, 2019

I used the current version from CRAN, which does not work... so do you mean that it is working in the github version which will be rolled out to CRAN next?

@mnwright
Copy link
Member

mnwright commented Mar 8, 2019

Yes, you'll have to install the Github version until it is on CRAN, e.g. with

devtools::install_github("bips-hb/neuralnet")

@vonjd
Copy link
Author

vonjd commented Mar 8, 2019

Yep, works! Thank you... when will the updated version be on CRAN?

@mnwright
Copy link
Member

mnwright commented Mar 8, 2019

That might take one or two months. You could also try to avoid the NA weights to make it work with the current CRAN version.

@vonjd
Copy link
Author

vonjd commented Mar 8, 2019

good point... why do the NAs arise in the first place in this super simple example?!?

@mnwright
Copy link
Member

mnwright commented Mar 8, 2019

Because you asked for them with exclude.

@vonjd
Copy link
Author

vonjd commented Mar 8, 2019

Because I wanted to exclude the bias neurons - see also here: https://stackoverflow.com/questions/40633567/how-to-exclude-bias-neurons-in-neuralnet-in-r

Is there a better way to do that?

@mnwright
Copy link
Member

OK, that makes sense. I think we need a better way to build models without bias units.

A simple fix to make your model run with the current CRAN version could also be to manually set the bias units to 0, e.g.,

neuralnetwork$weights[[1]] <- lapply(neuralnetwork$weights[[1]], function(x) {
  x[is.na(x)] <- 0
  x
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants