Re: [R] [Rd] TensorFlow in R

2016-04-02 Thread Bernd Bischl

Hi,

from what I know there is a current GSOC 2016 project proposal.
(but not accepted yet)

https://github.com/rstats-gsoc/gsoc2016/wiki
https://github.com/rstats-gsoc/gsoc2016/wiki/DeepLearnR-tensorFlow-Object-system-for-R


Is that of interest?

Best,

Bernd


On 01.04.2016 18:32, Axel Urbiz wrote:

Hi All,

I didn't have much success through my Google search in finding any active
R-related projects to create a wrapper around TensorFlow in R. Anyone know
if this is on the go?

Thanks,
Axel.

[[alternative HTML version deleted]]

__
r-de...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Combinatorial problem

2009-08-12 Thread Bernd Bischl

Dimitris Rizopoulos wrote:

you could try something like the following:

groups <- list(gp1 = 1:3, gp2 = 4:5, gp3 = 6:7,
   gp4 = 8:10, gp5 = 11)

combn(5, 2, function (x) expand.grid(groups[x]), simplify = FALSE)
combn(5, 3, function (x) expand.grid(groups[x]), simplify = FALSE)
combn(5, 4, function (x) expand.grid(groups[x]), simplify = FALSE)


and this transforms it nicely into a single matrix

y <- combn(5, 2, function (x) as.matrix(expand.grid(groups[x])), 
simplify = FALSE)

Reduce(rbind, y)


Bernd

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Nominal variables in SVM?

2009-08-12 Thread Bernd Bischl

Noah Silverman wrote:

That makes sense.

I my data is already nominal, I need to "expand" a single column into 
several binary ones.


Is there an easy function to do this in R, or do I need to create 
something from scratch?  (If I have to create my own, any suggestions?)


Thanks!

-N

Hi Noah,

read up on the "contrasts" and the "model.matrix" functions.

Although if you use the kernlab package for SVMs, factors get treated in 
this way by default, you just need to use the formula interface.


Bernd

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Nominal variables in SVM?

2009-08-13 Thread Bernd Bischl

Noah Silverman wrote:

Thanks for all the suggestions.

My data was loaded in from a csv file with about 80 columns (3 of these 
columns are nominal)  no specific settings for the nominal columns.


Currently, if I call svm (e1071), I get an error about the nominal column.

Do I need to tell R to change the column to a factor?  i.e. foo$color <- 
factor(foo$color)


  
That might be a possible problem, but before you try something, simply 
investigate whats wrong now:


- do str(mydata) to check columntypes of you data.frame. if somethings 
wrong there for your 3 mentioned, do indeed use as.factor (or import 
yout data in a better way)
- are you sure you use the formula interface for svm from e1071. If you 
check the help page, you will see that it clearly supports factors.


Otherwise paste str(mydata) and your call to svm here.

Bernd

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] email notification after error

2009-08-16 Thread Bernd Bischl

Patrick Connolly wrote:

On Thu, 13-Aug-2009 at 05:48PM -0700, caltechneurostudy wrote:

|> 
|> Does anybody know if it's possible to have R send an email or execute an

|> additional line of code in case an error is generated from a running script?
|> I am running R on a cluster and would like to have it kill the job if R
|> generates an error, but as it is, the job just keeps running until the
|> wallclock is done.

?try
?system
  

concerning mails, maybe you find this helpful:

http://cran.r-project.org/web/packages/sendmailR/index.html

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Submit a R job to a server

2009-08-27 Thread Bernd Bischl

Noah Silverman wrote:

Deb,

I generally run my larger R tasks on a server.

Here is my workflow.

1) Write an R script using a text editor. (There are many popular ones.)
2) FTP the R script to your server.
3) SSH into the server
4) Run R
5) Run the script that you uploaded from the R process you just started.

  

Dear Debrata,

if this is what you mean by "submitting a job", so just login in 
remotely and starting the job manually,

you can do what Noah suggested in a more convenient way:

- many Scp / Ftp applications allow "editing on the server", meaning you 
don't have to transfer the file after every change manually. I use a 
combination of winscp and Notepad++ normally for this.


- read the man pages of the unix command screen (by typing "man screen" 
on the server) to see how to get a permanent session that stays there 
for you, after you detach from it.


Be sure to test your scripts on your local system before with easy (and 
faster examples). For packages: The same requirements apply to the R on 
server as for your local system, you simply need the same packages there.


Bernd

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] SVM coefficients

2009-08-31 Thread Bernd Bischl

Noah Silverman wrote:

Steve,

That doesn't work.

I just trained an SVM with 80 variables.
svm_model$coefs gives me  a list of 10,000 items.  My training set is 
30,000 examples of 80 variables, so I have no idea what the 10,000 
items represent.


There should be some attribute that lists the "weights" for each of 
the 80 variables.




Hi Noah,
does this help?

# make binary problem from iris
mydata <- iris[1:100,]
mydata$Species <- mydata$Species[,drop=T]
str(mydata)

#'data.frame':   100 obs. of  5 variables:
# $ Sepal.Length: num  5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
# $ Sepal.Width : num  3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
# $ Petal.Length: num  1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
# $ Petal.Width : num  0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
# $ Species : Factor w/ 2 levels "setosa","versicolor": 1 1 1 1 1 1 
1 1 1 1 ...


# inputs
X <- as.matrix(mydata[,-5])

# train svm with linear kernel,
# to make later stuff easier we dont scale
m <- svm(Species~., data=mydata, kernel="linear", scale=F)

# 
# Number of Support Vectors:  3

# we get 3 support vectors, these are weights for training cases
# or in svm therory speak: our dual variables alpha
m$coefs[,1]
# [1]  0.67122500  0.07671148 -0.74793648

# these are the indices of the cases to which the alphas belong
m$index
# [1] 24 42 99

# lets calculate the primary vars from the dual ones
# svm theory says
# w = sum x_i alpha_i
w <- t(m$coefs) %*% X[m$index,]
#Sepal.Length Sepal.Width Petal.Length Petal.Width
# [1,]  -0.04602689   0.5216377-1.003002  -0.4641042

# test whether the above was nonsense.
# e1071 predict
p1 <- predict(m, newdata=mydata, decision.values=T)
p1 <- attr(p1, "decision.values")
# do it manually with w, simple linear predictor with intercept -m$rho
p2 <- X %*% t(w) - m$rho

# puuuh, lucky
max(abs(p1 - p2))
# [1] 6.439294e-15


Bernd

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] List of tags in roxygen and use for S4 classes?

2009-09-04 Thread Bernd Bischl

Rainer M Krug wrote:

Hi

is there a list of all roxygen tags which are available? I couldn't find them.

I am asking specifically towards the use of roxygen in documenting S4
classes - is that implemented yet (i am using roxygen 0.1 from CRAN at
the moment)?

Thanks

Rainer


  
I am using it do document a now rather large S4 package - with the new 
development version on rforge (its 0.1-1).


It basically works, _but_ :
- It took me quite some time to write everything "the way roxygen wants it"
- Error messages are often not very informative.
- Many (legal) ways to specify S4 classes / signatures will produce 
errors, you need to be very "verbose".

- Even disregarding there are still some clear bugs left IMHO.

I would also wish for a better (online) documentation, as I think the 
general idea of roxygen is great.


So it's worth a try but expect some obstacles. There's also a roxygen 
devel list, where you could go with questions.
I got some S4 examples from one of the recent roxygen talks, If you want 
them I could forward those.


Bernd

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.