Skip to content

Instantly share code, notes, and snippets.

View scmmishra's full-sized avatar
🎯
Focusing

Shivam Mishra scmmishra

🎯
Focusing
View GitHub Profile
@scmmishra
scmmishra / network.py
Created January 8, 2018 12:04
Tensorflow-MLP
# Implementing a one-layer Neural Network
#---------------------------------------
#
# We will illustrate how to create a one hidden layer NN
#
# We will use the iris data for this exercise
#
# We will build a one-hidden layer neural network
# to predict the fourth attribute, Petal Width from
# the other three (Sepal length, Sepal width, Petal length).
@scmmishra
scmmishra / app.py
Last active January 13, 2018 14:39
flask
class Survey(flask_db.Model):
name = CharField()
department = TextField()
year = TextField()
tags = TextField()
timestamp = DateTimeField(default=datetime.datetime.now, index=True)
def save(self, *args, **kwargs):
ret = super(Survey, self).save(*args, **kwargs)
return ret
@scmmishra
scmmishra / first-graph.py
Last active January 17, 2018 17:16
Tensorflow Guide
import tensorflow as tf
a = tf.constant(5, name="input_a")
b = tf.constant(3, name="input_b")
c = tf.add(a,b, name="add_c")
d = tf.multiply(a,b, name="multiply_d")
e = tf.add(c,d, name="add_e")
sess = tf.Session()
output = sess.run(e)
@scmmishra
scmmishra / graph.py
Last active January 24, 2018 13:46
Graph
import tensorflow as tf
# Explicitly create a Graph object
graph = tf.Graph()
with graph.as_default():
with tf.name_scope("variables"):
# Variable to keep track of how many times the graph has been run
global_step = tf.Variable(0, dtype=tf.int32, trainable=False, name="global_step")
@scmmishra
scmmishra / linear_regression.py
Created February 2, 2018 16:50
linear_regression.py
import tensorflow as tf
W = tf.Variable(tf.zeros([2, 1]), name="weights")
b = tf.Variable(0., name="bias")
def inference(X):
return tf.matmul(X, W) + b
def loss(X,Y):
Y_predicted = inference(X)
@scmmishra
scmmishra / draw_neural_net.py
Created May 24, 2018 12:02 — forked from craffel/draw_neural_net.py
Draw a neural network diagram with matplotlib!
import matplotlib.pyplot as plt
def draw_neural_net(ax, left, right, bottom, top, layer_sizes):
'''
Draw a neural network cartoon using matplotilb.
:usage:
>>> fig = plt.figure(figsize=(12, 12))
>>> draw_neural_net(fig.gca(), .1, .9, .1, .9, [4, 7, 2])
@scmmishra
scmmishra / draw_neural_net.py
Created May 24, 2018 12:02 — forked from craffel/draw_neural_net.py
Draw a neural network diagram with matplotlib!
import matplotlib.pyplot as plt
def draw_neural_net(ax, left, right, bottom, top, layer_sizes):
'''
Draw a neural network cartoon using matplotilb.
:usage:
>>> fig = plt.figure(figsize=(12, 12))
>>> draw_neural_net(fig.gca(), .1, .9, .1, .9, [4, 7, 2])
function awesomeStuff() { … }
function done() { … }
var Student = function() {
this.name = name;
}
Person.prototype.doWork = function() {
do { awesomeStuff(); } while (!done());
}
Filter by Country
<div class="text-center mt-2 mx-auto">
<select id="select-country" onchange="setCountry(this)" style="width: 250px;" class="select-country">
<option value="all">All</option>
{% for country in country_list %}
<option value="{{ country.name }}">{{ country.name }}</option>
{% endfor %}
</select>
</div>
@scmmishra
scmmishra / app.py
Last active March 8, 2019 10:48
Flask Workshop
import os
import datetime
from flask import (Flask, flash, redirect, render_template, request,
Response, url_for, session)
from peewee import *
from playhouse.flask_utils import FlaskDB, get_object_or_404, object_list
from playhouse.sqlite_ext import *
SECRET_KEY = "secret"