Skip to content

Instantly share code, notes, and snippets.

@harishkashyap
Created January 28, 2023 07:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harishkashyap/c1dc3f5194a0f15586dec6138b52012b to your computer and use it in GitHub Desktop.
Save harishkashyap/c1dc3f5194a0f15586dec6138b52012b to your computer and use it in GitHub Desktop.
pandita endpoint for risk
import boto3
import datetime
import time
import tarfile
import boto3
import pandas as pd
import sagemaker
from sagemaker import sklearn, get_execution_role
sm_boto3 = boto3.client("sagemaker")
sess = sagemaker.Session()
region = sess.boto_session.region_name
bucket = sess.default_bucket()
quality_map = {0: 0.9636, 1: 0.9589, 2: 0.9775}
cost_map = {0: 0.03049, 1: 0.015, 2: 0.01339}
print("validating model")
risk_type = 'RISK_VAL'
X = ['france-uber', cost_map, quality_map, [60, 30], risk_type]
# Instantiate a predictor object
predictor = sklearn.model.SKLearnPredictor(
endpoint_name="sagemaker-scikit-learn-2023-01-28-05-31-02-930",
sagemaker_session=sess)
# Invoke the endpoint
predictions = predictor.predict(X)
print(predictions)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment