Created
January 28, 2023 07:10
-
-
Save harishkashyap/c1dc3f5194a0f15586dec6138b52012b to your computer and use it in GitHub Desktop.
pandita endpoint for risk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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