# Logistic Regression with Split
logreg = LogisticRegression()
logreg.fit(Feature_Train, Class_Train)
Y_pred = logreg.predict(Feature_Test)
acc_log = round(logreg.score(Feature_Test, Class_Test) * 100, 2)
acc_log
What I have tried:
--------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-85-0bf2d4538de5> in <module>
2
3 logreg = LogisticRegression()
----> 4 logreg.fit(Feature_Train, Class_Train)
5 Y_pred = logreg.predict(Feature_Test)
6 acc_log = round(logreg.score(Feature_Test, Class_Test) * 100, 2)
~\anaconda3\lib\site-packages\sklearn\linear_model\_logistic.py in fit(self, X, y, sample_weight)
1340 _dtype = [np.float64, np.float32]
1341
-> 1342 X, y = self._validate_data(X, y, accept_sparse='csr', dtype=_dtype,
1343 order="C",
1344 accept_large_sparse=solver != 'liblinear')
~\anaconda3\lib\site-packages\sklearn\base.py in _validate_data(self, X, y, reset, validate_separately, **check_params)
430 y = check_array(y, **check_y_params)
431 else:
--> 432 X, y = check_X_y(X, y, **check_params)
433 out = X, y
434
~\anaconda3\lib\site-packages\sklearn\utils\validation.py in inner_f(*args, **kwargs)
70 FutureWarning)
71 kwargs.update({k: arg for k, arg in zip(sig.parameters, args)})
---> 72 return f(**kwargs)
73 return inner_f
74
~\anaconda3\lib\site-packages\sklearn\utils\validation.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, estimator)
806 else:
807 y = column_or_1d(y, warn=True)
--> 808 _assert_all_finite(y)
809 if y_numeric and y.dtype.kind == 'O':
810 y = y.astype(np.float64)
~\anaconda3\lib\site-packages\sklearn\utils\validation.py in _assert_all_finite(X, allow_nan, msg_dtype)
94 not allow_nan and not np.isfinite(X).all()):
95 type_err = 'infinity' if allow_nan else 'NaN, infinity'
---> 96 raise ValueError(
97 msg_err.format
98 (type_err,
ValueError: Input contains NaN, infinity or a value too large for dtype('float64').