Skip to content

Instantly share code, notes, and snippets.

View llSourcell's full-sized avatar

Siraj Raval llSourcell

View GitHub Profile

100 Days Of ML Code - Example Log

Use this as a base template. Create your own repository on GitHub and start logging your work daily!

Day 0: February 29, 2016 (Example 1)

(delete me or comment me out)

Today's Progress: Fixed CSS, worked on canvas functionality for the app.

Thoughts: I really struggled with CSS, but, overall, I feel like I am slowly getting better at it. Canvas is still new for me, but I managed to figure out some basic functionality.

#data storage
import h5py
#matrix math
import numpy as np
#data preprocessing
import pandas as pd
#ETL - Extract, Transform, and Load Data Class
class ETL:
#for data loading
import etl
#for machine learning
import keras
#load data
dl = etl.ETL()
#build model
def build_network(layers):
#Stock prices
from google_finance import Share
#visualization
from matplotlib import pyplot as plt
#matrix math
import numpy as np
import random
#machine learning
import tensorflow as tf
import random
// Step 1 - build Convolutional network
const buildCnn = function (data) {
//A promise represents the eventual result of an asynchronous
//operation. It is a placeholder into which the successful
//result value or reason for failure will materialize.
return new Promise(function (resolve, reject) {
//Linear stack of layers.
const model = tf.sequential()
def cross_entropy(X,y):
"""
X is the output from fully connected layer (num_examples x num_classes)
y is labels (num_examples x 1)
"""
m = y.shape[0]
p = softmax(X)
log_likelihood = -np.log(p[range(m),y])
loss = np.sum(log_likelihood) / m
return loss
[
{
"image_id": "a0f6bdc065a602b7b84a67fb8d14ce403d902e0d",
"human_annotations":
{
"human1": [178,250,290,522],
},
"keypoint_annotations":
{
"human1": [261, 294, 1, 281, 328, 1, 259, 314, 2,
//contract address
var contractAddress = "0x43833c47907be9780581c0fbee97cc6e4f0a99c9";
//ABI stands for application binary interface.
//In general, an ABI is the interface between two program modules, one of which is often at the level of machine code.
//The interface is the de facto method for encoding/decoding data into/out of the machine code.
//In Ethereum, it's basically how you can encode Solidity contract calls for the EVM and, backwards,
//how to read the data out of transactions.
var ABI = require("./build/contracts/MindMathGame.json").abi;
var web3Host = 'http://localhost';
var web3Port = '8545';
pragma solidity ^0.4.0;
contract MindMathGame
{
//The blockchain is a list of blocks which are fundamentally lists of transactions.
//Each transaction has an attached receipt which contains zero or more log entries.
//Log entries represent the result of events having fired from a smart contract.
//In the Solidity source code, to define an event, you mark it thus by preceding it with the
//event keyword (similar in usage to the function keyword). You then call or fire the event
//in the body of whatever function you wish to cause to generate the event.
from __future__ import print_function
import sys
import vgg, pdb, time
import tensorflow as tf, numpy as np, os
import transform
from utils import get_img
STYLE_LAYERS = ('relu1_1', 'relu2_1', 'relu3_1', 'relu4_1', 'relu5_1')
CONTENT_LAYER = 'relu4_2'
DEVICES = 'CUDA_VISIBLE_DEVICES'