How to use the bonsai.core.bonsaic.Bonsai.__init__ function in bonsai

To help you get started, we’ve selected a few bonsai examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yubin-park / bonsai-dt / bonsai / base / alphatree.py View on Github external
gain -= (p_x_r * np.power(1.0 - p_y_r, self.alpha))
                gain = gain / self.alpha / (1.0 - self.alpha)

            best_idx = np.argsort(gain)[-1]

            return {"selected": avc[best_idx,:]}

        def is_leaf(branch, branch_parent):

            if (branch["depth"] >= self.max_depth or 
                branch["n_samples"] < self.min_samples_split):
                return True
            else:
                return False

        Bonsai.__init__(self, find_split, is_leaf, z_type="M2")
github yubin-park / bonsai-dt / bonsai / base / regtree.py View on Github external
return ss

        def is_leaf(branch, branch_parent):

            varsum_dec = 1.0 + self.min_varsum_decrease
            if "varsum" in branch_parent:
                varsum_dec = branch_parent["varsum"] - branch["varsum"]
            if (branch["depth"] >= self.max_depth or 
                branch["n_samples"] < self.min_samples_split or
                varsum_dec < self.min_varsum_decrease):
                return True
            else:
                return False

        Bonsai.__init__(self, 
                        find_split, 
                        is_leaf,
                        subsample = subsample, 
                        random_state = random_state,
                        n_jobs = n_jobs,
                        z_type = "M2")
github yubin-park / bonsai-dt / bonsai / base / friedmantree.py View on Github external
friedman_score = n_l * n_r / (n_l + n_r) * diff2
            
            best_idx = np.argsort(friedman_score)[-1]
            ss = {"selected": avc[best_idx,:]}

            return ss

        def is_leaf(branch, branch_parent):

            if (branch["depth"] >= self.max_depth or 
                branch["n_samples"] < self.min_samples_split):
                return True
            else:
                return False

        Bonsai.__init__(self, 
                        find_split, 
                        is_leaf,
                        subsample=subsample, 
                        random_state=random_state,
                        n_jobs=n_jobs,
                        z_type="M2")
github yubin-park / bonsai-dt / bonsai / base / xgbtree.py View on Github external
ss = {"selected": avc[best_idx,:],
                  "y@l": y_l[best_idx],
                  "y@r": y_r[best_idx]}

            return ss

        def is_leaf(branch, branch_parent):

            if (branch["depth"] >= self.max_depth or 
                branch["n_samples"] < self.min_samples_split):
                return True
            else:
                return False

        Bonsai.__init__(self, 
                        find_split, 
                        is_leaf,
                        subsample=subsample, 
                        random_state=random_state,
                        n_jobs = n_jobs,
                        z_type="Hessian")