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 [J ,grad] = nnCostFunction(nn_params, ... | |
input_layer_size, ... | |
hidden_layer_size, ... | |
num_labels, ... | |
X, y, lambda) | |
Theta1 = reshape(nn_params(1:hidden_layer_size * ... | |
(input_layer_size + 1)), ... | |
hidden_layer_size, (input_layer_size + 1)); |
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 [X, fX, i] = fmincg(f, X, options, P1, P2, P3, P4, P5) | |
% Minimize a continuous differentialble multivariate function. Starting point | |
% is given by "X" (D by 1), and the function named in the string "f", must | |
% return a function value and a vector of partial derivatives. The Polack- | |
% Ribiere flavour of conjugate gradients is used to compute search directions, | |
% and a line search using quadratic and cubic polynomial approximations and the | |
% Wolfe-Powell stopping criteria is used together with the slope ratio method | |
% for guessing initial step sizes. Additionally a bunch of checks are made to | |
% make sure that exploration is taking place and that extrapolation will not | |
% be unboundedly large. The "length" gives the length of the run: if it is |
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 W = randInitializeWeights(L_in, L_out) | |
epsilon_init = 0.12; | |
W = rand(L_out, 1 + L_in) * 2 * epsilon_init - epsilon_init; | |
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
function g = sigmoidGradient(z) | |
g1 = 1 ./ (1 + exp(-z)); | |
g = g1 .* (1 - g1); | |
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
function p = predict(Theta1, Theta2, X) | |
m = size(X, 1); | |
h1 = sigmoid([ones(m, 1) X] * Theta1'); | |
h2 = sigmoid([ones(m, 1) h1] * Theta2'); | |
[dummy, p] = max(h2, [], 2); | |
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
function g = sigmoid(z) | |
g = 1.0 ./ (1.0 + exp(-z)); | |
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
X = [] | |
numImages = 0 | |
for num=1:1000 % upto 1000 fonts; increase if needed | |
filename = strcat('dataset/',strcat(num2str(num),'.png')); | |
if ~exist(filename,'file') | |
continue | |
end | |
disp(filename); | |
image = imread(filename); |
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
/** | |
* Letters. | |
* | |
* Draws letters to the screen. This requires loading a font, | |
* setting the font, and then drawing the letters. | |
*/ | |
PFont f; | |
void setup() { | |
size(571, 161); | |
// Create the font |
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 argparse, re, math, sys, time, os | |
class HuffmanNode: | |
""" | |
Node Object that supports Merging operation as in the | |
Huffman Encoding Algorithm. | |
self.alphabet: list of characters at a node which share | |
a common ancestors in the Huffman Tree. | |
self.count: number of times the element in the list of |
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
eval$s=%q(eval(%w(B=92.chr;g=32.chr;puts(eval(%q(N=10.chr;n=0;e=->s{Q[Q[s,B],?"].K(N,B+?n)};E=->s{'("'+e[s]+'")'};d=->s,t=?"{s.K(t){t+t}};def~f(s,n)s.K(/.{1,#{n*255}}/m){yield$S=E[$s=$&]}end;Q=->s,t=?${s.K(t){B+ | |
$&}};R=";return~0;";V=->s,a,z{s.K(/(#{B*4})+/){a+"#{$&.size/2}"+z}};C=%w(System.Console~Write);$C=C*?.;$D="program~QR";$G="~contents~of"+$F="~the~mix!g~bowl";$L="public~static";"object~QR~extends~App{#{f(%((disp | |
lay~"#{e[%(#{f(%[echo~-En~"#{Q[e[e["Transcript~show:~'#{d[%(fun~p~n=Z(Int.toSJ~n`x5e"~");p~0;p~0;p~130;List.tabulate(127,p);SJ.map(fn~c=>(p(3+ord~c);Z"-1~0~";c))#{E[%(proc~f~{n}~{sJ~repeat~"Y"~$n};puts~a::=`x7e[ | |
reK~-all~{.}~"#{V[Q[e["!t~mX{Z#{d[E[%(module~QR;!itial~beg!~#{f(%(Module~QR:Sub~MX:Dim~s,n,i,c~As~Object:n=Chr(10):For~Each~c~!"#{d["<?xml#{O="~version='1.0'"}?><?xml-#{I="stylesheet"}~type='text/xsl'href='QR.xs | |
lt'?><xsl:#{I+O}~xmlns:xsl='http://www.w3.org/1999/`x58SL/Transform'><xsl:output~method='text'/><#{U="xsl:template"}~match='/'><`x21[CDATA[#{%(H,format="#{y="";f("^H{-}{txt}{#{ |