Skip to content

Instantly share code, notes, and snippets.

View shivamsaboo17's full-sized avatar
💬

Shivam Saboo shivamsaboo17

💬
View GitHub Profile
@shivamsaboo17
shivamsaboo17 / rnn.py
Last active March 24, 2018 09:59
RNN implemented from scratch just using numpy. Ready to use framework by just plugging in data!
import numpy as np
import pickle
"""
To use this RNN model do the following:
from rnn import RNN
model = RNN(word_dim, hidden_dim, truncte_back_prop_steps)
model.train(model, x_train, y_train, learning_rate, epochs, calculate_loss_after)
model.predict(x)
model.save_model(file_name)
@shivamsaboo17
shivamsaboo17 / word2vec_tf.py
Created March 10, 2018 16:46
A basic skip gram model for vector representation of words implemented in Tensorflow.
import numpy as np
import tensorflow as tf
from sklearn.manifold import TSNE
from sklearn import preprocessing
import matplotlib.pyplot as plt
corpus_raw = 'He is the king . The king is royal . She is the royal queen . The queen loves king'
# Convert the corpus to lower case
corpus_raw = corpus_raw.lower()
@shivamsaboo17
shivamsaboo17 / Board.java
Last active December 3, 2017 11:36
Snakes and ladder simulation in Java
package snladder;
import java.util.*;
public class Board {
// The board class defines the board
// We use Hash Maps for storing data about snakes and ladders.
private HashMap<Integer, Integer> board = new HashMap<>();