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
$.ajax({ | |
type: "POST", | |
url: "https://a3bqc81dv1.execute-api.us-east-2.amazonaws.com/test/myLambdaFunction", | |
data: JSON.stringify({'hyperparmeter_1': 0, 'hyperparameter_2': 0,'data': csv_text}), | |
contentType: 'text/plain', | |
success: function(success){ | |
console.log(success); | |
}, | |
error: function(error){ | |
console.log(error) |
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'] | |
# grab runtime client |
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 = 'anomaly-detection-endpoint' | |
anomaly_detection.deploy(initial_instance_count=1, | |
instance_type='ml.t2.medium', | |
endpoint_name=endpoint_name) | |
# Delete endpoint when you don't need your model deployed | |
sm.delete_endpoint(EndpointName=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
anomaly_detection.fit() |
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
sess = sagemaker.session.Session() | |
anomaly_detection = sagemaker.estimator.Estimator(image_name=docker_image_name, | |
role=role, | |
train_instance_count=1, | |
train_instance_type='ml.m4.xlarge', | |
output_path='s3://{}/{}/output'.format(bucket, prefix), | |
base_job_name="anomaly-detection", | |
sagemaker_session=sess) |
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
# Install sagemaker (version 1.72) | |
import sys | |
!{sys.executable} -m pip install --quiet sagemaker==1.72 -U | |
# Imports | |
import io | |
import os | |
import sys | |
import time | |
import json |
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
prefix = '/opt/ml/' | |
input_path = prefix + 'input/data' | |
output_path = os.path.join(prefix, 'output') | |
model_path = os.path.join(prefix, 'model') | |
# The function to execute the training. | |
def train(): | |
print('\nStarting the training.') | |
with open(os.path.join(model_path, 'model'), 'w') as f: |
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
For example, say rule_requests = ['moviename', 'starttime', 'city'], length: 3 | |
Round 1: | |
rule_current_slot_index = 0 (< 3) | |
| | |
[request 'moviename', request 'starttime', request 'city', mach_found, done] | |
Round 2: | |
rule_current_slot_index = 1 (< 3) | |
| |
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
# Agent action examples: | |
{'intent': 'request', 'inform_slots': {}, 'request_slots': {'theater': 'UNK'}} | |
{'intent': 'inform', 'inform_slots': {'moviename': 'the witch'}, 'request_slots': {}} | |
{'intent': 'done', 'inform_slots': {}, 'request_slots': {}} | |
# User action examples: | |
{'intent': 'request', 'inform_slots': {'city': 'seattle'}, 'request_slots': {'theater': 'UNK', 'starttime': 'UNK'}} | |
{'intent': 'inform', 'inform_slots': {'moviename': 'the witch'}, 'request_slots': {}} | |
{'intent': 'done', 'inform_slots': {}, 'request_slots': {}} | |
{'intent': 'request', 'inform_slots': {}, 'request_slots': {'moviename': 'UNK'}} |
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
{'intent': 'request', 'inform_slots': {'city': 'seattle'}, 'request_slots': {'theater': 'UNK', 'starttime': 'UNK'}} | |
{'intent': 'inform', 'inform_slots': {'moviename': 'the witch'}, 'request_slots': {}} | |
{'intent': 'done', 'inform_slots': {}, 'request_slots': {}} | |
{'intent': 'request', 'inform_slots': {}, 'request_slots': {'moviename': 'UNK'}} | |
{'intent': 'thanks', 'inform_slots': {}, 'request_slots': {'theater': 'UNK'}} |
NewerOlder