Question: `The answer should be in [[[Python]]] language and you can find a sample for the output These are the attached files Output sample def getSplittingPoints(data):

`The answer should be in [[[Python]]] language and you can find a sample for the output

 `The answer should be in [[[Python]]] language and you can find

a sample for the output These are the attached files Output sample

These are the attached files

def getSplittingPoints(data): (5 pts) function that returns a 1-D numpy array with

Output sample

def getSplittingPoints(data): (5 pts) function that returns a 1-D numpy array with all the locations of potential splitting points for a continuous feature (just like what decision trees do when they have a continuous value). Assume the data is labeled with binary labels (either 1, or -1] hint #1: make sure the data is ordered correctly before deciding where to split hint #2: the number of splits returned will be the midpoint where the data shifts from positive to negative, or from negative to positive. hint #3: depending on your implementation, the function np.argsort may be useful Parameters: data: 2-D numpy array with two columns as follows: - The first column contains continuous feature values from 0 to 1 The second column contains labels that are binary (either -1, or 1) e.g. ( [0.24, 1), [0.9, 1], [0.58, -1), [0.19, 1], [0.54, -1] ] BI return None def mysteriousPlot(): (4 pts) Load and display the data of the examples from the file mystery.csv in a meaningful way. You will surely know if you got this right! hint #1: The graph will be 2-D scatter, eventhough the data is 3-D! (So two of the three dimensions will have to be combined) hint #2: Two of the columns will need to be combined with a simple mathematical formula (multiplication, addition, subtraction...e This will make your data 2 dimensional (two columns only). For example, one of the possibilities is to add the first colu to the second one, and then use the result as your first column, and the original third column as your second. hint #3: use two colors for the graph (You should be able to know how to color the data points based on their labels!) You can use what we learned in the python tutorial to successfully solve this. You will DEFINITELY know if you got this right :) return None mystery.csv sample_output.pdf split_data.csv In [18]: data np.genfromtxt('split_data.csv', delimiter=',') In [19]: hw1.getSplittingPoints(data) Out[19]: array( [0.305, 0.74 ]) In [20]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!