Posts Tagged ‘ Algorithm ’

Machine Learning Ex 5.2 – Regularized Logistic Regression

October 25, 2011
By
Machine Learning Ex 5.2 – Regularized Logistic Regression

Now we move on to the second part of the Exercise 5.2, which requires to implement regularized logistic regression using Newton’s Method. Plot the data:

Read more »

Algorithm Whisperer

April 6, 2011
By
Algorithm Whisperer

I was staring at my favorite trading algorithm the other day and I could swear it wanted to tell me something. I've made contact with it in the past, but our conversations pretty much ran along the lines of "What position are you in the market?" to whi...

Read more »

Subsampling for dummies

July 8, 2010
By

A little piece of code dealing with the subsampling of matrices, in R. Useful if you want to use something akin to bootstrap, or just check the size of your sample with regard to various statistics.

Read more »

A von Mises variate…

March 25, 2010
By
A von Mises variate…

Inspired from a mail that came along the previous random generation post the following question rised : How to draw random variates from the Von Mises distribution? First of all let’s check the pdf of the probability rule, it is , for . Ok, I admit that Bessels functions can be a bit frightening,...

Read more »

Welsh test by permutations

November 1, 2009
By
Welsh test by permutations

WelshPerm <- function(response,variable,nperm=999,...){ base <- oneway.test(response~variable,...) base.p <- base$p.value base.W <- base$statistic count <- 1 # Permutation loop for(i in 1:nperm){ SAMPLE <- sample(response) welsh.perm<-oneway.test(SAMPLE~variable,...) welsh.perm.p<-welsh.perm$p.value welsh.perm.W<-welsh.perm$statistic if(abs(welsh.perm.W) >= abs(base.W)) {count <- count+1} } result=count/(nperm+1) return(result) }

Read more »

Sorting a matrix/data.frame on a column

October 30, 2009
By
Sorting a matrix/data.frame on a column

mat.sort <- function(mat,n) { mat),] <- mat return(mat) } a <- matrix(rnorm(100),ncol=10) mat.sort(a,1)

Read more »

GenEstim : A simple genetic algorithm for parameters estimation

October 18, 2009
By
GenEstim : A simple genetic algorithm for parameters estimation

The GenEstim function presented here uses a very simple genetic algorithm to estimate parameters. The function returns the best estimated set of parameters ($estim), the AIC ($information) at each generation, and the cost of the best model ($bestcost) at each generation. Results of running the program with a logistic function : Logis = function(x,p)...

Read more »

An algorithm to find local extrema in a vector

May 3, 2009
By
An algorithm to find local extrema in a vector

I spend some time looking for an algorithm to find local extrema in a vector (time series). The solution I used is to “walk” through the vector by step larger than 1, in order to retain only one value even when the values are very noisy (see the picture at the end of the...

Read more »