Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I need help for the below question, because I got an error after my submission. Let me show you the default function in the

Hi, I need help for the below question, because I got an error after my submission.

Let me show you the default function in the lab first:

First default function:

def get_spam_dataset(filepath="data/spamdata.csv", test_split=0.1): ''' get_spam_dataset Loads csv file located at "filepath". Shuffles the data and splits it so that the you have (1-test_split)*100% training examples and (test_split)*100% testing examples. Args: filepath: location of the csv file test_split: percentage/100 of the data should be the testing split Returns: X_train, X_test, y_train, y_test, feature_names (in that order) first four are np.ndarray ''' # your code here data=pd.read.csv('data/spamdata.csv') x = df.iloc[:,1:] y = df.iloc[:,0] X_train, X_test, y_train, y_test, feature_names = train_test_split(x, y, test_size=0.1, shuffles=True) return X_train, X_test, y_train, y_test, feature_names return 0

Question and My Answer are in the same code cell:

# TO-DO: import the data set into five variables: X_train, X_test, y_train, y_test, label_names # Uncomment and edit the line below to complete this task. test_split = 0.1 # default test_split; change it if you'd like; ensure that this variable is used as an argument to your function # your code here X_train, X_test, y_train, y_test, label_names = get_spam_dataset()-MY ANSWER X_train, X_test, y_train, y_test, label_names = np.arange(5) - THIS CODE IS ALREADY PROVIDED IN THE LAB

An Error after my submission:

IndexError Traceback (most recent call last)  in  Traceback Redacted IndexError: tuple index out of range

Please help me on the coding. 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

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions

Question

What is cultural tourism and why is it growing?

Answered: 1 week ago

Question

8. Do the organizations fringe benefits reflect diversity?

Answered: 1 week ago

Question

7. Do the organizations social activities reflect diversity?

Answered: 1 week ago