Skip to content

Instantly share code, notes, and snippets.

View sstadelman's full-sized avatar
🚀

Stan Stadelman sstadelman

🚀
View GitHub Profile
export XSC_OPTIONS=
./build-all.sh
export XSC_OPTIONS=-pi
./build-mobile.sh swift
@sstadelman
sstadelman / GeneratedProxies.swift
Last active December 8, 2016 17:14
Using the DataService streaming API
open class DefaultContainer<Provider: DataServiceProvider>: DataService<Provider> {
public override init(provider: Provider) {
super.init(provider: provider)
self.provider.metadata = DefaultContainerMetadata.document
}
// ...
open func photos(query: DataQuery = DataQuery()) throws -> Array<Photo> {
@sstadelman
sstadelman / Exercises_5_15_2017.md
Last active May 17, 2017 07:03
Exercises_5_15_2017

Ran Google Cloud Platform Big Query examples for working with time-series financial data. Used gcloud command-line tools to connect to Google Cloud project financials-test. Initialized bq (BigQuery tools), and pointed it at my project. Imported two large csv files of USD-GBP exchange rates in 2014.

# my GCP project
gcloud config set project financials-test

# my temporary data set that is imported to BigQuery
bq mk timeseries

# note the column definitions appended to the `load` command

I watched a 9 minute video on Long Short Term Memory (LSTM) in recurrent neural networks. The concept here is that the input to the hidden layer includes some information about the previous back-prop, which if I remember correctly includes the last calculation of the inner weights for each of the classes... something like that.

I walked through the jupyter notebook for this example. It introduces keras as an API, as well as some concepts around Dropout which I don't yet understand.

The very interesting thing about this example was the charting at the end, which plotted a set of predictions, against the true values. Also, the author proposed a code challenge, to best predict the future of GOOGL (Alphabet), using Price History and two other metrics using an LSTM.

I downloaded a dataset from Quandl for GOGVIX, curled to csv, and uploaded to BigQuery.

curl https://w
@sstadelman
sstadelman / Exercises_5_23_2017.md
Last active May 24, 2017 16:53
Exercises_5_23_2017

Used Google Cloud Platform BigQuery WebUI to edit SQL queries for GOOGL prediction code competition.

Found some very good examples of BigQuery complex queries here. Really critical findings are:

  1. Can use lag(<prop name>, <previous row count) over (ORDER BY <prop name>), and lead to access the window of the result set.
  2. When combined with functions like AVG(<prop name>), makes it really easy to calculate moving averages
 SELECT
   DATE(S1.date) AS join_date,
@sstadelman
sstadelman / metadata.xml
Created June 4, 2017 20:52
metadata.xml
<?xml version="1.0" encoding="utf-8"?><edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:sap="http://www.sap.com/Protocols/SAPData"><edmx:DataServices m:DataServiceVersion="2.0"><Schema Namespace="GWDEMO" xml:lang="en" sap:schema-version="1" xmlns="http://schemas.microsoft.com/ado/2008/09/edm"><EntityType Name="SalesOrderLineItem" sap:content-version="1"><Key><PropertyRef Name="SalesOrderItemKey"/><PropertyRef Name="SalesOrderKey"/></Key><Property Name="CurrencyCodeDescription" Type="Edm.String" MaxLength="255" sap:label="Currency" sap:creatable="false" sap:updatable="false"/><Property Name="OpportunityItemPosition" Type="Edm.String" MaxLength="10" sap:label="Opportunity Item Position" sap:updatable="false"/><Property Name="ProductName" Type="Edm.String" MaxLength="255" sap:label="Product Name" sap:creatable="false" sap:updatable="false"/><Property Name="NetSum" Type="Edm.Decimal" Precision="15" Sca
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
@sstadelman
sstadelman / Exercises_6_18_2017.md
Last active June 19, 2017 05:30
Exercises_6_18_2017

Started watching Week2 of Andrew Ng's coursera Machine Learning course.

Beginning with Model & Cost function. For Model representation, showed correlation of house size to sale price in Portland. In this example, the house size is the x-value input, and the y-value is the sale price. It is a supervised learning scenario, since we train the model on known historical sales prices.

This is an example of univariate linear regression, or linear regression with one variable. Because we're trying to predict continuous real values, we call this a "regression problem". Otherwise, if there are only discrete values, it is a "classification problem".

To validate this scenario for the financial projections case, I'll use the google_vix_results.csv data below, which attempts to predict the high of the GOOG equity, from the prior day's GOOGVIX volatility index high. The prior_day_vix_futures_high will be the x and the the observed_equity_high will be the y. m is 1752.

Keys to pr

enum Constraints {
struct Horizontal: OptionSet {
let rawValue: UInt8
static let masterTextView = Horizontal(rawValue: 1)
static let detailImageView = Horizontal(rawValue: 2)
static let descriptionTextView = Horizontal(rawValue: 3)
static let statusTextView = Horizontal(rawValue: 4)