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
def printConfusionMatrix(labelAndPred: List[(Int,Int)]) = { | |
// labelAndPred | |
println(" " + (0 until classCount).mkString(" ") + " <- predicted ") | |
println((0 until 2*classCount).map(x => "--").mkString) | |
for(i <- 0 until classCount) { | |
for(j <- 0 until classCount) { | |
// i is actual | |
// j is classified as | |
print(" " + labelAndPred.count{ case (label,pred) => label == i && pred == j }) | |
} |
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
package experiments.old | |
import org.apache.spark.mllib.classification.NaiveBayesModel | |
import org.apache.spark.mllib.evaluation.BinaryClassificationMetrics | |
import org.apache.spark.mllib.linalg.Vector | |
import org.apache.spark.mllib.regression.LabeledPoint | |
import org.apache.spark.rdd.RDD | |
import org.apache.spark.mllib.linalg.Vectors | |
import scala.collection.mutable.ArrayBuffer |
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
/** | |
* Returns the Uri which can be used to delete/work with images in the photo gallery. | |
* @param filePath Path to IMAGE on SD card | |
* @return Uri in the format of... content://media/external/images/media/[NUMBER] | |
*/ | |
private Uri getUriFromPath(String filePath) { | |
long photoId; | |
Uri photoUri = MediaStore.Images.Media.getContentUri("external"); | |
String[] projection = {MediaStore.Images.ImageColumns._ID}; |
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
<?php | |
/** | |
* Simple, not the prettiest method to get your latest 3200 tweets (Twitter imposed limit). Thrown together in 20 minutes, not expected to be the greatest. | |
* Author: Jordan DeLoach (Twitter: @jtmcgee Github: @jdeloach Web: jordandeloach.com) | |
* | |
* Step One (insert your username): | |
* curl -s --user-agent 'Mozilla' --insecure 'https://twitter.com/statuses/user_timeline/YOUR_USERNAME_HERE.xml?count=100&page=[1-32]' >> tweets.txt | |
* | |
* Step Two: |