Skip to content

Instantly share code, notes, and snippets.

View kazarazat's full-sized avatar

kaza razat kazarazat

View GitHub Profile
@aparrish
aparrish / understanding-word-vectors.ipynb
Last active April 20, 2024 01:36
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/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kazarazat
kazarazat / evolution_algorithm.py
Created October 19, 2016 21:00
This code is inspired by an Evolutionary Algorithm as discussed by Ray Kurzweil. The idea is to use simple Mendelian biological inheritance to breed two "organisms" with random genetic data to each other to produce an offspring that has inherited "desired" genetic data from them.
import string
import random
model_genes = ['1','2','3','4','a','b','c','d']
strand = len(model_genes)/2
def female_code(size, chars=string.digits):
return list(''.join(random.choice(chars) for _ in range(size)))
def male_code(size, chars=string.ascii_lowercase):
@karpathy
karpathy / min-char-rnn.py
Last active April 23, 2024 17:55
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)