Answer the question
In order to leave comments, you need to log in
How should the tree learn from these inputs?
Distance exam in Machine Learning, you need to write a decision tree algorithm for the following dataset:
x = []
for i in range(500):
x.append([round(-2+50*random()), round(-2+50*random())])
x = np.array(x)
y = round(random()+ x[1, :] + x[2, :] )
Answer the question
In order to leave comments, you need to log in
There were errors in the code, I rewrote it.
X_train = []
for i in range(5000):
X_train.append([round(-2 + 50 * rand()), round(-2 + 50 * rand())])
X_train = np.array(X_train)
Y_train = round(rand()) + X_train[:, 0] + X_train[:, 1]
X_test = []
for i in range(500):
X_test.append([round(-2 + 50 * rand()) , round(-2 + 50 * rand())])
X_test = np.array(X_test)
Y_test = round(rand()) + X_test[:, 0] + X_test[:, 1]
I get 500 random values and they will need to be classified by a random number of classes. It was very difficult without a sclern, but I made the code and it works, the issue is closed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question