Hi Guys,I am trying to create one version using LinearRegression module, yet it reflects me the below error.

You are watching: Expected 2d array, got 1d array instead:

$ mind=LinearRegression()$ mind.fit(x,y)ValueError Traceback (most recent call last) in ----> 1 mind.fit(x,y)~anaconda3libsite-packagessklearnlinear_model\_base.py in fit(self, X, y, sample_weight) 490 n_jobs_ = self.n_jobs 491 X, y = check_X_y(X, y, accept_sparse=<"csr", "csc", "coo">,--> 492 y_numeric=True, multi_output=True) 493 494 if sample_weight is not None:~anaconda3libsite-packagessklearnutilsvalidation.py in check_X_y(X, y, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, multi_output, ensure_min_samples, ensure_min_features, y_numeric, warn_on_dtype, estimator) 753 ensure_min_features=ensure_min_features, 754 warn_on_dtype=warn_on_dtype,--> 755 estimator=estimator) 756 if multi_output: 757 y = check_array(y, "csr", force_all_finite=True, ensure_2d=False,~anaconda3libsite-packagessklearnutilsvalidation.py in check_array(array, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, warn_on_dtype, estimator) 554 "Reshape your data either utilizing array.reshape(-1, 1) if " 555 "your data has actually a single feature or array.reshape(1, -1) "--> 556 "if it has a single sample.".format(array)) 557 558 # later np.flexible dtypes will be handled choose object dtypesValueError: expected 2D array, got 1D array instead:array=<2 4 7 9>.Reshape her data either utilizing array.reshape(-1, 1) if her data has a single feature or array.reshape(1, -1) if it contains a single sample.What i am act wrong?


*
Apr 9, 2020in maker Learningby akhtar•38,210 point out •8,466 views
answercomment
flag

Your comment on this question:

Your surname to display (optional):
Email me in ~ this attend to if a comment is added after mine:Email me if a comment is added after mine

Privacy: your email address will just be used for sending these notifications.

See more: Sam Elliott Special Kind Of Stupid, Memes & Gifs


Add commentCancel

1 answer to this question.


Your answer

Your name to display screen (optional):
Email me in ~ this attend to if my answer is selected or comment on:Email me if my answer is selected or commented on