Closed fawda123 closed 9 years ago
Hi, the problem was that the data was actually introduced in reverse order than the labels for the input units. I just committed a fix that the data is now introduced in reverse order, so can you please check if this resolves the problem?
Hi, that definitely changed the output but I still don't think it's correct. Check out this example:
set.seed(123)
library(NeuralNetTools)
library(RSNNS)
x <- neuraldat[, c('X1', 'X2', 'X3')]
y <- neuraldat[, 'Y1']
# pruned model using code from RSSNS pruning demo
pruneFuncParams <- list(max_pr_error_increase = 10.0, pr_accepted_error = 1.0,
no_of_pr_retrain_cycles = 1000, min_error_to_stop = 0.01, init_matrix_value = 1e-6,
input_pruning = TRUE, hidden_pruning = TRUE)
mod <- mlp(x, y, size = 5, pruneFunc = "OptimalBrainSurgeon",
pruneFuncParams = pruneFuncParams)
plotnet(mod)
lekprofile(mod, x)
mod$snnsObject$getCompleteWeightMatrix()
The pruned model shows only X1 as being important, whereas the lekprofile results show only a response to changes in X3. The lekprofile method uses the predict function that I showed in the last example. The plot and the weights matrix also confirm the problem. Any thoughts? Thanks.
I had another look into this. I think I found the problem now and hopefully could fix it. Can you please check?
Yep, that fixed it, thanks! I'll look forward to the next CRAN release.
The new version is on CRAN now
Hi again,
I had a quick question about the predict method for pruned neural networks. I'm getting some weird results when I predict values with new data from a pruned mlp network. Here's some code to illustrate the problem.
A plot of the pruned network...
Now, when I give the pruned model some new data with a constant value for X3, why would the predicted response change? I would expect changing values for X1 and X2 to have no effect on model predictions because the connection weights are zero, whereas changing values for X3 would produce a response for Y because the connection weights are non-zero. Am I thinking about this correctly?
Any idea why this is happening?
Thanks,
Marcus