예제 #1
0

tuner = HyperparameterTuner(estimator,
                            objective_metric_name,
                            hyperparameter_ranges,
                            metric_definitions,
                            max_jobs=9,
                            max_parallel_jobs=3,
                            objective_type=objective_type)


#Launching the tuning job
tuner.fit({'training': inputs})

#Creating endpoint
predictor = tuner.deploy(initial_instance_count=1, instance_type='ml.m4.xlarge')

#Evaluate
from IPython.display import HTML
HTML(open("input.html").read())

import numpy as np

image = np.array([data], dtype=np.float32)
response = predictor.predict(image)
prediction = response.argmax(axis=1)[0]
print(prediction)

#Cleanup
tuner.delete_endpoint()