Spectral
Ask or search…
K

Spectral Python SDK

Introduction

Spectral Python SDK is a tool designed to streamline the real-time data fetching process for the purpose of submission. For instance, the SDK can be used to receive real-time feature values for your test set, in order to make predictions on the test set (based on your trained model) and successfully submit.
To install, run:
pip install spectral-datawrappers

Spectral API Key

Spectral API Key is needed to access Spectral's online data services. This can be found in two ways.
  1. 1.
    Your Profile page on Spectral App
  2. 2.
    spectral-cli show-configuration
The command above works assuming you have configured your Spectral CLI already. Refer to Step 5 of Modeler Handbook if you have not done so.

Usage

Challenge 1

In order to request Credit Scoring features within Jupyter notebook, instantiate the CreditScoringWrapper client and use the method request.

Request:

from spectral_datawrappers.credit_scoring.credit_scoring_wrapper import CreditScoringWrapper
config = {'spectral_api_key': VALID_API_KEY}
client = CreditScoringWrapper(config)
request_input = {"wallet_address": "0x123456789"}
client.request(request_input)

Response:

{
"wallet_address": "0x123456789",
"features": {
"feature0": "value_feature0",
"feature1": "value_feature1",
}
}