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 computations are run on the KXY backend and require an API key. The API key is set by running the command

kxy configure

as a one-off, and following the instructions.

You may also set your API key as the KXY_API_KEY environment variable, for instance by running

import os
os.environ['KXY_API_KEY'] = '<API Key>'

To get an API key, you need to have an account with us. You can create an account here.

By default, you will start in the free Starter plan, and you will be able to experience the KXY backend from the portal for free, and without providing a payment method, by uploading your data as csv files.

Once you have an account and are ready to use our API, you can find your API key on the KXY portal here.

API access to our backend is billed on a per-request basis, and requires that you provide a valid payment method in the KXY portal.

Docker

The public Docker image kxytechnologies/kxy has been built for your convenience, and comes with anaconda, the kxy package, and various popular machine learning packages (e.g. Tensorflow, XGBoost, LightGBM, scikit-learn, and more).

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.

Serverless Applications

For serverless applications running on AWS, we provide a kxy AWS Lambda layer so that you may simply import the kxy package from within your AWS Python 3 lambda functions. No additional requirement is needed, other than specifying your API key as the environment variable KXY_API_KEY.

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 Cheat Sheet section for code snippets, the Case Studies section for interesting applications, and the Kaggle & UCI Experiments section for experiments on dozens of UCI and Kaggle datasets.

Working with the Low Level RESTFul API

We intend to provide user-friendly API clients in other programming languages (e.g. R, Ruby and JavaScript). For now, if you are working in a programming language other than Python, you may directly access our serverless compute infrastructure through its RESTFul API. Take a look at our RESTFul API documentation page for more details.