Skip to content

Instantly share code, notes, and snippets.

View Libardo1's full-sized avatar

Libardo Lopez Libardo1

  • Bogotá, Colombia
View GitHub Profile

Markov Chains

A while back I wrote a blog post explaining Markov chains and demonstrating different ways of finding their steady-state distribution in R. Now, I want to play with Markov chains as a graph. I’m going to pull examples from around the internet and answer the same questions in Cypher as the authors do with matrices. This gives me the opportunity to explore more advanced Cypher queries while working with a topic I enjoy very much (stochastic processes and Markov chains). So this is officially just for funsies.

I found three Markov chains online that I’m going to showcase, and they involve the following topics:

@Libardo1
Libardo1 / README.md
Created May 29, 2016 16:17 — forked from nbremer/.block
Radar Chart Redesign

A new design for a radar chart in D3.js. You can read more about in on the blog I wrote "A different look for the D3 radar chart"

An older version of a radar chart that I adjusted two years ago when I was just starting to learn D3.js can be found here

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os
def computeCost(X, y, theta):
inner = np.power(((X * theta.T) - y), 2)
return np.sum(inner) / (2 * len(X))
def gradientDescent(X, y, theta, alpha, iters):
import tensorflow as tf
tf.add(1, 2)
# 3
tf.sub(2, 1)
# 1
tf.mul(2, 2)
import tensorflow as tf
# create a constant 2X2 matrix
tensor_1 = tf.constant([[1., 2.], [3.,4]])
tensor_2 = tf.constant([[5.,6.],[7.,8.]])
# create a matrix multiplication operation
output_tensor = tf.matmul(tensor_1, tensor_2)
@Libardo1
Libardo1 / churn.sql
Created September 27, 2016 12:40 — forked from jdwyah/churn.sql
WITH monthly_usage AS (
SELECT
user_id,
date_part('month', age(created_at, '1970-01-01')) +
12 * date_part('year', age(created_at, '1970-01-01')) AS time_period
FROM orders
WHERE order_state = 'completed'
GROUP BY 1, 2
ORDER BY 1, 2)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Libardo1
Libardo1 / gabor_filter.py
Created January 25, 2017 21:27 — forked from kendricktan/gabor_filter.py
Gabor kernel filter example in python
import numpy as np
import cv2
# cv2.getGaborKernel(ksize, sigma, theta, lambda, gamma, psi, ktype)
# ksize - size of gabor filter (n, n)
# sigma - standard deviation of the gaussian function
# theta - orientation of the normal to the parallel stripes
# lambda - wavelength of the sunusoidal factor
# gamma - spatial aspect ratio
# psi - phase offset
@Libardo1
Libardo1 / bf4plots.ipynb
Created February 14, 2017 23:24 — forked from NelsonMinar/bf4plots.ipynb
Battlefield 4 plots, an IPython experiment
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Libardo1
Libardo1 / get_mnist_data_tf.py
Created February 18, 2017 20:04 — forked from MartinThoma/get_mnist_data_tf.py
Get MNIST data for TensorFlow example
"""Functions for downloading and reading MNIST data."""
from __future__ import print_function
import gzip
import os
import urllib
import numpy
SOURCE_URL = 'http://yann.lecun.com/exdb/mnist/'
def maybe_download(filename, work_directory):