#from pyspark.mllib.linalg.distributed import RowMatrix
# Boilerplate Spark stuff:
=
=
# Load documents (one per line).
=
=
=
# Store the document names for later:
=
# Now hash the words in each document to their term frequencies:
= #100K hash buckets just to save some memory
=
# At this point we have an RDD of sparse vectors representing each document,
# where each value maps to the term frequency of each unique hash value.
# Let's compute the TF*IDF of each term in each document:
=
=
# Now we have an RDD of sparse vectors, where each value is the TFxIDF
# of each unique hash value for each document.
=
=
#mat = RowMatrix(tfidf)
# Calculate PCA
#pc = mat.computePrincipalComponents(int(mat.numCols))