Question: Implement sqsplit def sqsplit ( xTr , yTr ) : Finds the best feature, cut value, and impurity for a split of

Implement sqsplit
def sqsplit(xTr, yTr):
"""
Finds the best feature, cut value, and impurity for a split of (xTr, yTr) based on squared loss impurity.
Input:
xTr: n x d matrix of data points
yTr: n-dimensional vector of labels
Output:
feature: index of the best cut's feature (keep in mind this is 0-indexed)
cut: cut-value of the best cut
bestloss: squared loss impurity of the best cut
"""
n, d = xTr.shape
assert d >0 # must have at least one dimension
assert n >1 # must have at least two samples
bestloss = np.inf
feature = np.inf
cut = np.inf
# YOUR CODE HERE
raise NotImplementedError()
#return feature, cut, bestloss

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!