Created
July 6, 2019 13:47
-
-
Save RoaldSchuring/f69f60a3b82b329156f47e2850d7f643 to your computer and use it in GitHub Desktop.
Running SKLearn script in 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
from sagemaker.sklearn.estimator import SKLearn | |
script_path = 'sklearn_nearest_neighbors.py' | |
sess = sagemaker.Session() | |
# run the Scikit-Learn script | |
sklearn = SKLearn( | |
entry_point=script_path, | |
train_instance_type="ml.m5.large", | |
role=role, | |
sagemaker_session=sess, | |
hyperparameters={'n_neighbors': 10, 'metric': 'cosine'}) | |
sklearn.fit({'train': 's3://data-science-wine-reviews/nearest_neighbors/data/wine_review_vectors.csv'}) | |
# deploy the model to a SageMaker endpoint | |
predictor = sklearn.deploy(initial_instance_count=1, instance_type="ml.m5.large") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment