Question: Implement sqsplit def sqsplit ( xTr , yTr ) : Finds the best feature, cut value, and impurity for a split of
Implement sqsplit
def sqsplitxTr 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: ndimensional vector of labels
Output:
feature: index of the best cut's feature keep in mind this is indexed
cut: cutvalue of the best cut
bestloss: squared loss impurity of the best cut
n d xTrshape
assert d # must have at least one dimension
assert n # must have at least two samples
bestloss npinf
feature npinf
cut npinf
# 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
