Skip to content

Instantly share code, notes, and snippets.

@dapurv5
dapurv5 / Output
Created February 7, 2019 20:45 — forked from macournoyer/Output
A Neural Network framework in 25 LOC
$ python xor.py
Training:
Epoch 0 MSE: 1.765
Epoch 100 MSE: 0.015
Epoch 200 MSE: 0.005
* Target MSE reached *
Evaluating:
1 XOR 0 = 1 ( 0.904) Error: 0.096
0 XOR 1 = 1 ( 0.908) Error: 0.092
1 XOR 1 = 0 (-0.008) Error: 0.008
from __future__ import print_function, division
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
num_epochs = 100
total_series_length = 50000
truncated_backprop_length = 15
state_size = 4
num_classes = 2
@dapurv5
dapurv5 / min-char-rnn.py
Created March 11, 2016 02:48 — 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)
public long count() {
if(n < 0) {
//since the variables take only non-negative values
//there is no solution in this case
return 0;
}
C = new long[n+r+1][n+r+1];
fillC();
public class NumberOfSolutions {
private int n;
private int r;
private int[] dMin;
private int[] dMax;
private long[][] C;//C[n][r] = n choose r
public NumberOfSolutions(int n, int r, int[] dMin, int[] dMax) {
class Base {
static int x = 0;
int m = 0;
}
class Derived extends Base
{
static int x = 2;
int m = 3;
  1. General Background and Overview
@dapurv5
dapurv5 / Sudoku.java
Created May 11, 2014 09:46
Sudoku Solver With Min. Remaining Value Heuristic
/**
* Copyright (C) 2011 apurv verma
* P2008CS1002
*
* javac Sudoku.java
* java Sudoku
*/
package org.anahata.ai;
"""
client.py - AsyncIO Server using StreamReader and StreamWriter
This will create 200 client connections to a server running server.py
It will handshake and run similar to this:
Server: HELLO
Client: WORLD
@dapurv5
dapurv5 / SpMatrixMult.java
Created May 18, 2013 02:29
Sparse Matrix Multiplication in Map Reduce
/**
* Copyright (c) 2013 Apurv Verma
*/
package org.anahata.hadoop.illustrations;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.anahata.commons.hadoop.io.IntInt;