Skip to content

Instantly share code, notes, and snippets.

@leoh
leoh / attention_lstm.py
Created November 4, 2018 14:28 — forked from mbollmann/attention_lstm.py
My attempt at creating an LSTM with attention in Keras
class AttentionLSTM(LSTM):
"""LSTM with attention mechanism
This is an LSTM incorporating an attention mechanism into its hidden states.
Currently, the context vector calculated from the attended vector is fed
into the model's internal states, closely following the model by Xu et al.
(2016, Sec. 3.1.2), using a soft attention model following
Bahdanau et al. (2014).
The layer expects two inputs instead of the usual one:
ELECTRIC SKILLET TEMPERATURE–TIMETABLE
Food: degrees (approximate cooking time in minutes)
FRYING
Bacon: 300 to 325 (8-10 minutes)
Canadian Bacon: 275 to 300 (3-4 minutes)
Chicken: 325 to 350 (25-40 minutes)
Eggs, Fried: 250 to 275 (3-5 minutes)
Eggs, Scrambled: 250 to 275 (3-5 minutes)
Fish: 325 to 375 (5-10 minutes)
@leoh
leoh / README.md
Last active August 29, 2015 14:11 — forked from ericcoopey/README.md

Word cloud implementation.

Example of how to

  1. Change style from default. Uses linear scale

  2. Alter word size

  3. "Fit" it into the screen. At first the words were appearing out of view to the left.

@leoh
leoh / atad.csv
Last active August 29, 2015 14:11 — forked from d3noob/.block
date close
26-Mar-12 606.98
27-Mar-12 614.48
28-Mar-12 617.62
29-Mar-12 609.86
30-Mar-12 599.55
2-Apr-12 618.63
3-Apr-12 629.32
4-Apr-12 624.31
5-Apr-12 633.68
@leoh
leoh / README.md
Last active August 29, 2015 14:11 — forked from mbostock/.block

This simple force-directed graph shows character co-occurence in Les Misérables. A physical simulation of charged particles and springs places related characters in closer proximity, while unrelated characters are farther apart. Layout algorithm inspired by Tim Dwyer and Thomas Jakobsen. Data based on character coappearence in Victor Hugo's Les Misérables, compiled by Donald Knuth.

Compare this display to a force layout with curved links, a force layout with fisheye distortion and a matrix diagram.

@leoh
leoh / app.js
Last active August 29, 2015 14:06 — forked from jmibanez/gist:2140974
A complete example of using restify with connect
// Restify server config here
var restify = require('restify');
var server = restify.createServer({
name: 'restify-test',
version: '1.0.0'
});
function respond(req, res, next) {
res.send('hello ' + req.params.name);
next();
@leoh
leoh / restify-facebook.js
Created April 2, 2014 19:16 — forked from jaredhanson/gist:2559730
restify-passport-facebook.js
// Based off example code from Hal Robertson
// https://github.com/halrobertson/test-restify-passport-facebook
// See discussion: https://groups.google.com/forum/?fromgroups#!topic/passportjs/zCz0nXB_gao
var restify = require('restify')
// config vars
var FB_LOGIN_PATH = '/api/facebook_login'
var FB_CALLBACK_PATH = '/api/facebook_callback'
var FB_APPID = '<<YOUR APPID HERE>>'
@leoh
leoh / list.txt
Created March 27, 2014 17:51
filelist
"currency.xml"
"index_synonyms.txt"
"lang/contractions_ca.txt"
"lang/contractions_fr.txt"
"lang/contractions_ga.txt"
"lang/contractions_it.txt"
"lang/hyphenations_ga.txt"
"lang/stemdict_nl.txt"
"lang/stoptags_ja.txt"
"lang/stopwords_ar.txt"
{ "path": "/content/geometrixx/my-first-jinja-page",
"properties": [
{ "name": "jcr:primaryType",
"value": "cq:Page" }],
"nodes": [
{ "path": "jcr:content",
"properties": [
{ "name": "jcr:primaryType",
"value": "cq:PageContent"},
@leoh
leoh / solrconfig_HighlightComponent.xml
Created February 15, 2014 22:36
solr.HighlightComponent example
<!-- Highlighting Component
http://wiki.apache.org/solr/HighlightingParameters
-->
<searchComponent class="solr.HighlightComponent" name="highlight">
<highlighting>
<!-- Configure the standard fragmenter -->
<!-- This could most likely be commented out in the "default" case -->
<fragmenter name="gap"
default="true"