Skip to content

Instantly share code, notes, and snippets.

View phraniiac's full-sized avatar
🎯
Focusing

Pranav Sharma phraniiac

🎯
Focusing
View GitHub Profile
import numpy as np
import tensorflow as tf
def add_values(num_list):
# making a list of tensors.
tensor_list = tf.constant(num_list, shape=[1, 3], name='tensor_list')
tensor_ten = tf.constant([10] * len(num_list), \
shape=[len(num_list), 1], name='tensor_ten')
# the below statement declares a scope under which the
# variables will be used.
import numpy as np
import tensorflow as tf
from random import shuffle
class Glove:
"""docstring for Glove"""
def __init__(self, corpus, context_size=2, learning_rate=0.05, batch_size=100, num_epochs=100):
super(Glove, self).__init__()
self.corpus = corpus
self.CONTEXT_SIZE = context_size
/*************** Kmp Functions. ***************/
void compute(int * kmparr, char * pattern, int patternlength) {
int m = patternlength;
kmparr[0] = 0;
int len = 0, i;
for (i = 1; i < m; ++i)
{
if (pattern[i] == pattern[len])
{
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@phraniiac
phraniiac / 2_fullyconnected.ipynb
Last active January 26, 2017 15:29
Assignment 2
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@phraniiac
phraniiac / kmp.cpp
Last active October 11, 2016 02:55
String Algorithms
vector<int> Knuth_Morris_Pratt(string text,string pattern)
{
vector<int> F = build_failure_function(pattern);
vector<int> positions;
int i = 0; // state of automaton
int j = 0; // position of counter in string.
for( ; ; ) {
if(j == n) break; // we reached the end of the text
var props = {};
props.foo = x;
props.bar = y;
// Write your attribute with the props defined.
var component = <Component {...props} />;
//--
// If needs to be changed later, this could be done.
// Input (JSX):
var content = <Container>{window.isLoggedIn ? <Nav /> : <Login />}</Container>;
// Output (JS):
var content = React.createElement(
Container,
null,
window.isLoggedIn ? React.createElement(Nav) : React.createElement(Login)
// Input (JSX):
var person = <Person name={window.isLoggedIn ? window.name : ''}>;
// Output (JS):
var person = React.createElement(
Person,
{name: window.isLoggedIn ? window.name : ''}
// Form Declaration.
var MyFormComponent = React.createClass({ ... });
// Subcomponents declaration.
MyFormComponent.Row = React.createClass({ ... });
MyFormComponent.Label = React.createClass({ ... });
MyFormComponent.Input = React.createClass({ ... });
// Actual app.
var App = (