Once we've done that, we may move the previous main() into a different function, leaving ourselves with a blank canvas for main() again. We're now ready for the meat of the program. This is a skeleton program. You're encouraged to actually actively change the program while writing this:
func main() {
f, err := os.Open("dev.json")
dieIfErr(err)
tweets := load(f)
p := newProcessor()
tweets = p.process(tweets)
expC := 20
distances, last := knn(asMatrix(tweets), expC, clusters.EuclideanDistance)
log.Printf("distances %v | %v", distances, last)
// plot for DBSCAN elbows
plt, err := plot.New()
dieIfErr(err)
plotutil.AddLinePoints(plt, "KNN Distance", plotKNNDist(last))
plt.Save(25*vg.Centimeter, 25*vg.Centimeter, "KNNDist.png")
// actually do the clustering
dmmClust := dmm(tweets, expC, p.corpus.Size())
kmeansClust :=...