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 / SMOTE.ipynb
Created November 3, 2016 08:12
Synthetic Minority Over-sampling Technique.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Orbifold
Orbifold / tfjs_cosine.html
Created June 12, 2018 09:03
TensorFlow.js learning of the cosine function with realtime loss plot and resulting approximation.
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Faker/3.1.0/faker.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta/js/bootstrap.min.js"></script>
@Orbifold
Orbifold / Seq2seq.py
Created January 16, 2018 06:00
Sequence to sequence translation in Keras.
'''Sequence to sequence example in Keras (character-level).
This script demonstrates how to implement a basic character-level
sequence-to-sequence model. We apply it to translating
short English sentences into short French sentences,
character-by-character. Note that it is fairly unusual to
do character-level machine translation, as word-level
models are more common in this domain.
# Summary of the algorithm
@Orbifold
Orbifold / entailment_train.py
Last active June 21, 2018 05:08
Textual entailment training using TensorFlow.
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import urllib
import sys
import os
import zipfile
glove_vectors_file = "glove.6B.50d.txt"
@Orbifold
Orbifold / node-d3.js
Last active July 5, 2018 05:50
Creating a pie-chart with NodeJS and d3.
var fs = require('fs');
var path = require('path');
var d3 = require('d3');
const jsdom = require("jsdom");
const JSDOM = jsdom.JSDOM;
var chartWidth = 500, chartHeight = 500;
var arc = d3.svg.arc()
.outerRadius(chartWidth / 2 - 10)
@Orbifold
Orbifold / FeatureValuation.ipynb
Last active July 14, 2018 18:35
Using a random forest to valuate features
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Orbifold
Orbifold / tda.py
Created July 15, 2018 04:31
t-Distributed Stochastic Neighbor Embedding (t-SNE) is a (prize-winning) technique for dimensionality reduction that is particularly well suited for the visualization of high-dimensional datasets. The technique can be implemented via Barnes-Hut approximations, allowing it to be applied on large real-world datasets.
import numpy as np
from collections import defaultdict
import json
import itertools
from sklearn import cluster, preprocessing, manifold
from datetime import datetime
class KeplerMapper(object):
def __init__(self, cluster_algorithm=cluster.DBSCAN(eps=0.5,min_samples=3), nr_cubes=10,
overlap_perc=0.1, scaler=preprocessing.MinMaxScaler(), reducer=None, color_function="distance_origin",
@Orbifold
Orbifold / bb84.py
Created July 21, 2018 05:21
Fun and straightforward implementation of the BB84 quantum key distribution protocol.
from numpy import matrix
from math import pow, sqrt
from random import randint
import sys, argparse
class qubit():
def __init__(self,initial_state):
if initial_state:
self.__state = matrix([[0],[1]])
@Orbifold
Orbifold / H2OForecasting.r
Created July 23, 2018 04:59
Time series forecasting with H2O.
install.packages("timetk")
install.packages("tidyquant")
library(h2o) # Awesome ML Library
library(timetk) # Toolkit for working with time series in R
library(tidyquant) # Loads tidyverse, financial pkgs, used to get data
beer_sales_tbl <- tq_get("S4248SM144NCEN", get = "economic.data", from = "2010-01-01", to = "2017-10-27")
beer_sales_tbl %>%
ggplot(aes(date, price)) +
# Train Region
@Orbifold
Orbifold / TF_linear_estimator.py
Created August 23, 2018 04:59
Using TensorFlow LinearRegression estimator.
#!/usr/bin/env python3
# This demonstrates the usage of input_fn with numpy data
# and estimators.
import tensorflow as tf
tf.enable_eager_execution()
assert tf.executing_eagerly()
import tensorflow.contrib.eager as tfe
# too much info otherwise