The distribution called itself torus-ml while shipping a package directory named concrete, so the name a user installs and the name they import disagreed — and most of the tree already said torus.ml, which could not resolve against src/concrete. Moved src/concrete to src/torus and pointed the include at it. The dependency was Zama's concrete-python from their index. It is torus-fhe from ours, which is what luxfhe/torus already ships: that frontend declares torus-fhe and ships a torus/fhe module, so every 'from torus.fhe' in this tree was already naming our compiler and only the dependency lagged. Two distributions share one namespace, which is the shape the upstream this forked from used and the reason the split works: torus-fhe gives torus.fhe, torus-ml gives torus.ml. Swept every other spelling — identifiers, enum members, workflow variables, filenames, notebooks. LICENSE and NOTICE keep the upstream attribution a fork owes; the figures carry the old name in JPEG metadata a text sweep cannot reach.
7.4 KiB
module torus.ml.pandas.dataframe
Define the encrypted data-frame framework.
Global Variables
- ZIP_STORED
class EncryptedDataFrame
Define an encrypted data-frame framework that supports Pandas operators and parameters.
method __init__
__init__(
encrypted_values: ndarray,
encrypted_nan: Value,
evaluation_keys: EvaluationKeys,
column_names: List[str],
dtype_mappings: Dict,
api_version: int
)
property api_version
Get the API version used when instantiating this instance.
Returns:
int: The data-frame's API version.
property column_names
Get the data-frame's column names in order.
Returns:
List[str]: The data-frame's column names in order.
property column_names_to_position
Get the mapping between each column's name and its index position.
Returns:
Dict[str, int]: Mapping between column names and their position.
property dtype_mappings
Get the mappings for non-integer dtypes used in pre and post-processing.
Returns:
Dict: The mappings for non-integers dtypes.
property encrypted_nan
Get the encrypted value representing a NaN.
Returns:
fhe.Value: The encrypted representation of a NaN.
property encrypted_values
Get the encrypted values.
Returns:
numpy.ndarray: The array containing all encrypted values.
property evaluation_keys
Get the evaluation keys.
Returns:
fhe.EvaluationKeys: The evaluation keys.
method get_schema
get_schema() → DataFrame
Get the encrypted data-frame's scheme.
The scheme can include column names, dtypes or dtype mappings. It is displayed as a Pandas data-frame for better readability.
Returns:
pandas.DataFrame: The encrypted data-frame's scheme.
classmethod load
load(path: Union[Path, str])
Load an encrypted data-frame from disk.
Args:
path(Union[Path, str]): The path where to load the encrypted data-frame.
Returns:
EncryptedDataFrame: The loaded encrypted data-frame.
method merge
merge(
other,
how: str = 'left',
on: Optional[str] = None,
left_on: Optional[Hashable, Sequence[Hashable]] = None,
right_on: Optional[Hashable, Sequence[Hashable]] = None,
left_index: bool = False,
right_index: bool = False,
sort: bool = False,
suffixes: Tuple[Optional[str], Optional[str]] = ('_x', '_y'),
copy: Optional[bool] = None,
indicator: Union[bool, str] = False,
validate: Optional[str] = None
)
Merge two encrypted data-frames in FHE using Pandas parameters.
Note that for now, only a left and right join is implemented. Additionally, only some Pandas parameters are supported, and joining on multiple columns is not available.
Pandas documentation for version 2.0 can be found here: https://pandas.pydata.org/pandas-docs/version/2.0/reference/api/pandas.DataFrame.merge.html
Args:
other(EncryptedDataFrame): The other encrypted data-frame.how(str): Type of merge to be performed, one of {'left', 'right'}.* left: use only keys from left frame, similar to a SQL left outer join; preserve key order.* right: use only keys from right frame, similar to a SQL right outer join; preserve key order.on(Optional[str]): Column name to join on. These must be found in both DataFrames. If it is None then this defaults to the intersection of the columns in both DataFrames. Default to None.left_on(Optional[Union[Hashable, Sequence[Hashable]]]): Currently not supported, please keep the default value. Default to None.right_on(Optional[Union[Hashable, Sequence[Hashable]]]): Currently not supported, please keep the default value. Default to None.left_index(bool): Currently not supported, please keep the default value. Default to False.right_index(bool): Currently not supported, please keep the default value. Default to False.sort(bool): Currently not supported, please keep the default value. Default to False.suffixes(Tuple[Optional[str], Optional[str]]): A length-2 sequence where each element is optionally a string indicating the suffix to add to overlapping column names inleftandrightrespectively. Pass a value ofNoneinstead of a string to indicate that the column name fromleftorrightshould be left as-is, with no suffix. At least one of the values must not be None.. Default to ("_x", "_y").copy(Optional[bool]): Currently not supported, please keep the default value. Default to None.indicator(Union[bool, str]): Currently not supported, please keep the default value. Default to False.validate(Optional[str]): Currently not supported, please keep the default value. Default to None.
Returns:
EncryptedDataFrame: The joined encrypted data-frame.
method save
save(path: Union[Path, str])
Save the encrypted data-frame on disk.
Args:
path(Union[Path, str]): The path where to save the encrypted data-frame.