def build_stump_1D(x, y, w):

     xyw = np.array(sorted(zip(x, y, w), key=operator.itemgetter(0)))
     xsorted = xyw[:, 0]
     wy = xyw[:,1 ] * xyw[:, 2]
     
     # calculate the scores to define boundaary
     score_left = np.cumsum(wy)
     score_right = np.cumsum(wy[::-1])
     score = - score_left[0:-1:1] + score_right[-1:0:-1]
     I = np.where(xsorted[:-1] < xsorted[1:])[0]
  

     # find the boundary
     if len(I) > 0:  
        ind, max_score = max(zip(I, abs(score[I])), key=operator.itemgetter(1))
        
        # compute the weighted error
        err = 0.5-0.5*max_score 
        
        # compute threshold
        threshold = (xsorted[ind] + xsorted[ind+1])/2
        s = np.sign(score[ind])
     
     else: err, threshold, s = 0.5, 0, 1.0

     return StumpTree(err, threshold, s)
Set whether the contents scale with the widget size.
dataset/ETHPy150Open bt3gl/Advanced-Machine-Learning/adaboost/decision_stump.py/build_stump_1D--crossover with--dataset/ETHPy150Open ContinuumIO/ashiba/enaml/enaml/qt/qt_image_view.py/QImageView.setScaledContents