secretflow.ml.boost.sgb_v.core.distributed_tree#

secretflow.ml.boost.sgb_v.core.distributed_tree.distributed_tree#

Classes:

DistributedTree()

A DistributedTree consists of split trees from each party and leaf weight from label holder

Functions:

from_dict(tree_content)

class secretflow.ml.boost.sgb_v.core.distributed_tree.distributed_tree.DistributedTree[源代码]#

基类:object

A DistributedTree consists of split trees from each party and leaf weight from label holder

Methods:

__init__()

insert_split_tree(device, split_tree)

insert a split tree owned by deivce

set_leaf_weight(label_holder, leaf_weight)

leaf weight is owned by label holder

predict(x)

predict using a single tree.

to_dict()

Serialize to a Dictionary.

__init__()[源代码]#
insert_split_tree(device: PYU, split_tree: PYUObject)[源代码]#

insert a split tree owned by deivce

参数:
  • device (PYU) – split tree owner

  • split_tree (PYUObject) – split tree in disguise

set_leaf_weight(label_holder: PYU, leaf_weight: PYUObject)[源代码]#

leaf weight is owned by label holder

predict(x: Dict[PYU, PYUObject]) PYUObject[源代码]#

predict using a single tree. A single tree is actually consists of all split trees. Note the model predict = base + sum of tree predict. This is useful in both training and inference

参数:
  • tree (Dict[PYU, PYUObject]) – {party: split tree}

  • weight (PYUObject) – leaf weights from label holder

  • x (Dict[PYU, PYUObject]) – partitions of FedNdarray. {party: party’s partition}

返回:

_description_

返回类型:

PYUObject

to_dict() Dict[源代码]#

Serialize to a Dictionary. Note this dict contain PYUObjects, cannot dump to file at this level.

secretflow.ml.boost.sgb_v.core.distributed_tree.distributed_tree.from_dict(tree_content: Dict) DistributedTree[源代码]#

secretflow.ml.boost.sgb_v.core.distributed_tree.split_tree#

Classes:

SplitTree()

Each party will hold one split tree.

Functions:

from_dict(dict)

is_left_node(node_index)

judge if a node is left node or right node from index root is view as left.

class secretflow.ml.boost.sgb_v.core.distributed_tree.split_tree.SplitTree[源代码]#

基类:object

Each party will hold one split tree. Note this tree contains no leaf weights, but contains leaf indices.

Methods:

__init__()

insert_split_node(feature, value[, index])

extend_leaf_indices(leaf_indices)

predict_leaf_select(x)

compute leaf nodes' sample selects known by this partition.

to_dict()

__init__() None[源代码]#
insert_split_node(feature: int, value: float, index: int = 0) None[源代码]#
extend_leaf_indices(leaf_indices: List[int]) None[源代码]#
predict_leaf_select(x: ndarray) ndarray[源代码]#

compute leaf nodes’ sample selects known by this partition.

参数:
  • x – dataset from this partition.

  • tree – tree model store by this partition.

返回:

List[np.array], length equals leaf number.

返回类型:

leaf nodes’ selects

to_dict() Dict[源代码]#
secretflow.ml.boost.sgb_v.core.distributed_tree.split_tree.from_dict(dict: Dict) SplitTree[源代码]#
secretflow.ml.boost.sgb_v.core.distributed_tree.split_tree.is_left_node(node_index: int) bool[源代码]#

judge if a node is left node or right node from index root is view as left.