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
// transcribed from an Apache Spark 1.0 spark-shell session | |
// using data from http://chriswhong.com/open-data/foil_nyc_taxi/ | |
// and the QTree algorithm for approximate quantiles over large datasets | |
// each of the distanceRange and minutesRange calculations below takes about 15 minutes on my four-core SSD-based Macbook Pro | |
import com.twitter.algebird._ | |
import com.twitter.algebird.Operators._ | |
implicit val qtSemigroupD = new QTreeSemigroup[Double](6) | |
val in = sc.textFile("trip_data") // a directory containing all the trip_data*.csv files downloaded from the above link |
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
#!/usr/bin/ruby | |
class IPGenerator | |
public | |
def initialize(session_count, session_length) | |
@session_count = session_count | |
@session_length = session_length | |
@sessions = {} | |
end |
NewerOlder