nick34992 of Python
2/2/2017 - 7:19 AM

Random Forest Scatter Plot Example

Random Forest Scatter Plot Example

#!/usr/bin/env python2.7
# ref. http://www.kdnuggets.com/2016/12/random-forests-python.html

import numpy as np
import pylab as pl

x = np.random.uniform(1, 100, 1000)
y = np.log(x) + np.random.normal(0, .3, 1000)

pl.scatter(x, y, s=1, label="log(x) with noise")
pl.plot(np.arange(1, 100), np.log(np.arange(1, 100)), c="b", label="log(x) true function")
pl.xlabel("x")
pl.ylabel("f(x) = log(x)")
pl.legend(loc="best")
pl.title("A Basic Log Function")
pl.show()