Newbie
Newbie

Reputation: 15

I am unable to use np.concatenate

I have 2 variables from polynomial regression:

y_test = [1.57325397 0.72686416]
y_pred= [1.57325397 0.72686416]

y_test is the y axis of the test i did, while y_pred is are the values i got from regressor.predict (regressor is the object of LinearRegression class).

I tried to use np.concatenate((y_test),(y_predict)) but it did not work and it said only integer scalar arrays can be converted to a scalar index. So what should I do here? it OK to round of the values to integers or should I do something else?

Upvotes: -1

Views: 47

Answers (1)

DataFlo
DataFlo

Reputation: 64

You should first separate your list values with a comma:

y_test = [1.57325397,0.72686416]
y_pred= [1.57325397,0.72686416]

For concatenation you should define an axis and use following syntax:

np.concatenate((y_test, y_pred), axis=0)

Then you would get

array([1.57325397, 0.72686416, 1.57325397, 0.72686416])

Upvotes: 1

Related Questions