Re: [R] How to apply a function to every element of a dataframe, when the function uses for each colummn and row different values to calculate with?

2013-08-20 Thread Wuming Gong
Hi Jacqueline, (1) x <- as.matrix(d[rownames(d) != 'nc', colnames(d) != 'nr']) nc <- d['nc', ] nr <- d[, 'nr'] e <- (x - nc %o% nr)^2 / (nc %o% nr / 2) (2) if I understand correctly, ?max.col is what you need. Wuming On Tue, Aug 20, 2013 at 11:43 AM, Jacqueline Oehri < jacqueline.oe...@gmai

Re: [R] kmeans clustering on large but sparse matrix

2013-12-06 Thread Wuming Gong
Hi Lishu, I run into the similar large-scale problems recently. I used a parallel SGD k-means described in this paper for my problem: http://www.eecs.tufts.edu/~dsculley/papers/fastkmeans.pdf Let n be the samples, k be the number of clusters, and m be the number of nodes, 1. First, each node r

Re: [R] tune an support vector machine

2013-12-06 Thread Wuming Gong
Hi Uwe, It looks SVM in e1071 and Kernlab does not support feature selection, but you can take a look at package penalizedSVM ( http://cran.r-project.org/web/packages/penalizedSVM/penalizedSVM.pdf). Or you can implement a SVM-RFE ( http://axon.cs.byu.edu/Dan/778/papers/Feature%20Selection/guyon*.

[R] kernlab's ksvm method freeze

2011-12-20 Thread Wuming Gong
Hi Heiko, I run into a similar problem recently. I have a custom kernel which have some small negative eigenvalues, possibly due to numerical error. I first used ksvm(K, y) to train the model, but ksvm() freeze (no response to Ctrl+c). I thought it was due to positive definiteness of the matrix