Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

rror Traceback ( most recent call last ) Cell In [ 5 8 ] , line 4 2 model 1 = LogisticRegression ( ) 3

rror Traceback (most recent call last)
Cell In[58], line 4
2 model1= LogisticRegression()
3 # Fitting the model for the 80% training data
---->4 model1.fit(X_train1, y_train1)
5 #Predict the outcomes for the 20% testing set
6 y_pred1= model1.predict(X_test1)
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/sklearn/base.py:1151, in _fit_context..decorator..wrapper(estimator,*args,**kwargs)
1144 estimator._validate_params()
1146 with config_context(
1147 skip_parameter_validation=(
1148 prefer_skip_nested_validation or global_skip_validation
1149)
1150):
->1151 return fit_method(estimator,*args,**kwargs)
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/sklearn/linear_model/_logistic.py:1252, in LogisticRegression.fit(self, X, y, sample_weight)
1250 classes_= self.classes_
1251 if n_classes <2:
->1252 raise ValueError(
1253 "This solver needs samples of at least 2 classes"
1254" in the data, but the data contains only one"
1255" class: %r"
1256% classes_[0]
1257)
1259 if len(self.classes_)==2:
1260 n_classes =1
ValueError: This solver needs samples of at least 2 classes in the data, but the data contains only one class: 1

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

Recommended Textbook for

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions

Question

7. Identify four antecedents that influence intercultural contact.

Answered: 1 week ago