View neuralnetR.R
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 a seed | |
set.seed(500) | |
library(MASS) | |
data <- Boston | |
# Check that no data is missing | |
apply(data,2,function(x) sum(is.na(x))) | |
# Train-test random splitting for linear model |
View copulas_example.R
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
#Load library mass and set seed | |
library(MASS) | |
set.seed(100) | |
# We are going to use 3 random variables | |
m <- 3 | |
# Number of samples to be drawn | |
n <- 2000 |
View mice_imp.R
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 airquality dataset | |
data <- airquality | |
data[4:10,3] <- rep(NA,7) | |
data[1:5,4] <- NA | |
# Removing categorical variables | |
data <- airquality[-c(5,6)] | |
summary(data) | |
#------------------------------------------------------------------------------- |
View CopulaClass.py
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
# Copula class | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from copulalib.copulalib import Copula | |
from scipy.stats import norm | |
plt.style.use('ggplot') | |
class copulaClass(object): |
View logistic_regression.R
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
# Load the raw training data and replace missing values with NA | |
training.data.raw <- read.csv('train.csv',header=T,na.strings=c("")) | |
# Output the number of missing values for each column | |
sapply(training.data.raw,function(x) sum(is.na(x))) | |
# Quick check for how many different values for each feature | |
sapply(training.data.raw, function(x) length(unique(x))) | |
# A visual way to check for missing data |
View dwg_to_pdf_printing_bot.py
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 os | |
import sys | |
import time | |
import psutil | |
import logging | |
import pyautogui as pgui | |
from datetime import datetime |
View how_to_copulalib.py
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 numpy as np | |
import matplotlib.pyplot as plt | |
from copulalib.copulalib import Copula | |
plt.style.use('ggplot') | |
def generateData(): | |
global x,y | |
x = np.random.normal(size=250) | |
y = 2.5*x + np.random.normal(size=250) |
View MarkovChains_weather_example.py
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
# A simple Markov chain model for the weather in Python | |
import numpy as np | |
import random as rm | |
import time | |
# Let's define the statespace | |
states = ["Sunny","Cloudy"] | |
# Possible sequences of events |
View letter_frequency.py
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
# The following code takes as input a string of text, and then it outputs the barplot of the | |
# frequencies of occurrence of letters in the string. | |
import pylab as pl | |
import numpy as np | |
string1 = """ Example string """ | |
alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z",".",",",";","-","_","+"] | |
# The following functon takes a list and a string of characters, it calculates how often a certain character appears |
View solarSystem.py
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 math | |
from bigfloat import * | |
import matplotlib.pyplot as plt | |
from visual import * | |
# A class to handle the time ranges | |
class timeHoursSeconds(object): | |
def __init__(self,s,h,d,y): | |
self.s = s | |
self.h = h |
NewerOlder