Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I still need help for the same question that I was previously post here. The question that I posted still have yet resolve by

Hi, I still need help for the same question that I was previously post here. The question that I posted still have yet resolve by the expert and I think that there is some misunderstanding on the question that I post earlier on. I need help for the coding on Part B. Thank you very much.

PART A:

First, I posted the the function for more clear picture about my dataset. And this function no need to provide a code. The function provided by the lab is as below: This part is done. FIRST CELL:

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

PART B:

MY ACTUAL QUESTION FROM MY PREVIOUS POST WAS AS BELOW. I need help for the below question because I got an error after my submission.

# 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 for PART B. Thank you so much.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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