secure_learning.utils.data_permutator¶
Contains class used for data permutations
Classes¶
Class for performing data permutations. |
Module Contents¶
- class secure_learning.utils.data_permutator.SecureDataPermutator(secure_permutations: bool, seed: int | None = None)[source]¶
Class for performing data permutations.
- Parameters:
secure_permutations – If True, perform permutations collaboratively using a secure permutation protocol. If False perform local permutations based on a shared random seed
seed – Set the random seed. A shared seed can be generated using the refresh_seed method
- permute_data: Callable[[tno.mpc.mpyc.secure_learning.utils.types.SeqMatrix[tno.mpc.mpyc.secure_learning.utils.types.SecNumTypesTV]], tno.mpc.mpyc.secure_learning.utils.types.Matrix[tno.mpc.mpyc.secure_learning.utils.types.SecNumTypesTV]][source]¶
- property seed: int[source]¶
Seed used for randomness.
- Raises:
SecureLearnValueError – Seed has not been set
- Returns:
Seed used for randomness
- static secure_data_permutation(matrix: tno.mpc.mpyc.secure_learning.utils.types.SeqMatrix[tno.mpc.mpyc.secure_learning.utils.types.SecNumTypesTV]) tno.mpc.mpyc.secure_learning.utils.types.Matrix[tno.mpc.mpyc.secure_learning.utils.types.SecNumTypesTV][source]¶
Permute the rows of the provided matrix using a secure permutation protocol.
- Parameters:
matrix – Matrix to be permuted
- Returns:
Matrix with shuffled rows
- insecure_data_permutation(matrix: tno.mpc.mpyc.secure_learning.utils.types.SeqMatrix[tno.mpc.mpyc.secure_learning.utils.types.SecNumTypesTV]) tno.mpc.mpyc.secure_learning.utils.types.Matrix[tno.mpc.mpyc.secure_learning.utils.types.SecNumTypesTV][source]¶
Locally permute the rows of the provided matrix based on a shared random seed.
- Parameters:
matrix – Matrix to be permuted
- Raises:
SecureLearnValueError – Seed has not been set
- Returns:
Matrix with shuffled rows