Skip to main content

A restful client library, designed to access predictnow restful api.

Project description

Usage:

from predictnow.pdapi import PredictNowClient import pandas as pd api_key = "%KeyProvidedToEachOfOurSubscriber" 

api_host = "http://%VMIP%"  # current makeshift api host username = "helloWorld" email = "helloWorld@yourmail.com"

client = PredictNowClient(api_host,api_key)

You will need to edit this input dataset file path and labelname!

file_path = 'my_amazing_features.xlsx' labelname = 'Next_day_strategy_return' import os

For classification problems

params = {'timeseries': 'yes', 'type': 'classification', 'feature_selection': 'shap', 'analysis': 'none', 'boost': 'gbdt', 'testsize': '0.2', 'weights': 'no', 'eda': 'yes', 'prob_calib': 'no', 'mode': 'train'}

For regression problems, suitable for CPO

params = {'timeseries': 'yes', 'type': 'regression', 'feature_selection': 'none', 'analysis': 'none', 'boost': 'gbdt', 'testsize': '0.2', 'weights': 'no', 'eda': 'yes', 'prob_calib': 'no', 'mode': 'train'}

response = client.create_model( username=username, model_name="test1", params=params )

from pandas import read_excel df = read_excel(file_path, engine="openpyxl")  # Same here df.name = "testdataframe"  # Optional, but recommended

########## TRAIN MODE ################################### response = client.train( model_name="test1", input_df=df, label=labelname, username=username, email=email)

status = client.getstatus(      username=username,     train_id=response["train_id"] )

if status["state"] == "COMPLETED":

response = client.getresult(
model_name="test1",
username=username,
)
predicted_targets_cv = pd.read_json(response.predicted_targets_cv)
print("predicted_targets_cv")
print(predicted_targets_cv)

predicted_targets_test = pd.read_json(response.predicted_targets_test)
print("predicted_targets_test")
print(predicted_targets_test)

if response.feature_importance:
	feature_importance = pd.read_json(response.feature_importance)
	print("feature_importance")
	print(feature_importance)


performance_metrics = pd.read_json(response.performance_metrics)
print("performance_metrics")
print(performance_metrics)

########## LIVE MODE ################################### if status["state"] == "COMPLETED": df = read_csv("example_input_live.csv") # live input data df.name = "myfirstpredictname"  # optional, but recommended # Making live predictions response = client.predict( model_name="test1", input_df=df,username=username, eda="yes", prob_calib=params["prob_calib"], ) y_pred = pd.read_json(response.labels) print("THE LABELS") print(y_pred)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

predictnow-client-0.0.9.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

predictnow_client-0.0.9-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file predictnow-client-0.0.9.tar.gz.

File metadata

  • Download URL: predictnow-client-0.0.9.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for predictnow-client-0.0.9.tar.gz
Algorithm Hash digest
SHA256 4a9c682c384e44f8ada2398aeea89e1b4f0756261f04c000b65094cd7e345aca
MD5 7b4c07b6d03ab796ae8ec6a1295ccba4
BLAKE2b-256 f77247d0691ce3da8444a98c0e261b3b0dd7fec8f47ba961d402e2d97b2dda2c

See more details on using hashes here.

File details

Details for the file predictnow_client-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: predictnow_client-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for predictnow_client-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 c58ce27ec47fac3ab1b0933bed0ea05699834e2efa3bfe5ad9b70f1b56feba7f
MD5 3975983ba5adead92f55ff84b531d5a8
BLAKE2b-256 c72b5bdc663d6db40e026c92bb43e139b3c13d086aa9769512e930987f2a37d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page