Answered step by step
Verified Expert Solution
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started