Closed danielhorn closed 10 years ago
Agree, so we want to normalize (c, c, ..., c) right?
Can you write down here how you want to transform this for all "method"s, please?
center: Everything is fine scale: Division by standard deviation is bad. I would say: If sd is 0, simply don't divide standardize: Same as scale range: return min / max or mean of given range interval. not sure which of these alternatives is the best
moreover, I just noticed:
is.matrix(normalize(c(1, 1, 1), method = "scale")) [1] TRUE is.matrix(normalize(c(1, 1, 1), method = "range")) [1] FALSE
Regarding last "error":
Do you really get that from the GH version? Because I fixed and tested this some time ago?
Regarding the real issue:
I agree. For range return the middle of the inverval. Also have on.constant = "stop" / "warn" / "quiet" For center your never warn or stop. Document and test this please.
Regarding error: You're right Regarding real issue: Done. Never warn / stop for center? This seems inconsistent to me, I would not treat center different.
PS: I don't have the permission to push to BBmisc?
Ok make it consistent.
You have push rights.
done with f8d2916a28e895bd44e4cf518450eb649327b577
Is this a bug? It happens for every constant vector.
normalize(c(0, 0), method = "range") [1] NaN NaN
From a mathematical point of view, it's correct. On the other hand - if normalizing i don't want to think about "uhm ... can my vector be constant?", I just want to use this function without additional prechecks. Perhaps a better behaviour would be to return the min/max/mean value of the given range?