secretflow.ml.boost.sgb_v.factory.components.sampler#
Classes:
  | 
- class secretflow.ml.boost.sgb_v.factory.components.sampler.Sampler[源代码]#
 基类:
ComponentMethods:
__init__()set_params(params)get_params(params)set_devices(_)generate_col_choices(feature_buckets)Generate column sample choices.
generate_row_choices(row_num)apply_vector_sampling(x, indices)Sample x for a single partition.
apply_v_fed_sampling(X[, row_choices, ...])Sample X based on row choices and col choices.
- generate_col_choices(feature_buckets: List[PYUObject]) Tuple[List[PYUObject], List[PYUObject]][源代码]#
 Generate column sample choices.
- apply_vector_sampling(x: PYUObject, indices: Union[PYUObject, ndarray])[源代码]#
 Sample x for a single partition. Assuming we have a column vector. Assume the indices was generated from row sampling by sampler
- apply_v_fed_sampling(X: FedNdarray, row_choices: Union[None, ndarray, PYUObject] = None, col_choices: List[Union[None, ndarray, PYUObject]] = []) FedNdarray[源代码]#
 Sample X based on row choices and col choices. Assume the choices were generated by sampler.
- 参数:
 X (FedNdarray) – Array to sample from
row_choices (Union[None, np.ndarray, PYUObject]) – row sampling choices. devices are assumed to be ordered as X.
col_choices (List[Union[None, np.ndarray,PYUObject]) – col sampling choices. devices are assumed to be ordered as X.
- 返回:
 subsampled X shape (Tuple[int, int]): shape of X_sub
- 返回类型:
 X_sub (FedNdarray)
secretflow.ml.boost.sgb_v.factory.components.sampler.sampler#
Classes:
  | 
'row_sample_rate': Row sub sample ratio of the training instances.  | 
  | 
Functions:
- class secretflow.ml.boost.sgb_v.factory.components.sampler.sampler.SamplerParams(row_sample_rate: float = 1, col_sample_rate: float = 1, seed: int = 1212)[源代码]#
 基类:
object- ‘row_sample_rate’: Row sub sample ratio of the training instances.
 default: 1 range: (0, 1]
- ‘col_sample_rate’: Col sub sample ratio of columns when constructing each tree.
 default: 1 range: (0, 1]
- ‘seed’: Pseudorandom number generator seed.
 default: 1212
Attributes:
Methods:
__init__([row_sample_rate, col_sample_rate, ...])- row_sample_rate: float = 1#
 
- col_sample_rate: float = 1#
 
- seed: int = 1212#
 
- __init__(row_sample_rate: float = 1, col_sample_rate: float = 1, seed: int = 1212) None#
 
- class secretflow.ml.boost.sgb_v.factory.components.sampler.sampler.Sampler[源代码]#
 基类:
ComponentMethods:
__init__()set_params(params)get_params(params)set_devices(_)generate_col_choices(feature_buckets)Generate column sample choices.
generate_row_choices(row_num)apply_vector_sampling(x, indices)Sample x for a single partition.
apply_v_fed_sampling(X[, row_choices, ...])Sample X based on row choices and col choices.
- generate_col_choices(feature_buckets: List[PYUObject]) Tuple[List[PYUObject], List[PYUObject]][源代码]#
 Generate column sample choices.
- apply_vector_sampling(x: PYUObject, indices: Union[PYUObject, ndarray])[源代码]#
 Sample x for a single partition. Assuming we have a column vector. Assume the indices was generated from row sampling by sampler
- apply_v_fed_sampling(X: FedNdarray, row_choices: Union[None, ndarray, PYUObject] = None, col_choices: List[Union[None, ndarray, PYUObject]] = []) FedNdarray[源代码]#
 Sample X based on row choices and col choices. Assume the choices were generated by sampler.
- 参数:
 X (FedNdarray) – Array to sample from
row_choices (Union[None, np.ndarray, PYUObject]) – row sampling choices. devices are assumed to be ordered as X.
col_choices (List[Union[None, np.ndarray,PYUObject]) – col sampling choices. devices are assumed to be ordered as X.
- 返回:
 subsampled X shape (Tuple[int, int]): shape of X_sub
- 返回类型:
 X_sub (FedNdarray)