Quickstart

Getting access

To use the Neuralk Cloud API, you need an API key. Run the following command to get started:

neuralk login

This will display instructions and a link to create your account at:

https://prediction.neuralk-ai.com/register

Your API key will be generated upon registration. It looks like nk_live_xxxxxxxxxxxx.

Installation

The Neuralk SDK is available on PyPI and can be installed using pip:

pip install neuralk

Verifying your installation

You can verify that the Neuralk package was installed correctly:

python -c "import neuralk; print('Neuralk imported successfully')"

Setting up your API key

You can provide your API key in two ways:

Option 2: Pass directly to the classifier

from neuralk import NICLClassifier

clf = NICLClassifier(api_key="nk_live_your_api_key_here")

Your first prediction

Here’s a simple example to verify everything is working:

import time
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from neuralk import NICLClassifier

# Generate sample data
X, y = make_classification(random_state=0, n_samples=1_000, n_features=10)
X_train, X_test, y_train, y_test = train_test_split(X, y)

# Create and use the classifier
start = time.monotonic()
clf = NICLClassifier()  # Uses NEURALK_API_KEY environment variable
clf.fit(X_train, y_train)
predictions = clf.predict(X_test)
elapsed = time.monotonic() - start

print(f"Fit & predict took {elapsed:.1f}s")
print(f"Accuracy: {accuracy_score(y_test, predictions):.2%}")

Save this as quickstart.py and run:

python quickstart.py

You should see the accuracy score printed after a few moments.

On-premise deployment

For on-premise deployments, use the host parameter instead of an API key:

from neuralk import NICLClassifier

clf = NICLClassifier(host="http://your-server:8000")
clf.fit(X_train, y_train)
predictions = clf.predict(X_test)

Next steps