Database Reference
In-Depth Information
Distribution of log-transformed target variable values
A second type of transformation that is useful in the case of target values that do not take
on negative values and, in addition, might take on a very wide range of values, is to take
the square root of the variable.
We will apply the square root transform in the following code, once more plotting the res-
ulting target variable distribution:
sqrt_targets = records.map(lambda r:
np.sqrt(float(r[-1]))).collect()
hist(sqrt_targets, bins=40, color='lightblue', normed=True)
fig = matplotlib.pyplot.gcf()
fig.set_size_inches(16, 10)
Search WWH ::




Custom Search