Getting Started

Click here to download this page as a Jupyter Notebook.

Installation

From PyPi:

pip install kxy

From GitHub:

git clone https://github.com/kxytechnologies/kxy-python.git & cd ./kxy-python & pip install .

The kxy package only supports Python 3. Replace pip by pip3 in the commands above, as needed.

Authentication

All heavy-duty computations, including but not limited to solving any maximum-entropy optimization problem, are run on our serverless infrastructure and require an API key. The API key is set by running the command

kxy configure

as a one-off, and following the instructions.

To request a demo and get a trial API key, email demo@kxy.ai.

Docker

The public Docker image kxytechnologies/kxy has been built for your convenience, and comes with anaconda, auto-sklearn, and the kxy package.

To start a Jupyter Notebook server from a sandboxed Docker, run

docker run -i -t -p 5555:8888 kxytechnologies/kxy /bin/bash -c "kxy configure <YOUR API KEY> && /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser --allow-root --NotebookApp.token=''"

where you should replace <YOUR API KEY> with your API key and navigate to http://localhost:5555 in your browser.

To start a Jupyter Notebook server from an existing directory of notebooks, run

docker run -i -t --mount src=</path/to/your/local/dir>,target=/opt/notebooks,type=bind -p 5555:8888 kxytechnologies/kxy /bin/bash -c "kxy configure <YOUR API KEY> && /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser --allow-root --NotebookApp.token=''"

where you should replace </path/to/your/local/dir> with the path to your local notebook folder and navigate to http://localhost:5555 in your browser.

Working with Pandas DataFrames

The most convenient way of using the kxy package is through pandas DataFrame objects. All our analyses are available as methods of pandas DataFrame objects, under the kxy accessor (i.e. as df.kxy.<method_name>). To access these, all you need is to import the kxy package alongside pandas.

In [1]:
import pandas as pd
import kxy

Checkout the Examples section for tutorials with code snippets.

Working with Numpy Arrays

If you prefer working with numpy arrays, you might want to familiarize yourself with methods in the lower level namespaces

and/or the higher level namespaces

depending on your usecase.

Working with the Low Level RESTFul API

To directly access our serverless compute infrastructure through its RESTFul API take a look at kxy.api.client.APIClient.