Skip to content

Instantly share code, notes, and snippets.

View austinogilvie's full-sized avatar

austin austinogilvie

View GitHub Profile
img_clf = ImageClassifier(pca=pca, knn=knn, STANDARD_SIZE=STANDARD_SIZE)
# authenticate
yh = Yhat("YOUR USERNAME", "YOUR API KEY")
# upload model to yhat
yh.upload("imageClassifier", img_clf)
class ImageClassifier(BaseModel):
def require(self):
from StringIO import StringIO
from PIL import Image
import base64
def transform(self, image_string):
#we need to decode the image from base64
image_string = base64.decodestring(image_string)
#since we're seing this as a JSON string, we use StringIO so it acts like a file
{
"color_scheme": "Packages/Color Scheme - Default/Idle.tmTheme"
, "font_size": 10
, "line_padding_bottom": 1
, "line_padding_top": 1
, "wide_caret": true
, "draw_white_space": false
, "fold_buttons": true
, "highlight_line": true
, "auto_complete": true
var walk = function () {
return {walk_it_out: walk_it_out}
function randint () {
var r = Math.random ()
return Math.round(r*10)
};
function get_steps (n) {
  • https://code.google.com/p/julialang/downloads/list
  • julia0.1.2-WINNT-i686+Git.zip
  • Save that .zip and uncompress it wherever you'd like Julia to be stored on your computer (program files, C:, or wherever you have your other programming languages installed)
  • Edit Environment Variables and add this to your path
  • you need to add a few things to your path: root julia directory, julia\lib, and julia\lib\julia
  • I saved mine in C:\julia-c4b3649af6 so this is what i added to my path
  • C:\julia-c4b3649af6;C:\julia-c4b3649af6\lib;C:\julia-c4b3649af6\lib\julia;
  • With that on your path, you can open cmd and type julia to launch the julia shell
from matplotlib.dates import HourLocator, DateFormatter, date2num
from datetime import timedelta
start = df.index.min()
end = df.index.max()
delta = timedelta(hours=1)
dates = matplotlib.dates.drange(start, end, delta)
lines = df.pageviews, df.visitors
import numpy as np
import pandas as pd
import pandas.io.ga as ga
hosts = ['blog.example.com', 'www.example.com']
account_id = "12345678"
# construct a list of filters
# following the regex =~ contains syntax
# documented in the google API docs
# To source this file into an environment to avoid cluttering the global workspace, put this in Rprofile:
# my.env <- new.env(); sys.source("C:/PathTo/THIS_FILE.r", my.env); attach(my.env)
#-----------------------------------------------------------------------
# Load packages, set options and cwd, set up database connection
#-----------------------------------------------------------------------
## Load packages
library(RPostgreSQL)
library(grid)
import pandas as pd
import pandas.io.ga as ga
from IPython.display import display
pd.set_option('display.notebook_repr_html', True)
pd.set_option('display.precision', 4)
pd.set_option('display.max_rows', 50)
pd.set_option('display.max_columns', 10)
from datetime import datetime, timedelta
from pandas import *
s = Series(date_range('2012-1-1', periods=3, freq='D'))
s
# Out[52]:
# 0 2012-01-01 00:00:00
# 1 2012-01-02 00:00:00
# 2 2012-01-03 00:00:00