Question: create a function to reads the file and separate it into training data and evaluation data based on the split indicator. The function should return

create a function to reads the file and separate it into training data and evaluation data based on the split indicator. The function should return four lists:

  • x_data, containing all reviews of the x set.
  • x_label, containing all associated sentiment labels for the x_data.
  • y_data, containing all reviews of the y set.
  • y_lanbel, containing all associated sentiment lebels for the test data.

function should print on the console:

  • positive reviews's number in the x set.
  • negative reviews's number in the x set.
  • positive reviews 's number in the evaluation set. 
  • negative reviews's in the evaluation set. 

Step by Step Solution

3.40 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import random def readfileandsplitfilepath splitindicator xdata xlabel ydata ylabel with openfilepat... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!