Skip to content

Instantly share code, notes, and snippets.

View Orbifold's full-sized avatar
🍀
Happy. Thinking. Understanding.

Francois Vanderseypen Orbifold

🍀
Happy. Thinking. Understanding.
View GitHub Profile
@Orbifold
Orbifold / OptimalPortfolio.R
Created November 10, 2016 13:46
Computing the efficient frontier in R
library(stockPortfolio)
library(quadprog)
library(ggplot2)
stocks <- c("SPY", "EFA", "IWM", "VWO", "LQD", "HYG")
returns <- getReturns(stocks, freq = "week")
eff.frontier <- function (returns,
short = "no",
max.allocation = NULL,
@Orbifold
Orbifold / Chi2NoiseReduction.R
Created November 11, 2016 06:36
Noise reduction using chi2. A synthetic proof by example.
probabilityInsideCluster = 0.5
probabilityOutsideCluster = 0.2
probabilityNoise = 0.3
clusterBoundaries = c(10, 25, 56, 81, 151, 293)
clientTypeCount = c(0, 0, 0, 0)
library(dplyr)
library(rpart)
# this create a frame of clients
makeClientsFrame = function(attribCount = 1000,
clientCount = 1000,
@Orbifold
Orbifold / SMOTE.ipynb
Created November 12, 2016 15:44
Highlighting the usage of synthetic data (SMOTE) to imbalanced data.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Orbifold
Orbifold / Forecasting.ipynb
Last active April 19, 2024 17:33
A tutorial notebook on forecasting time series with R.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Orbifold
Orbifold / ZeppelinPlot.py
Created November 17, 2016 07:08
Zeppelin plotly example.
# if needed, install plotly via shell like so
%sh pip install plotly
#---
%pyspark
import plotly
import numpy as np
from plotly.graph_objs import Scatter, Layout
@Orbifold
Orbifold / KendoZeppelin.py
Created November 17, 2016 07:54
Using Kendo inside a Zeppelin section is simple.
%angular
<base href="http://demos.telerik.com/kendo-ui/gantt/index">
<style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
<title></title>
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/2016.3.1028/styles/kendo.common-material.min.css" />
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/2016.3.1028/styles/kendo.material.min.css" />
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/2016.3.1028/styles/kendo.material.mobile.min.css" />
<script src="http://kendo.cdn.telerik.com/2016.3.1028/js/jquery.min.js"></script>
@Orbifold
Orbifold / Feedforward.ipynb
Created November 25, 2016 09:47
Feedforward examples using Keras.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Orbifold
Orbifold / Gensim.py
Created December 12, 2016 06:52
Using Word2Vec experiment on the Bible.
from gensim.utils import simple_preprocess
tokenize = lambda x: simple_preprocess(x)
# tokenize("We can load the vocabulary from the JSON file, and generate a reverse mapping (from index to word, so that we can decode an encoded string if we want)?!")
import os
import json
import numpy as np
from gensim.models import Word2Vec
@Orbifold
Orbifold / LSTM MxNet.R
Created December 12, 2016 18:43
An LSTM neural network reproducing mini Shakespeare.
require(mxnet)
batch.size = 32
seq.len = 32
num.hidden = 16
num.embed = 16
num.lstm.layer = 1
num.round = 1
learning.rate= 0.1
wd=0.00001
clip_gradient=1
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.