Skip to content

Commit

Permalink
docs: database schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-stoian-zama committed Jun 17, 2024
1 parent ee36852 commit 0850606
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/built-in-models/encrypted_dataframe.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ df_decrypted = client.decrypt_to_pandas(df_encrypted)
- **Quantized Float**: Floating-point numbers are quantized to integers within the supported range. This is achieved by computing a scale and zero point for each column, which are used to map the floating-point numbers to the quantized integer space.
- **String Enum**: String columns are mapped to integers starting from 1. This mapping is stored and later used for de-quantization. If the number of unique strings exceeds 15, a `ValueError` is raised.

### Using a user-defined schema

Before encryption, pre-processing is applied to the data. For example **string enums** first need to be mapped to integers and floating point values must be quantized. By default, this mapping is done automatically. But, when two different clients encrypt their data separately, the automatic mappings may differ, for example due to some values missing from one of the client's DataFrame. Thus the column can not be be selected for merging encrypted data-frames.

The Encrypted DataFrame supports user-defined mappings. These schemas a are defined as a dictionary where keys represent column names and values contain meta-data about the column. Supported column meta-data are:

- string columns: mapping between string values and integers.
- float columns: the min/max range that the column values lie in.

```python
schema = {
"string_column": {"abc": 1, "bcd": 2 },
"float_column": {"min": 0.1, "max": 0.5 }
}
```

## Supported operations

Encrypted DataFrame is designed to support a subset of operations that are available for pandas DataFrames. For now, only the `merge` operation is supported. More operations will be added in the future releases.
Expand Down

0 comments on commit 0850606

Please sign in to comment.