G
G
geelz2020-04-18 23:00:32
Python
geelz, 2020-04-18 23:00:32

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, :] )

How can I train a tree using this data? Is it possible that Y is missing something?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
geelz, 2020-04-19
@geelz

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 question

Ask a Question

731 491 924 answers to any question