Skip to content

Instantly share code, notes, and snippets.


Michy mick001

View GitHub Profile
mick001 / neuralnetR.R
Last active April 25, 2023 07:45
A neural network exaple in R. Full article at:
View neuralnetR.R
# Set a seed
data <- Boston
# Check that no data is missing
apply(data,2,function(x) sum(
# Train-test random splitting for linear model
mick001 / copulas_example.R
Last active April 15, 2023 09:17
Modelling dependence with copulas. Full article at:
View copulas_example.R
#Load library mass and set seed
# We are going to use 3 random variables
m <- 3
# Number of samples to be drawn
n <- 2000
mick001 / mice_imp.R
Created October 4, 2015 10:57
Imputing missing data with R; MICE package: Full article at
View mice_imp.R
# 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)]
mick001 /
Created August 29, 2015 11:28
CopulaClass a Python class for using copulas: a fitting example. Full article at
# Copula class
import numpy as np
import matplotlib.pyplot as plt
from copulalib.copulalib import Copula
from scipy.stats import norm'ggplot')
class copulaClass(object):
mick001 / logistic_regression.R
Last active March 17, 2023 18:35
Logistic regression tutorial code. Full article available at
View logistic_regression.R
# Load the raw training data and replace missing values with NA <- read.csv('train.csv',header=T,na.strings=c(""))
# Output the number of missing values for each column
sapply(,function(x) sum(
# Quick check for how many different values for each feature
sapply(, function(x) length(unique(x)))
# A visual way to check for missing data
mick001 /
Created September 3, 2017 21:22
Dwg to pdf printing bot.
# Imports
import os
import sys
import time
import psutil
import logging
import pyautogui as pgui
from datetime import datetime
import numpy as np
import matplotlib.pyplot as plt
from copulalib.copulalib import Copula'ggplot')
def generateData():
global x,y
x = np.random.normal(size=250)
y = 2.5*x + np.random.normal(size=250)
# 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
# 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
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