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
# This script is used to resize images from 64x64 to 28x28 pixels | |
# Clear workspace | |
rm(list=ls()) | |
# Load EBImage library | |
require(EBImage) | |
# Load data | |
X <- read.csv("olivetti_X.csv", header = 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
# -*- coding: utf-8 -*- | |
# Imports | |
from sklearn.datasets import fetch_olivetti_faces | |
import numpy as np | |
# Download Olivetti faces dataset | |
olivetti = fetch_olivetti_faces() | |
x = olivetti.images | |
y = olivetti.target |
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
# Clear workspace | |
rm(list=ls()) | |
# Load libraries | |
require(rnn) | |
# Set seed for reproducibility purposes | |
set.seed(10) | |
# Set frequency |
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
rm(list=ls()) | |
# Load MXNet | |
require(mxnet) | |
# Train test datasets | |
train <- read.csv("train_28.csv") | |
test <- read.csv("test_28.csv") | |
# Fix train and test datasets |
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
# Generate a train-test dataset | |
# Clean environment and load required packages | |
rm(list=ls()) | |
require(EBImage) | |
# Set wd where resized greyscale images are located | |
setwd("C://dogs_resized") | |
# Out file |
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
# Resize images and convert to grayscale | |
rm(list=ls()) | |
require(EBImage) | |
# Set wd where images are located | |
setwd("C://dogs_images") | |
# Set d where to save images | |
save_in <- "C://dogs_images_resized" | |
# Load images names |
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
# Imports | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from mpl_toolkits.mplot3d import Axes3D | |
from matplotlib import cm | |
from matplotlib.ticker import LinearLocator, FormatStrFormatter | |
from numpy import vectorize | |
# Let's define the variables | |
Q = np.linspace(0.01,1,50) # Flow rate m^3/s |
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
# Sample 1000 observations from the distribution | |
sim <- rmvdc(my_dist, 1000) | |
# Plot the data for a visual comparison | |
plot(mydata$x, mydata$y, main = 'Test dataset x and y', col = "blue") | |
points(sim[,1], sim[,2], col = 'red') | |
legend('bottomright', c('Observed', 'Simulated'), col = c('blue', 'red'), pch=21) | |
cor(mydata, method = "kendall") | |
## x y |
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
# Build the bivariate distribution | |
my_dist <- mvdc(claytonCopula(param = 1.48, dim = 2), margins = c("gamma","gamma"), paramMargins = list(list(shape = x_shape, rate = x_rate), list(shape = y_shape, rate = y_rate))) | |
# Generate random sample observations from the multivariate distribution | |
v <- rMvdc(5000, my_dist) | |
# Compute the density | |
pdf_mvd <- dMvdc(v, my_dist) | |
# Compute the CDF | |
cdf_mvd <- pMvdc(v, my_dist) |
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
gf <- gofCopula(normalCopula(dim = 2), as.matrix(mydata), N = 50) | |
gf | |
## Parametric bootstrap goodness-of-fit test with 'method'="Sn", 'estim.method'="mpl" | |
## | |
## data: x | |
## statistic = 0.29449, parameter = 0.59983, p-value = 0.009804 | |
gfc <- gofCopula(claytonCopula(dim = 2), as.matrix(mydata), N = 50) | |
gfc |