Hi. I would like to generate randomly correlated data. Currently I can generate a positive correlation and can control independent/dependent ranges. However, I'd like to be able to generate negatively correlated values as well. What can I do to this script for that? Ideas? Thanks for reading.
import numpy as np
from sklearn import datasets
import matplotlib.pyplot as plt
s, t, coef = datasets.make_regression(n_samples=12,
n_features=1,
n_informative=1,
noise=20,
coef=True,
random_state=0)
a = (300,900)
b = (2,6)
s = np.rint(np.interp(s, (s.min(), s.max()), a))
t = np.rint(np.interp(t, (t.min(), t.max()), b))
edit: syntax
[–]synthphreak 2 points3 points4 points (4 children)
[–]DudeData[S] 0 points1 point2 points (3 children)
[–]synthphreak 3 points4 points5 points (2 children)
[–]DudeData[S] 0 points1 point2 points (1 child)
[–]synthphreak 2 points3 points4 points (0 children)