Skip to content

Instantly share code, notes, and snippets.

@viix-co
viix-co / LSTM.py
Created March 24, 2023 00:36 — forked from sukanyabag/LSTM.py
import random
import numpy as np
import math
def sigmoid(x):
return 1. / (1 + np.exp(-x))
def sigmoid_derivative(values):
return values*(1-values)
@viix-co
viix-co / min-char-rnn.py
Created March 21, 2023 11:33 — forked from karpathy/min-char-rnn.py
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)
@viix-co
viix-co / tensorflow_word2vec_cbow_basic.py
Created February 8, 2023 15:14 — forked from yxtay/tensorflow_word2vec_cbow_basic.py
Basic implementation of CBOW word2vec with TensorFlow. Minimal modification to the skipgram word2vec implementation in the TensorFlow tutorials.
# References
# - https://www.tensorflow.org/versions/r0.10/tutorials/word2vec/index.html
# - https://github.com/tensorflow/tensorflow/blob/r0.10/tensorflow/examples/tutorials/word2vec/word2vec_basic.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import math