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
-- Create a new file, which we will call Main.hs | |
main :: IO () | |
main = do | |
let d1 = [3,3,3,4,4,4,5,5,5] | |
let d2 = [1,1,2,2,3,4,4,5,5] | |
let r = pearson d1 d2 | |
print r | |
pearson xs ys = (n * sumXY - sumX * sumY) / |
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
$ mkdir vm-install | |
$ cd vm-install | |
$ vagrant init chef/centos-7.0 | |
Edit the Vagrantfile to uncomment the line with | |
$ config.vm.network "private_network", ip: "192.168.33.10" | |
and add the line | |
$ config.vm.hostname = "node1" | |
$ config.vm.provider "virtualbox" do |vb| | |
# # Display the VirtualBox GUI when booting the machine |
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 scalaz.\/ | |
import scalaz.syntax.either._ | |
object Example2 { | |
// This example simulates error handling for a simple three tier web application | |
// | |
// The tiers are: | |
// - the HTTP service | |
// - a user authentication layer | |
// - a database layer |
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.typed.{IterablePipe} | |
import com.twitter.scalding._ | |
/** | |
* 1) sbt | |
* 2) project <project-name> | |
* 3) run-main ExecutionAppSample --local | |
* 4) See output in out.csv | |
*/ | |
object ExecutionAppSample extends ExecutionApp { |
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._ | |
import com.twitter.scalding.typed.IterablePipe | |
/** | |
* Run this from the scalding Tool or other executor | |
* | |
* @param args | |
*/ | |
class ExecutionJobSample(args: Args) extends ExecutionJob(args) { |
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
-- Computing the moving average | |
main = do | |
rawInput <- readFile "input.txt" | |
let input = clean rawInput | |
print input | |
putStrLn $ "mean is " ++ (show.mean) input | |
putStrLn $ "moving average is " ++ (show.avg) input | |
clean :: String -> [Double] | |
clean raw = map (\s -> read s :: Double) (lines raw) |
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 Statistics.LinearRegression | |
import qualified Data.Vector.Unboxed as U | |
-- Computing a linear regression | |
main = do | |
let xs = U.fromList [1.0, 2.0, 3.0, 4.0, 5.0] :: U.Vector Double | |
let ys = U.fromList [1.0, 2.0, 1.3, 3.75, 2.25] :: U.Vector Double | |
let (b, m) = linearRegression xs ys | |
print $ concat ["y = ", show m, " x + ", show b] |
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
FROM java:8-jre | |
ENV KIBANA_VERSION 4.1.1-linux-x64 | |
# Install ELK Required Dependancies | |
RUN set -x \ | |
&& apt-get -qq update \ | |
&& apt-get -qy install wget --no-install-recommends \ | |
&& wget -qO - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add - \ | |
&& echo "deb http://packages.elastic.co/elasticsearch/1.6/debian stable main" >> /etc/apt/sources.list \ |
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
zk1: | |
image: jplock/zookeeper:3.4.6 | |
mesos1: | |
image: redjack/mesos-master:0.21.0 | |
ports: | |
- "5050:5050" | |
links: | |
- "zk1:zookeeper1" |
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
Multiple Linear Regression is the following model. | |
``` $$ | |
h_{\theta}(x^{(i)}) = \theta^{T}x = \theta_{0} + \theta_{1}x | |
``` $$ | |
OlderNewer