Skip to content

Instantly share code, notes, and snippets.

Avatar

Abraham Hmiel abehmiel

View GitHub Profile
@econchick
econchick / gist:4666413
Last active Sep 9, 2020
Python implementation of Dijkstra's Algorithm
View gist:4666413
class Graph:
def __init__(self):
self.nodes = set()
self.edges = defaultdict(list)
self.distances = {}
def add_node(self, value):
self.nodes.add(value)
def add_edge(self, from_node, to_node, distance):
@aparrish
aparrish / spacy_intro.ipynb
Last active Aug 10, 2020
NLP Concepts with spaCy. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
View spacy_intro.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aparrish
aparrish / understanding-word-vectors.ipynb
Last active Sep 17, 2020
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
View understanding-word-vectors.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@amintos
amintos / btm.py
Created May 2, 2017
Bi-term Topic Model implementation in pure Python
View btm.py
"""
Bi-Term Topic Model (BTM) for very short texts.
Literature Reference:
Xiaohui Yan, Jiafeng Guo, Yanyan Lan, and Xueqi Cheng:
"A biterm topic model for short texts"
In Proceedings of WWW '13, Rio de Janeiro, Brazil, pp. 1445-1456.
ACM, DOI: https://doi.org/10.1145/2488388.2488514
This module requires pre-processing of textual data,
@corbett
corbett / figure_formatting.py
Created Oct 31, 2017
Create beautiful square figures with big labels and the correct number of ticks
View figure_formatting.py
def create_figure(size=3.6,nxticks=6):
import matplotlib
from matplotlib.ticker import MaxNLocator
figure=matplotlib.pyplot.figure(figsize=(size,size))
ax = figure.add_subplot(1, 1, 1, position = [0.2, 0.15, 0.75, 0.75])
ax.xaxis.set_major_locator(MaxNLocator(nxticks))
return ax
def format_axes(ax,xf='%d',yf='%d',nxticks=6,nyticks=6,labelsize=10):
import pylab
@jb221467
jb221467 / thumbnails2excel.py
Created Feb 2, 2018
Thumbnails and filenames into Excel spreadsheet
View thumbnails2excel.py
"""
Thumbnails & metadata to Excel
Writes images, filenames, and identifiers to an excel file.
JPEGs should be no more than 150 pixels on the long edge.
Input file is a CSV with columns for 'Filename' and 'Identifier'
where 'Filename' values match actual filenames.
Last edited 2/2/2018 by Jasmine Burns, jburns@cornell.edu"""
You can’t perform that action at this time.