Skip to content

Instantly share code, notes, and snippets.

View arunreddy's full-sized avatar
🎯
Focusing

Arun Reddy arunreddy

🎯
Focusing
View GitHub Profile
StandardSGD <LogisticRegressionFunction<>> sgdOpt(lrf);
sgdOpt.MaxIterations() = maxIterations;
sgdOpt.Tolerance() = tolerance;
sgdOpt.StepSize() = stepSize;
Log::Info << "Training model with SGD optimizer." << endl;
// This will train the model.
model.Train(sgdOpt);
@arunreddy
arunreddy / momentum.cpp
Last active March 2, 2017 02:36
Momentum
// Without policy class..
Optimize(arma::mat& iterate){
arma::mat v = arma::zeros<arma::mat>(iterate.n_rows, iterate.n_cols);
for(;;){
v = momentum*v - stepSize * gradient;
iterate += v;
}
/**
* Stochastic Gradient Descent is a technique for minimizing a function which
* can be expressed as a sum of other functions. That is, suppose we have
*
*/
class SGDMomentum{
public:
/**
* Constructor
@arunreddy
arunreddy / keybase.md
Created August 3, 2016 22:19
keybase.md

Keybase proof

I hereby claim:

  • I am arunreddy on github.
  • I am arunreddy (https://keybase.io/arunreddy) on keybase.
  • I have a public key whose fingerprint is 70DE 4849 57EB F197 1C6C B887 AB43 972A 33B0 3B5C

To claim this, I am signing this object:

@arunreddy
arunreddy / qsub.py
Last active May 17, 2016 15:20 — forked from astrofrog/qsub.py
Submitting jobs via qsub in Python
import os
import random
import string
import tempfile
import subprocess
def random_id(length=8):
return ''.join(random.sample(string.ascii_letters + string.digits, length))
TEMPLATE_SERIAL = """
@arunreddy
arunreddy / ldaSynthData.jl
Created December 22, 2015 18:22
Synthetic Data using LDA Generative Model
using PyPlot;
using Distributions;
TOPIC_N = 5;
VOCABULARY_SIZE = 1000;
DOC_NUM = 100;
TERM_PER_DOC = 200;
X = zeros(DOC_NUM,VOCABULARY_SIZE);
@arunreddy
arunreddy / arch-linux-install
Created December 5, 2015 04:06 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@arunreddy
arunreddy / splitPosAndNeg.jl
Last active October 21, 2015 02:32
Replacing negative values with zeroes.
a = [1 -2 ; -3 4];
aPos = (a.>0.0).*a;
aInd = (a.<0.0).*a*-1;
@arunreddy
arunreddy / haarFeatures.c
Created September 19, 2014 11:44
Calculate number of haar features - Viola Jones Face Detection.
#include <stdio.h>
int main()
{
int i, x, y, sizeX, sizeY, width, height, count, c;
/* All five shape types */
const int features = 5;
const int feature[][2] = {{2,1}, {1,2}, {3,1}, {1,3}, {2,2}};
const int frameSize = 24;
@arunreddy
arunreddy / CommandUtils.java
Created June 19, 2014 23:19
Execute command in java.
CmdUtils.executeCommand("SMILExtract -C /media/MEDIA02/msthesis/emobase2010.conf -I example_audio1.wav -O targetFile.arff -label1 );
public static String executeCommand(String command) {
StringBuffer output = new StringBuffer();
Process p;
try {
p = Runtime.getRuntime().exec(command);
p.waitFor();