# USEncrypt® Tutorials#

Packaged with the USEncrypt® library, we have the developed a series of tutorials in the form of Jupyter notebooks, demonstrating use cases for the library across a spectrum of areas.

You can find these libraries in the `tutorials`

subdirectory in the source code for the library.

## Getting Started#

**USEncrypt®: Getting Started****File:**`usencrypt_getting_started.ipynb`

The basics of using the USEncrypt® library with Python. Here you can find encryption/decryption examples, simple operations with encrypted values, and simple problems with solutions to display use cases for encrypted operator computing (EOC).

**USEncrypt®: Operation Benchmarks****File:**`usencrypt_benchmarks.ipynb`

Tests that measure the runtime of functions that operate on data encrypted with the USEncrypt® library. For each operation, a simple function is defined to test their runtimes with the given sample size.

**USEncrypt®: Encrypted Boolean Operations****File:**`usencrypt_boolean_ops.ipynb`

A few examples of boolean functions running on data encrypted with the USEncrypt® library.

**USEncrypt®: Encrypted String Operations****File:**`usencrypt_string_ops.ipynb`

An introduction for using strings encrypted with the USEncrypt® library.

**USEncrypt®: Encrypted String Sorting****File:**`usencrypt_string_sorting.ipynb`

An example of sorting a list of strings encrypted with the USEncrypt® library.

## AI/ML Use Cases#

**Classifying Iris Flower Species with USEncrypt.ai****File:**`usencrypt_ai_nn_iris.ipynb`

In this tutorial, we explore how to use the USEncrypt.ai library to train and evaluate an encrypted neural network for classification with a version of the Iris flower dataset encrypted with USEncrypt®. The results are then compared with a baseline non-encrypted version of the model, showcasing the capabilities of USEncrypt.ai.

**Analyzing Diabetes Patient Progression with Encrypted Linear Regression****File:**`usencrypt_linear_regression.ipynb`

This notebook presents the use of the classic linear regression machine learning algorithm working with encrypted data. Here we take a version of Scikit-Learn’s diabetes patient dataset encrypted with the USEncrypt® library and use our linear regression algorithm implemented with Python’s NumPy library. The results then show a comparison in performance between fitting a regression model with the regular non-encrypted diabetes patient dataset and its encrypted version, successfully demonstrating it working with encrypted data.

**Exploring Convolution and Max-Pooling on Encrypted Images****File:**`usencrypt_conv_pool.ipynb`

This notebook presents both the convolution and max-pooling algorithms (which are the building blocks for convolutional neural networks in computer vision applications) working with encrypted data. Here we take a sample from the MNIST digits dataset, encrypt it with the USEncrypt® library, and perform convolution with a Gaussian blur filter and max-pooling. The results then show a comparison in performance between these algorithms used on the regular non-encrypted MNIST sample and its encrypted version, successfully demonstrating these two building blocks working properly.

**Predicting Encrypted MNIST Digits with Trained Convolutional Neural Network****File:**`usencrypt_mnist_pred.ipynb`

This notebook presents the prediction of an encrypted MNIST digit with using a trained convolutional neural network. Here we take a sample from the MNIST digits dataset, encrypt it with the USEncrypt® library, and predict its label with our trained model. The results then show successful neural network prediction using image data.

**Classifying Small Digit Images with an Encrypted Neural Network****File:**`usencrypt_neural_net_digits.ipynb`

This notebook presents the training and evaluation of Scikit-Learn’s digits dataset with an encrypted neural network. Here we take the digits dataset, encrypt it with the USEncrypt® library, train a neural network for classification, and evaluate it. This notebook then shows an example of the evaluation of the dataset (both encrypted and non-encrypted), and compares their performance.

**Assessing Bank Credit Risk with k-Means Clustering****File:**`usencrypt_kmeans_credit.ipynb`

This notebook presents the analysis of encrypted financial data using the \(k\)-means clustering algorithm. Here we take the German Credit Risk dataset, encrypt it with the USEncrypt® library, and cluster it using our implementation of \(k\)-means clustering. The results then show successful clustering using encrypted financial data.

## Compatibility with Other Libraries#

**USEncrypt® + NumPy: Basic Operations****File:**`usencrypt_numpy_basics.ipynb`

A collection of basic NumPy operations available for encrypted data, showcasing the USEncrypt® + NumPy compatibility.

**USEncrypt® + NumPy: Advanced Operations****File:**`usencrypt_numpy_advanced.ipynb`

A collection of advanced NumPy array and matrix operations available for encrypted data, showcasing the USEncrypt® + NumPy compatibility.

**USEncrypt® + Pandas: Basic Operations****File:**`usencrypt_pandas_basics.ipynb`

A collection of basic overloaded Pandas operations available for encrypted data, showcasing the USEncrypt® + Pandas compatibility, particularly encrypted

`DataFrame`

objects.

**USEncrypt® + Pandas: Encrypted DataFrame Search****File:**`usencrypt_pandas_search.ipynb`

An example showing how to perform a simple search on a Pandas

`DataFrame`

encrypted with the USEncrypt® library, further showcasing the benefits of the USEncrypt® + Pandas compatibility.

**USEncrypt® + Pandas: Getting Averages****File:**`usencrypt_pandas_averages.ipynb`

A simple example working with a Pandas

`DataFrame`

encrypted with the USEncrypt® library. Using USEncrypt®, Pandas, and NumPy, we are able to easily manipulate the encrypted sample Height-Weight to find the mean height and weight for each category.