Skip to content

Instantly share code, notes, and snippets.

View chagag's full-sized avatar

Amit Goldenberg chagag

View GitHub Profile
@chagag
chagag / categorization_first_attempt.js
Last active December 17, 2017 17:39
Bayesian model of categorization
var data = {self: 1, group : [5,5,6,7,8,9]}
var model = function(){
// uninformative prior over group beliefs
var groupMean = uniform(0,10) //prior
var groupSd = uniform(0,10) //prior
var belong = flip() //prior
// estimate groupmean and sd considering the group
@chagag
chagag / simple_mlp_tensorflow.py
Created February 28, 2017 21:40 — forked from vinhkhuc/simple_mlp_tensorflow.py
Simple Feedforward Neural Network using TensorFlow
# Implementation of a simple MLP network with one hidden layer. Tested on the iris data set.
# Requires: numpy, sklearn>=0.18.1, tensorflow>=1.0
# NOTE: In order to make the code simple, we rewrite x * W_1 + b_1 = x' * W_1'
# where x' = [x | 1] and W_1' is the matrix W_1 appended with a new row with elements b_1's.
# Similarly, for h * W_2 + b_2
import tensorflow as tf
import numpy as np
from sklearn import datasets
from sklearn.model_selection import train_test_split
var data = {self: 1, group : [5,5,6,7,8,9]}
var model = function(){
// uninformative prior over group beliefs
var groupMean = uniform(0,10) //prior
var groupSd = uniform(0, 10) //prior
// observe
// estimate groupmean and sd considering the group