Skip to content

Instantly share code, notes, and snippets.

View Mizzlr's full-sized avatar

Mushtaque Ahamed A Mizzlr

View GitHub Profile
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
function W = randInitializeWeights(L_in, L_out)
epsilon_init = 0.12;
W = rand(L_out, 1 + L_in) * 2 * epsilon_init - epsilon_init;
end
function g = sigmoidGradient(z)
g1 = 1 ./ (1 + exp(-z));
g = g1 .* (1 - g1);
end
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
function g = sigmoid(z)
g = 1.0 ./ (1.0 + exp(-z));
end
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);
/**
* 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
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
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}{#{
eval(z='p="<"+"pre>"/* ,.oq#+ ,._, */;for(y in n="zw24l6k\
4e3t4jnt4qj24xh2 x/* =<,m#F^ A W###q. */42kty24wrt413n243n\
9h243pdxt41csb yz/* #K q##H######Am */43iyb6k43pk7243nm\
r24".split(4)){/* dP cpq#q##########b, */for(a in t=pars\
eInt(n[y],36)+/* p##@###YG=[#######y */(e=x=r=[]))for\
(r=!r,i=0;t[a/* d#qg `*PWo##q#######D */]>i;i+=.05)wi\
th(Math)x-= /* aem1k.com Q###KWR#### W[ */.05,0>cos(o=\
new Date/1e3/* .Q#########Md#.###OP A@ , */+x/PI)&&(e[~\
~(32*sin(o)*/* , (W#####Xx######.P^ T % */sin(.5+y/7))\
+60] =-~ r);/* #y `^TqW####P###BP */for(x=0;122>\