This file contains hidden or 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
| // Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository | |
| $ git ls-files | xargs wc -l |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
| f, a = subplots(10, 20) | |
| for i in arange(10): | |
| for j in arange(20): | |
| a[i, j].imshow(x_train[j + 20 * i]) | |
| a[i, j].axis("off") | |
| a[i, j].set_adjustable('box-forced') | |
| f.savefig("img1.png", bbox_inches='tight', pad_inches = 0) |
This file contains hidden or 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
| items <- list(x_train, y_train, x_test, y_test) | |
| dim_formatter <- function (x) { | |
| if (length(dim(x)) > 2) | |
| paste("(", dim(x)[1], ", ", dim(x)[2], " , ", dim(x)[3], " , ", dim(x)[4], ")", sep = "") | |
| else | |
| paste("(", dim(x)[1], ", ", dim(x)[2], ")", sep = "") | |
| } | |
| # training set |
This file contains hidden or 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
| items = [x_train, y_train, x_test, y_test] | |
| # training set | |
| [type(item) for item in items[:2]] # [<type 'numpy.ndarray'>, <type 'numpy.ndarray'>] | |
| [item.shape for item in items[:2]] # [(50000, 32, 32, 3), (50000, 1)] | |
| # testing set | |
| [type(item) for item in items[2:]] # [<type 'numpy.ndarray'>, <type 'numpy.ndarray'>] | |
| [item.shape for item in items[2:]] # [(10000, 32, 32, 3), (10000, 1)] |
This file contains hidden or 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
| cifar100 <- dataset_cifar100(label_mode = "fine") | |
| x_train <- cifar100$train$x; y_train <- cifar100$train$y | |
| x_test <- cifar100$test$x; y_test <- cifar100$test$y |
NewerOlder