Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement