Skip to content

Instantly share code, notes, and snippets.

@andreaschandra
Last active May 14, 2018 10:48
Show Gist options
  • Save andreaschandra/268c632cf81d3c6592b566c01ffd4654 to your computer and use it in GitHub Desktop.
Save andreaschandra/268c632cf81d3c6592b566c01ffd4654 to your computer and use it in GitHub Desktop.
import libraries
bucket = <your-bucket>
prefix = 'topic-kmeans'
import warnings
warnings.simplefilter("ignore")
import os
import boto3
import sagemaker
import numpy as np
import mxnet as mx
from sagemaker import get_execution_role
from sagemaker.amazon.common import numpy_to_record_serializer
from time import time
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.cluster import KMeans
from sklearn import metrics
# Define IAM role
role = get_execution_role()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment