Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ValueError Traceback ( most recent call last ) Cell In [ 1 8 9 ] , line 1 - - - - > 1 X

ValueError Traceback (most recent call last)
Cell In[189], line 1
---->1 X_resample, y_resample = smote.fit_resample(X,y)
File ~\AppData\Local\anaconda3\Lib\site-packages\imblearn\base.py:203, in BaseSampler.fit_resample(self, X, y)
182"""Resample the dataset.
183
184 Parameters
(...)
200 The corresponding label of `X_resampled`.
201"""
202 self._validate_params()
-->203 return super().fit_resample(X, y)
File ~\AppData\Local\anaconda3\Lib\site-packages\imblearn\base.py:82, in SamplerMixin.fit_resample(self, X, y)
80 check_classification_targets(y)
81 arrays_transformer = ArraysTransformer(X, y)
--->82 X, y, binarize_y = self._check_X_y(X, y)
84 self.sampling_strategy_= check_sampling_strategy(
85 self.sampling_strategy, y, self._sampling_type
86)
88 output = self._fit_resample(X, y)
File ~\AppData\Local\anaconda3\Lib\site-packages\imblearn\base.py:156, in BaseSampler._check_X_y(self, X, y, accept_sparse)
154 accept_sparse =["csr","csc"]
155 y, binarize_y = check_target_type(y, indicate_one_vs_all=True)
-->156 X, y = self._validate_data(X, y, reset=True, accept_sparse=accept_sparse)
157 return X, y, binarize_y
File ~\AppData\Local\anaconda3\Lib\site-packages\sklearn\base.py:584, in BaseEstimator._validate_data(self, X, y, reset, validate_separately, **check_params)
582 y = check_array(y, input_name="y",**check_y_params)
583 else:
-->584 X, y = check_X_y(X, y,**check_params)
585 out = X, y
587 if not no_val_X and check_params.get("ensure_2d", True):
File ~\AppData\Local\anaconda3\Lib\site-packages\sklearn\utils\validation.py:1106, 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, estimator)
1101 estimator_name =_check_estimator_name(estimator)
1102 raise ValueError(
1103 f"{estimator_name} requires y to be passed, but the target y is None"
1104)
->1106 X = check_array(
1107 X,
1108 accept_sparse=accept_sparse,
1109 accept_large_sparse=accept_large_sparse,
1110 dtype=dtype,
1111 order=order,
1112 copy=copy,
1113 force_all_finite=force_all_finite,
1114 ensure_2d=ensure_2d,
1115 allow_nd=allow_nd,
1116 ensure_min_samples=ensure_min_samples,
1117 ensure_min_features=ensure_min_features,
1118 estimator=estimator,
1119 input_name="X",
1120)
1122 y =_check_y(y, multi_output=multi_output, y_numeric=y_numeric, estimator=estimator)
1124 check_consistent_length(X, y)
File ~\AppData\Local\anaconda3\Lib\site-packages\sklearn\utils\validation.py:879, 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, estimator, input_name)
877 array = xp.astype(array, dtype, copy=False)
878 else:
-->879 array =_asarray_with_order(array, order=order, dtype=dtype, xp=xp)
880 except ComplexWarning as complex_warning:
881 raise ValueError(
882 "Complex data not supported
{}
".format(array)
883) from complex_warning
File ~\AppData\Local\anaconda3\Lib\site-packages\sklearn\utils\_array_api.py:185, in _asarray_with_order(array, dtype, order, copy, xp)
182 xp,_= get_namespace(array)
183 if xp.__name__ in {"numpy", "numpy.array_api"}:
184 # Use NumPy API to support order
-->185 array = numpy.asarray(array, order=order, dtype=dtype)
186 return xp.asarray(array, copy=copy)
187 else:
File ~\AppData\Local\anaconda3\Lib\site-packages\pandas\core\generic.py:2070, in NDFrame.__array__(self, dtype)
2069 def __array__(self, dtype: npt.DTypeLike | None = None)-> np.ndarray:
->2070 return np.asarray(self._values, dtype=dtype)
ValueError: could not convert string to float: '3/31/2014'

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

7 . 1 7 . 4 : Make a copy of an ArrayList with an explicit loop.

Answered: 1 week ago

Question

13-5: Which of Freuds ideas did his followers accept or reject?

Answered: 1 week ago