Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I need help for the below code. I had found the code for the below question in Chegg here, but after I had written

Hi, I need help for the below code. I had found the code for the below question in Chegg here, but after I had written the code, my result gave me the below error.

Code that found in Chegg:

from sklearn.model_selection import train_test_split from sklearn.datasets import load_breast_cancer

class BC_data: """ class to import the breast cancer dataset from sklearn """ def __init__(self): x, y = load_breast_cancer(return_X_y= True) self.x_train = None self.x_test = None self.y_train = None self.y_test = None #TODO: Split the data into training and test data (use train_test_split sklearn) # such that the test data size is 25% of total number of observations # No need to rescale the data. Use the data as is. # your code here data = BC_data() data.x_train, data.x_test, data.y_train, data.y_test = train_test_split(data.x, data.y, test_size=0.25, random_state=0)

After submission, the error listed below:

NameError Traceback (most recent call last)  in  Traceback Redacted NameError: name 'data' is not defined

Please help me on the code. Thank you so much.

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

Objects And Databases International Symposium Sophia Antipolis France June 13 2000 Revised Papers Lncs 1944

Authors: Klaus R. Dittrich ,Giovanna Guerrini ,Isabella Merlo ,Marta Oliva ,M. Elena Rodriguez

2001st Edition

3540416641, 978-3540416647

More Books

Students also viewed these Databases questions

Question

What are the different techniques used in decision making?

Answered: 1 week ago