Skip to content

Instantly share code, notes, and snippets.

import gensim
import codecs
from gensim.models import Word2Vec
import json
def export_to_file(path_to_model, output_file):
output = codecs.open(output_file, 'w' , 'utf-8')
model = Word2Vec.load_word2vec_format(path_to_model, binary=True)
vocab = model.vocab
for mid in vocab:
@mayblue9
mayblue9 / README.md
Created April 27, 2016 04:59 — forked from brattonc/README.md
D3 Liquid Fill Gauge

Liquid Fill Gauge v1.1 - 7/14/2015

Changes:

  • Added support for updating the gauge value after loading is complete. The loadLiquidFillGauge method now returns an object with an update method which allows the gauge value to be changed. Click any of the gauges above to randomly update their value.

Configurable features include:

  • Changeable min/max values.
  • All colors.

The PopCha! Movie Network

A visualization of similarity between movies by means of a network graph

  • Similarity data taken from [PopCha!] 1 recommender engine (R*)
  • Movie info from [The Movie Database] [3]
  • Visualization done in JavaScript with [D3.js] [2]
@mayblue9
mayblue9 / README.md
Created May 3, 2016 04:04 — forked from shunpochang/README.md
D3 Bi-directional Drag and Zoom Tree on D3 development

This example shows how to interact with D3.js to create a Bi-Directional Tree (a variation of robschmuecker@7880033)

The tree shows the dependencies related to D3 development:

  • The upward branches are the repos that D3 is dependent on, from a direct dependency to further parent files that these repos were dependent on.
  • The lower branches are repos that are dependent on D3, and the children files that are dependent on these repos.

The main logic to pull these dependencies and generating tree data is in [my GitHub repo] (https://github.com/shunpochang/d3tree/tree/master/get_tree_from_git), where package.json and bower.json files (to include both NPM and Bower installation) are crawled to get the top matching libraries.

Tree interaction and display:

  • To quickly unfold all branches, click on the label "Click to unfold/expand all" twice to first collapse and then expand, and refresh the browser if it does not work properly.
@mayblue9
mayblue9 / README.md
Created May 4, 2016 08:43 — forked from PBrockmann/README.md
CollapsibleTree Search
@mayblue9
mayblue9 / boston.json
Created May 10, 2016 06:40 — forked from pprett/boston.json
Decision Tree Viewer (D3 and Sklearn)
{"error": 42716.2954, "samples": 506, "value": [22.532806324110698], "label": "RM <= 6.94", "type": "split", "children": [{"error": 17317.3210, "samples": 430, "value": [19.93372093023257], "label": "LSTAT <= 14.40", "type": "split", "children": [{"error": 6632.2175, "samples": 255, "value": [23.349803921568636], "label": "DIS <= 1.38", "type": "split", "children": [{"error": 390.7280, "samples": 5, "value": [45.58], "label": "CRIM <= 10.59", "type": "split", "children": [{"error": 0.0000, "samples": 4, "value": [50.0], "label": "Leaf - 4", "type": "leaf"}, {"error": 0.0000, "samples": 1, "value": [27.9], "label": "Leaf - 5", "type": "leaf"}]}, {"error": 3721.1632, "samples": 250, "value": [22.90520000000001], "label": "RM <= 6.54", "type": "split", "children": [{"error": 1636.0675, "samples": 195, "value": [21.629743589743576], "label": "LSTAT <= 7.57", "type": "split", "children": [{"error": 129.6307, "samples": 43, "value": [23.969767441860473], "label": "TAX <= 222.50", "type": "split", "children": [{"err
@mayblue9
mayblue9 / index.html
Created May 11, 2016 05:40 — forked from Guerino1/index.html
D3 Interactive Force Directed Radial Graph
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en-US"
lang="en-US">
<head profile="http://www.w3.org/2005/10/profile">
<title>My Force Directed Graph</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Description" content="This page tries to mix charts with html formatting and layout constructs." />
@mayblue9
mayblue9 / README.md
Created May 12, 2016 02:30 — forked from helmutkian/README.md
React + D3 Force Layout

This is an example of using ReactJs to render a force directed network graph. D3 performs all the positional calculations for each node and React handles rendering.

@mayblue9
mayblue9 / graphFile.json
Created May 18, 2016 04:06
A Simple d3 Network Graph
{
"nodes":[
{"name":"node1","group":1},
{"name":"node2","group":2},
{"name":"node3","group":2},
{"name":"node4","group":3}
],
"links":[
{"source":2,"target":1,"weight":1},
{"source":0,"target":2,"weight":3}
@mayblue9
mayblue9 / example_ephem.ipynb
Created May 25, 2016 04:38 — forked from sjpfenninger/example_ephem.ipynb
IPython example with pyephem
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.