TODO: Write a project description
TODO: Describe the installation process
#!/usr/bin/env python | |
from PIL import Image | |
import sys | |
im = Image.open(sys.argv[1]) | |
def scale_to_width(dimensions, width): | |
height = (width * dimensions[1]) / dimensions[0] |
This is the "Iris" dataset. Originally published at UCI Machine Learning Repository: Iris Data Set, this small dataset from 1936 is often used for testing out machine learning algorithms and visualizations (for example, Scatter Plot). Each row of the table represents an iris flower, including its species and dimensions of its botanical parts, sepal and petal, in centimeters.
The HTML page provides the basic code required to load the data and display it on the page (as JSON) using D3.js.
For a more up to date code example with React & D3, see (VizHub: Stylized Scatter Plot)[https://vizhub.com/curran/3d631093c2334030a6b27fa979bb4a0d?edit=files&file=index.js].
# Tiny example of 3-layer nerual network with dropout in 2nd hidden layer | |
# Output layer is linear with L2 cost (regression model) | |
# Hidden layer activation is tanh | |
import numpy as np | |
n_epochs = 100 | |
n_samples = 100 | |
n_in = 10 | |
n_hidden = 5 |
from IPython.display import HTML | |
# Youtube | |
HTML('<iframe width="560" height="315" src="https://www.youtube.com/embed/S_f2qV2_U00?rel=0&controls=0&showinfo=0" frameborder="0" allowfullscreen></iframe>') | |
# Vimeo | |
HTML('<iframe src="https://player.vimeo.com/video/26763844?title=0&byline=0&portrait=0" width="700" height="394" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe><p><a href="https://vimeo.com/26763844">BAXTER DURY - CLAIRE (Dir Cut)</a> from <a href="https://vimeo.com/dannysangra">Danny Sangra</a> on <a href="https://vimeo.com">Vimeo</a>.</p>') |
import numpy as np | |
from sklearn.datasets import make_moons | |
from sklearn.cross_validation import train_test_split | |
n_feature = 2 | |
n_class = 2 | |
def make_network(n_hidden=100): |
from keras import layers | |
def residual_block(y, nb_channels, _strides=(1, 1), _project_shortcut=False): | |
shortcut = y | |
# down-sampling is performed with a stride of 2 | |
y = layers.Conv2D(nb_channels, kernel_size=(3, 3), strides=_strides, padding='same')(y) | |
y = layers.BatchNormalization()(y) | |
y = layers.LeakyReLU()(y) |
from keras import backend as K | |
def jaccard_distance_loss(y_true, y_pred, smooth=100): | |
""" | |
Jaccard = (|X & Y|)/ (|X|+ |Y| - |X & Y|) | |
= sum(|A*B|)/(sum(|A|)+sum(|B|)-sum(|A*B|)) | |
The jaccard distance loss is usefull for unbalanced datasets. This has been | |
shifted so it converges on 0 and is smoothed to avoid exploding or disapearing | |
gradient. |
# | |
# fashion_mnist_theano.py | |
# date. 10/2/2017 | |
# | |
# REM: I read the article for stopping development of "THEANO". | |
# The deep learning framework stimulated me and made me write codes. | |
# I'd like to say thank you to Theano supporting team. | |
# | |
import os |