This file contains hidden or 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 ($) { | |
| var notify, initialize, requestPermission; | |
| notify = function () { | |
| var notification; | |
| if (window.webkitNotifications) { | |
| if (window.webkitNotifications.checkPermission() > 0) { | |
| window.webkitNotifications.requestPermission(this); | |
| } |
This file contains hidden or 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
| # Dependencies: jquery, handlebars.js, ember.js (1.0pre) | |
| App = Em.Application.create() | |
| App.ApplicationView = Em.View.extend | |
| templateName: 'application' | |
| App.ApplicationController = Em.Controller.extend | |
| name: "oembot" | |
| App.Router = Em.Router.extend |
This file contains hidden or 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
| VWAIT proc near | |
| pusha | |
| mov dx, 3DAh | |
| v1: | |
| in al, dx | |
| and al, 008h | |
| jnz v1 | |
| v2: | |
| in al, dx | |
| and al, 008h |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| ) | |
| const timeFormat = "2006-01-02 15:04 MST" | |
| func main() { |
This file contains hidden or 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
| require 'matrix' | |
| Matrix[[10, 1000, 10], [5, 800, 2], [12, 2500, 3]] * Vector[200,-0.1,-10] # => Vector[1800.0, 900.0, 2120.0] |
This file contains hidden or 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
| # features is a Matrix, labels and theta are Vectors | |
| def cost_function(features, labels, theta) | |
| m = features.row_count | |
| predictions = predict(features, theta) | |
| squared_errors = (predictions - labels).map { |error| error**2 } | |
| (1.0 / (2.0 * m)) * squared_errors.reduce { |a, b| a + b } | |
| end |
This file contains hidden or 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
| def normal_equation(features, labels) | |
| (features.transpose * features).inverse * features.transpose * labels | |
| end |
This file contains hidden or 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
| require 'minitest/autorun' | |
| require 'matrix' | |
| module LinearRegression | |
| def predict(features, theta) | |
| features * theta | |
| end | |
| def cost_function(features, labels, theta) | |
| m = features.row_count |
This file contains hidden or 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 turicreate as tc | |
| import re | |
| import os | |
| def path_as_label(path): | |
| label = re.search('(?<=raw/)(.+)?/.+$', path).group(1) | |
| label = label.replace('_', ' ') | |
| return label.title() |
This file contains hidden or 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 turicreate as tc | |
| import os | |
| current_dir = os.path.dirname(__file__) | |
| data = tc.SFrame(os.path.join(current_dir, 'data/processed/beers.sframe')) | |
| train, test = data.random_split(0.8) | |
| model = tc.image_classifier.create(train, target='label', max_iterations=100) |