2
$\begingroup$

Here is a toy-example, where '0_1' looks better than 'norm'. Using 'norm'(z-scores) has a huge training error and almost constant prediction.

library(RSNNS)
x <- runif(1020, 1, 5000)
y <- sqrt(x)
#0_1 type
x.01 <- normalizeData(x, type='0_1')
y.01 <- normalizeData(y, type='0_1')
model.01 <- mlp(x.01[1:1000], y.01[1:1000], size = 1)
py.01 <- predict(model.01, matrix(x.01[1001:1020], ncol=1))
py.01 <- denormalizeData(py.01, getNormParameters(y.01))
#norm type
x.n <- normalizeData(x, type='norm')
y.n <- normalizeData(y, type='norm')
model.n <- mlp(x.n[1:1000], y.n[1:1000], size = 1)
py.n <- predict(model.n, matrix(x.n[1001:1020], ncol=1))
py.n <- denormalizeData(py.n, getNormParameters(y.n))
#print
res <- cbind(y[1001:1020], py.01, py.n)
colnames(res) <- c('target', '0_1', 'norm')
print(res)
    target      0_1     norm
 [1,]  7.847747 18.42934 47.98046
 [2,] 20.128710 21.63094 47.98193
 [3,] 51.883655 54.31361 50.05302
 [4,] 39.988633 38.61841 48.02621
 [5,] 37.763832 35.78068 48.00804
 [6,] 36.182139 33.88958 48.00035
 [7,] 49.259397 51.15189 48.77056
 [8,]  9.989678 18.74624 47.98058
 [9,] 37.053090 34.91668 48.00420
[10,] 67.759140 65.00623 64.26272
[11,] 40.238815 38.94849 48.02908
[12,] 55.269081 57.80950 54.15643
[13,] 68.659288 65.26538 64.33199
[14,] 67.240699 64.84575 64.21361
[15,] 32.216679 29.69490 47.99008
[16,] 37.735459 35.74576 48.00787
[17,] 43.830574 43.84002 48.10858
[18,]  8.959444 18.58314 47.98052
[19,] 22.715183 22.83997 47.98266
[20,] 58.814483 60.69753 59.91301

Why doesn't using z-scores work here?

I'm use RSNNS package

$\endgroup$
3
  • $\begingroup$ which is the part where you are computing z-scores? $\endgroup$
    – Glen_b
    Aug 10 '13 at 0:14
  • $\begingroup$ @Glen_b I clarified my question. It should be clear now. Thanks for help. $\endgroup$
    – luckyi
    Aug 10 '13 at 10:57
  • $\begingroup$ I'm not familiar with rsnns so it would help if you would explain why any normalization is needed. $\endgroup$ Aug 10 '13 at 11:52
1
$\begingroup$

The output from mlp is always positive, so those values that should be negative are predicted to be very close to zero. Thus after back-transformation they are all close to the mean.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.