class CheckPerformanceSuite extends FunSuite {
test("check the performance") {
var start = System.currentTimeMillis()
val vectors = (1 to 3000000).map { i => Vectors.dense(Math.random(), -1 * Math.random(), Math.random())}
var end = System.currentTimeMillis()
println(s"Time for Creating: ${end - start}")
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
merge(x=data.frame.x, y=data.frame.y | |
, by.x=c("clm1", "clm2") | |
, by.y=c("clm1", "clm2") | |
) |
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
#!/bin/sh | |
# one way (older scala version will be installed) | |
# sudo apt-get install scala | |
#2nd way | |
sudo apt-get remove scala-library scala | |
wget www.scala-lang.org/files/archive/scala-2.10.3.deb | |
sudo dpkg -i scala-2.10.3.deb | |
sudo apt-get update |
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 breeze.generic.UFunc | |
import breeze.linalg.{sum, DenseVector => DBV, Vector => BV} | |
import breeze.macros.expand | |
object distance extends UFunc { | |
val DEFAULT_METHOD = "euclidean" | |
@expand | |
@expand.valify |
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 breeze.linalg.functions | |
import breeze.generic.UFunc | |
import breeze.linalg.{SparseVector, DenseVector} | |
import breeze.numerics.sqrt | |
/** | |
* A weighted Euclidean distance function implementation | |
*/ | |
object weightedEuclideanDistance extends UFunc { |
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
/** | |
* bisecting <master> <input> <nNodes> <subIterations> | |
* | |
* divisive hierarchical clustering using bisecting k-means | |
* assumes input is a text file, each row is a data point | |
* given as numbers separated by spaces | |
* | |
*/ | |
import org.apache.spark.SparkContext |
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
using Distributions | |
export Measure, DiscreteMeasure, Estimator, EstimatorQuality, | |
blb, randsubset | |
abstract Measure | |
type DiscreteMeasure{S<:Number,T<:Number} <: Measure | |
points :: Vector{S} | |
weights :: Vector{T} |
- What is the problem of my SparkR's code?
- How do we deal with array:
c()
and list:list()
for an arguments to call Java method?
https://github.com/yu-iskw/spark/commit/e2852699b5b76c11d70f9c061729231f72f094a9
if (!require(pkg)){
install.packages(pkg)
}
if ("somepackage" %in% row.names(installed.packages()) == FALSE)
install.packages("somepackage")
OlderNewer