Question: 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 line
model LogisticRegression
# Fitting the model for the training data
modelfitXtrain ytrain
#Predict the outcomes for the testing set
ypred modelpredictXtest
File LibraryFrameworksPythonframeworkVersionslibpythonsitepackagessklearnbasepy: in fitcontext..decorator..wrapperestimatorargskwargs
estimator.validateparams
with configcontext
skipparametervalidation
preferskipnestedvalidation or globalskipvalidation
:
return fitmethodestimatorargskwargs
File LibraryFrameworksPythonframeworkVersionslibpythonsitepackagessklearnlinearmodellogistic.py: in LogisticRegression.fitself X y sampleweight
classes self.classes
if nclasses :
raise ValueError
"This solver needs samples of at least classes"
in the data, but the data contains only one"
class: r
classes
if lenselfclasses:
nclasses
ValueError: This solver needs samples of at least classes in the data, but the data contains only one class:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
