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 pandas_profiling | |
data.profile_report().to_file("pandas_profile_report.html") |
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
eda=sv.analyze([data,"Data"],target_feat='Occupancy') | |
eda.show_html() |
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 sweetviz as sv | |
sweetviz_eda=sv.analyze(data) | |
sweetviz_eda.show_html() |
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
if __name__ == '__main__': | |
app.run(host='0.0.0.0') |
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 numpy as np | |
import pandas as pd | |
from flask import Flask, request, jsonify, render_template | |
import pickle | |
app = Flask(__name__,template_folder='templates') | |
model = pickle.load(open('model.pkl', 'rb')) | |
@app.route('/') |
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 os | |
import io | |
import boto3 | |
import json | |
import csv | |
# grab environment variables | |
ENDPOINT_NAME = os.environ['ENDPOINT_NAME'] | |
runtime= boto3.client('runtime.sagemaker') |
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
endpoint_name = sess.endpoint_from_job( | |
job_name=job_name, | |
initial_instance_count=1, | |
instance_type='ml.m4.xlarge', | |
deployment_image=image_name, | |
role=role | |
) | |
print ('endpoint name: {0}'.format(endpoint_name)) |
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
estimator.fit({'train':s3_input_train,'validation':s3_input_validation}) |
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
estimator.set_hyperparameters(alpha=1.448983,colsample_bytree=0.6897649,eta=0.246274,gamma=0.546408,lamda=0.0003157054, | |
max_depth=18,min_child_weight=0.00282088,num_class=3,num_round=8, objective='multi:softmax',subsample=0.538571908) |
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
base_job_name='iris-lamba-api' | |
from sagemaker.amazon.amazon_estimator import get_image_uri | |
image_name = get_image_uri(boto3.Session().region_name, 'xgboost') | |
estimator = sagemaker.estimator.Estimator( | |
sagemaker_session=sess, | |
image_name=image_name, | |
role=role, | |
train_instance_count=1, |