Techiio-author
Started by Anik AdhikaryMay 13, 2022

Open
Why I got this error while train a dataset ?

3 VIEWES 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 3 VIEWES SHARE
valueError
Traceback (most recent call last)
-\AppData\Local\Temp/ipykernel_968/3192075464.py in codule>
1 1r LinearRegression()
--> 2 Ir.fit(x_train, y_train)
-lanaconda3\lib\site-packages\sklearn\linear_nodelbase.py in fit (self, x, y, sample_weight)
 accept sparse False if self.positive else ["cse", "csc", "coo"]
x, y self._validate_data(
x, y, accept sparse accept sparse, y_numeric True, multi_output True
-Manaconda3\lib\site-packages\sklearn\base.py in _validate_data(self, x, y, reset, validate separately, "check_params) y check_array(y, check_y_params)
else:
X, y check_xy(x, y, check_params)
out = x, y
-Manaconda3\lib\site-packages\sklearn\utils\validation.py in check_xy(x, y, accept sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure 2d, allow_nd, multi_output, ensure_min_samples, ensure_sin_features, y numeric, estimator) raise valueError("y cannot be None") 
X=check_array(
X,
accept sparse accept sparse,
-lanaconda3\lib\site-packages\sklearn\utils\validation.py in check_array(array, accept sparse, accept_large_sparse, dtype, orde r, copy, force all finite, ensure 2d, allow_nd, ensure_min_samples, ensure min features, estimator) # If input is ID raise error
if array,ndim 1:
raise ValueError( "Expected 20 array, got 10 array instead: \narray={}.\n" "Reshape your data either using array.reshape(-1, 1) if "
ValueError: Expected 20 array, got 10 array instead:
array=[ 2.9 5.1 3.2 4.5 8.2 6.8 1.3 10.5 3. 2.2 5.9 6. 3.7 3.2
9. 2. 1.1 7.1 4.9 4. 1.
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a

Could someone help me out to find the error?

0 Replies

You must be Logged in to reply
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance