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
y1 <- round(rnorm(n = 36, mean = 7, sd = 2)) # Simulate data from normal distribution | |
y2 <- round(rnorm(n = 36, mean = 21, sd = 6)) | |
y3 <- round(rnorm(n = 36, mean = 50, sd = 8)) | |
x <- rep(LETTERS[1:12], 3) | |
grp <- rep(c("Grp 1", "Grp 2", "Grp 3"), each = 12) | |
dat <- data.frame(grp, x, y1, y2, y3) |
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 Dates | |
using Distributions | |
using HypothesisTests: ADFTest, LjungBoxTest | |
using Knet | |
using Measures | |
using Plots | |
using PlotThemes | |
using Random | |
using StatsBase: autocor, pacf | |
using Turing |
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(RCurl) | |
# Set SSL certs globally | |
options(RCurlOptions = list(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"))) | |
library(twitteR) | |
reqURL <- "https://api.twitter.com/oauth/request_token" | |
accessURL <- "https://api.twitter.com/oauth/access_token" | |
authURL <- "https://api.twitter.com/oauth/authorize" | |
apiKey <- "xxxxxxxxxxxxxxxxxxxxxx" | |
apiSecret <- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" |
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 matplotlib_venn import * | |
from matplotlib import pyplot as plt | |
v = venn2(subsets = {'10': 1, '01': 1, '11': 1}, set_labels = ('A', 'B')) | |
v.get_patch_by_id('10').set_alpha(0.5) | |
v.get_patch_by_id('10').set_color('orange') | |
v.get_patch_by_id('01').set_alpha(0.5) | |
v.get_patch_by_id('01').set_color('orange') | |
v.get_patch_by_id('11').set_alpha(0.75) | |
v.get_patch_by_id('11').set_color('orange') | |
v.get_label_by_id('10').set_text('') |
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
set.seed(1) | |
x1 <- rnorm(10) | |
x2 <- rnorm(10) | |
out <- cbind(x1, x2) | |
colMeans(out) | |
# colMeans can be computed as follows as well | |
apply(out, 2, mean) | |
# apply - applies a mean function to column (indicated by 2) of out 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
# Simulating the data | |
set.seed(73735911) | |
#set.seed(737377911) | |
n=100;nu=5;alpha=2;beta=2;sig=1;true=c(alpha,beta,nu) | |
x=rnorm(n,1,1) | |
y=alpha+beta*x+sig*rt(n,nu) | |
par(mfrow=c(1,1)) | |
plot(x,y, col='blue3', pch=19) |
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 Turing, Distributions | |
# Import RDatasets. | |
using RDatasets | |
# Import MCMCChain, Plots, and StatPlots for visualizations and diagnostics. | |
using MCMCChain, Plots, StatPlots | |
# MLDataUtils provides a sample splitting tool that's very handy. | |
using MLDataUtils |
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
# Configure Theme | |
kobe_theme <- function() { | |
theme( | |
plot.background = element_rect(fill = "#E2E2E3", colour = "#E2E2E3"), | |
panel.background = element_rect(fill = "#E2E2E3"), | |
panel.background = element_rect(fill = "white"), | |
axis.text = element_text(colour = "#E7A922", family = "Impact"), | |
plot.title = element_text(colour = "#552683", face = "bold", size = 18, vjust = 1, family = "Impact"), | |
axis.title = element_text(colour = "#552683", face = "bold", size = 13, family = "Impact"), | |
panel.grid.major.x = element_line(colour = "#E7A922"), |
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
rz_helper = function() { | |
y1 = rexp(1, 1) # step 1 | |
y2 = rexp(1, 1) # step 2 | |
# step 3 | |
while (y2 <= ((y1 - 1)^2)/2) { | |
y1 = rexp(1, 1) | |
} | |
# step 4 |
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 numpy import arange, product, vstack, zeros | |
from keras.models import Sequential | |
from keras.layers import Activation, Dense, Dropout | |
from keras.datasets import cifar100 | |
from keras.utils.np_utils import to_categorical | |
from matplotlib.pylab import axis, imshow, savefig, show, subplots | |
# Define the constants | |
CONST_N = 2000 | |
CONST_EPOCHS = 30 |
NewerOlder