Skip to content

feldman_verifiable_sum_param

feldman_verifiable_sum_param

Classes

FeldmanVerifiableSumParam (BaseParam)

Define how to transfer the cols

Parameters:

Name Type Description Default
sum_cols list of column index, default: None

Specify which columns need to be sum. If column index is None, each of columns will be sum.

None
q_n int, positive integer less than or equal to 16, default: 6

q_n is the number of significant decimal digit, If the data type is a float, the maximum significant digit is 16. The sum of integer and significant decimal digits should be less than or equal to 16.

6
Source code in federatedml/param/feldman_verifiable_sum_param.py
class FeldmanVerifiableSumParam(BaseParam):
    """
    Define how to transfer the cols

    Parameters
    ----------
    sum_cols : list of column index, default: None
        Specify which columns need to be sum. If column index is None, each of columns will be sum.

    q_n : int, positive integer less than or equal to 16, default: 6
        q_n is the number of significant decimal digit, If the data type is a float, 
        the maximum significant digit is 16. The sum of integer and significant decimal digits should 
        be less than or equal to 16.
    """
    def __init__(self, sum_cols=None, q_n=6):
        self.sum_cols = sum_cols
        if sum_cols is None:
            self.sum_cols = []

        self.q_n = q_n

    def check(self):
        if isinstance(self.sum_cols, list):
            for idx in self.sum_cols:
                if not isinstance(idx, int):
                    raise ValueError(f"type mismatch, column_indexes with element {idx}(type is {type(idx)})")

        if not isinstance(self.q_n, int):
            raise ValueError(f"Init param's q_n {self.q_n} not supported, should be int type", type is {type(self.q_n)})

        if self.q_n < 0:
            raise ValueError(f"param's q_n {self.q_n} not supported, should be non-negative int value")
        elif self.q_n > 16:
            raise ValueError(f"param's q_n {self.q_n} not supported, should be less than or equal to 16")
__init__(self, sum_cols=None, q_n=6) special
Source code in federatedml/param/feldman_verifiable_sum_param.py
def __init__(self, sum_cols=None, q_n=6):
    self.sum_cols = sum_cols
    if sum_cols is None:
        self.sum_cols = []

    self.q_n = q_n
check(self)
Source code in federatedml/param/feldman_verifiable_sum_param.py
def check(self):
    if isinstance(self.sum_cols, list):
        for idx in self.sum_cols:
            if not isinstance(idx, int):
                raise ValueError(f"type mismatch, column_indexes with element {idx}(type is {type(idx)})")

    if not isinstance(self.q_n, int):
        raise ValueError(f"Init param's q_n {self.q_n} not supported, should be int type", type is {type(self.q_n)})

    if self.q_n < 0:
        raise ValueError(f"param's q_n {self.q_n} not supported, should be non-negative int value")
    elif self.q_n > 16:
        raise ValueError(f"param's q_n {self.q_n} not supported, should be less than or equal to 16")

Last update: 2021-12-03
Back to top