This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function awesomeStuff() { … } | |
function done() { … } | |
var Student = function() { | |
this.name = name; | |
} | |
Person.prototype.doWork = function() { | |
do { awesomeStuff(); } while (!done()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
OlderNewer