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
scala> abstract class A { def f : Iterable[String] } | |
defined class A | |
scala> class B extends A { def f = List("foo", "bar") } | |
defined class B | |
scala> class C extends A { val r = math.random; def f = { val v = List("foo", "bar"); if(r < 0.5) v else v.map{_ + "_"} } } | |
defined class C | |
scala> (new B).f |
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
library(tuneR); | |
library(MASS); | |
rate = 10000; | |
width = 2500; | |
zdim = 400; | |
play_vec = function(v) { | |
wnew = Wave(v * 32760/max(abs(v)), right = numeric(0), samp.rate = rate, bit = 16); | |
play(wnew, '/Users/rhall/Downloads/playRWave'); |
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
library(tuneR); | |
rate = 24000; | |
width = 6000; | |
play_vec = function(v) { | |
wnew = Wave(v * 32760/max(abs(v)), right = numeric(0), samp.rate = rate, bit = 16); | |
play(wnew, '/Users/rhall/Downloads/playRWave'); | |
} |
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
scala> abstract class A { def holler : String; println(holler) } | |
defined class A | |
scala> class B extends A { def holler = "holler" } | |
defined class B | |
scala> new B() | |
holler | |
res0: B = B@54011d95 |
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
scala> abstract class A { def holler : String; println(holler) } | |
defined class A | |
scala> class B extends A { def holler = "holler" } | |
defined class B | |
scala> new B() | |
holler | |
res0: B = B@54011d95 |
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 com.etsy.scalding.jobs | |
import com.etsy.scalding._ | |
import com.twitter.scalding._ | |
class Demo(args : Args) extends Job(args) { | |
// best way to compute covariance matrix? | |
// the dimension. | |
val N = 1000; |
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
import com.twitter.scalding._ | |
class Demo(args : Args) extends Job(args) { | |
override def config(implicit mode : Mode) = super.config ++ Map("cascading.aggregateby.threshold" -> "1000000") | |
import com.twitter.scalding.TDsl._ | |
// best way to compute covariance matrix? |
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
n = 500; | |
m = 700; | |
d = 10; | |
X = matrix(data=1*(runif(n*m) < 0.1), nr=n, nc=m); | |
S = matrix(data=rnorm(m*(d+2)), nr=m, nc=(d+2)); | |
XS = X %*% S | |
XX = X %*% t(X); | |
XX2 = XX %*% t(XX); |
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
import org.apache.commons.math3.linear._ | |
import com.twitter.algebird.Operators._ | |
import com.twitter.scalding._ | |
import cascading.pipe.Pipe | |
import cascading.pipe.joiner.InnerJoin | |
import cascading.tuple.Fields | |
object SVD extends Serializable { |
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 com.etsy.scalding.jobs | |
import com.twitter.scalding._ | |
class TouchTheVoid(args : Args) extends Job(args) { | |
// 25M (Long, Double) pairs. | |
val scores = SequenceFile("stuff", ('id, 'score, 'stuff)) | |
.project('id, 'score) |
OlderNewer