Instantly share code, notes, and snippets.

• Sort options
Created Mar 11, 2016
Add a closure for conditionals to phan
View phan_conditional.diff
 diff --git a/src/Phan/Analysis/PreOrderAnalysisVisitor.php b/src/Phan/Analysis/PreOrderAnalysisVisitor.php index 8650cd3..feaaee4 100644 --- a/src/Phan/Analysis/PreOrderAnalysisVisitor.php +++ b/src/Phan/Analysis/PreOrderAnalysisVisitor.php @@ -508,11 +508,16 @@ class PreOrderAnalysisVisitor extends ScopeVisitor */ public function visitIfElem(Node \$node) : Context { + \$closure_fqsen = + FullyQualifiedFunctionName::fromClosureInContext(
Created Mar 10, 2016
Non-linear classification example
View non_linear_classification.m
 % my training data. % so if x > 3 || x < 7, y = 1, otherwise y = 0. x = 1:100; y = [0, 0, 0, 1, 1, 1, 1, zeros(1, 93)]; % instead of theta' * x, I'm trying to create % a non-linear decision boundary. % So instead of y = theta_0 + theta_1 * x, I use: function result = h(x, theta) result = sigmoid(theta(1) + theta(2) * x + theta(3) * ((x - theta(4))^2));
Created Mar 10, 2016
Logistic regression for orange vs grapefruit
View logistic_regression_grapefruit.m
 % data x = [1, 2, 3, 4, 5, 6]; y = [0, 0, 0, 1, 1, 1]; % function to calculate the predicted value function result = h(x, t0, t1) result = sigmoid(t0 + t1 * x); end % sigmoid function
Created Mar 9, 2016
Linear regression with fminunc
View linear_regression_with_fminunc.m
 x = [1000, 2000, 4000]; y = [200000, 250000, 300000]; % given a theta_0 and theta_1, this function calculates % their cost. We don't need this function, strictly speaking... % but it is nice to print out the costs as gradient descent iterates. % We should see the cost go down every time the values of theta get updated. function distance = cost(theta) theta_0 = theta(1); theta_1 = theta(2);
Created Feb 22, 2016
View logistic_regression.m
 % my training data. % so if x > 3 || x < 7, y = 1, otherwise y = 0. x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; y = [0, 0, 0, 1, 1, 1, 0, 0, 0, 0]; % instead of theta' * x, I'm trying to create % a non-linear decision boundary. function result = h(x, theta) result = sigmoid(theta(1) + theta(2) * x + theta(3) * ((x - theta(4))^2)); end
Last active Aug 31, 2018
Linear regression in Octave
View regression.m
 % scaled features. % x = square feet % y = sale price x = [1, 2, 4]; y = [2, 2.5, 3]; % function to calculate the predicted value function result = h(x, t0, t1) result = t0 + t1 * x; end
Last active Nov 12, 2015
kcombinations
View Main.hs
 {-# LANGUAGE MultiWayIf #-} import Data.List import Control.Monad import Control.Monad.Trans.Writer kcombinations n arr = snd . runWriter \$ combos [] 1 n arr combos :: (Eq a) => [a] -> Int -> Int -> [a] -> Writer [[a]] () combos acc step n array = forM_ (zip array [1..]) \$ \(val, i) -> if | val `elem` acc -> return ()
Created Mar 26, 2015
View keybase.md

### Keybase proof

I hereby claim:

• I am egonschiele on github.
• I have a public key whose fingerprint is 31AE C08A 8B28 F75B 596D 8146 0264 FC99 3D75 484F

To claim this, I am signing this object:

Last active Jul 20, 2018
View why.markdown

## If you have already taken a course in algorithms, why read Grokking Algorithms (manning.com/bhargava)?

If you were learning graph algorithms, which approach would you prefer:

1. Imagine you have to take public transit from your home to your office. How do you figure out the fastest route? Use graph algorithms! OR

2. We can choose between two standard ways to represent a graph G = (V, E): as a collection of adjacency lists or as an adjacency matrix. Either way applies to both directed and undirected graphs.

I prefer the first way: lead with lots of examples, and clear writing. The second way is an excerpt from "Introduction to Algorithms"...that's how they start their section on graph algorithms.

Created Feb 12, 2014
Notes on cameras
View notes_on_cameras.markdown

# Notes on cameras

## Focal length

### Prime (fixed) lens

If it says 17mm, it's fixed at that...you can't zoom in or out. Advantages: cheaper.

You can’t perform that action at this time.