[R] kernlab's ksvm method freeze

2009-11-29 Thread Heiko Strathmann
Hello,

I am using kernlab to do some binary classification on aminoacid
strings.

I am using a custom kernel, so i use the kernel="matrix" option of the
ksvm method.

My (normalized) kernel matrix is of size 1309*1309, my results vector
has the same length.

I am using C-svc.

My kernlab call is something similiar to this:

ksvm(kernel="matrix", kernelMatrix, trainingDataYs, type="C-svc",
cross=10, C=2)

To this point, everything works fine.

But now, i want to do a search for a good C Parameter, so I call the
ksvm method multiple times in a loop, with changing parameters.
This loop freezes after a few iterations.


The following simple example also freezes after few iterations (the
number varies). See that the ksvm call is always the same in every
iteration:

for (i in c(1:20)) {
print(i)
ksvm(kernel="matrix", kernelMatrix, trainingDataYs,
type="C-svc",
cross=10, C=2)
}


Does anybody have an idea what causes this? I am new to R and kernlab,
perhaps i missed something?

I put my workspace online, which contains the kernel matrix and the
training labels. Simply load workspace, kernlab library and paste the
example code to reproduce:
http://www-stud.uni-due.de/~sfhestra/

I am using R version 2.10.0 and kernlab 0.9-9.

Thanks for your help!

Regards,
Heiko Strathmann

__
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] kernlab's ksvm method freeze

2009-11-29 Thread Heiko Strathmann
Hello again,

the freeze seems to depend on the kernel matrix.
With another kernel matrix of similiar size, gernerated with the same
kernel, but on another dataset, there is no freeze.

I have put a workspace with the working matrix and one with the freezing
matrix online for testing (see old email)
http://www-stud.uni-due.de/~sfhestra/

In my eyes this behavior is really strange, and i have no clue, what to
do to solve this.

Regards,
Heiko Strathmann

Am Sonntag, den 29.11.2009, 14:21 +0100 schrieb Heiko Strathmann:
> Hello,
> 
> I am using kernlab to do some binary classification on aminoacid
> strings.
> 
> I am using a custom kernel, so i use the kernel="matrix" option of the
> ksvm method.
> 
> My (normalized) kernel matrix is of size 1309*1309, my results vector
> has the same length.
> 
> I am using C-svc.
> 
> My kernlab call is something similiar to this:
> 
> ksvm(kernel="matrix", kernelMatrix, trainingDataYs, type="C-svc",
> cross=10, C=2)
> 
> To this point, everything works fine.
> 
> But now, i want to do a search for a good C Parameter, so I call the
> ksvm method multiple times in a loop, with changing parameters.
> This loop freezes after a few iterations.
> 
> 
> The following simple example also freezes after few iterations (the
> number varies). See that the ksvm call is always the same in every
> iteration:
> 
> for (i in c(1:20)) {
> print(i)
> ksvm(kernel="matrix", kernelMatrix, trainingDataYs,
> type="C-svc",
> cross=10, C=2)
> }
> 
> 
> Does anybody have an idea what causes this? I am new to R and kernlab,
> perhaps i missed something?
> 
> I put my workspace online, which contains the kernel matrix and the
> training labels. Simply load workspace, kernlab library and paste the
> example code to reproduce:
> http://www-stud.uni-due.de/~sfhestra/
> 
> I am using R version 2.10.0 and kernlab 0.9-9.
> 
> Thanks for your help!
> 
> Regards,
> Heiko Strathmann
> 
>

__
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] kernlab's ksvm method freeze

2009-11-29 Thread Heiko Strathmann
Hello uwe,
Thanks for trying out.
the freeze happens after about 10 to 20 iterations. Did you try as many?

Am Sonntag, den 29.11.2009, 17:22 +0100 schrieb Uwe Ligges:
> I just tried
> 
> ksvm(kernel="matrix", kernelMatrix, trainingDataYs, type="C-svc", 
> cross=10, C=2)
> 
> several times on both workspaces and both returned some results after a 
> couple of seconds under the same versions (R version 2.10.0 and kernlab 
> 0.9-9.) under Windows XP.
> 
> There mist be something else going on...
> 
> Best wishes,
> Uwe Ligges
> 
> 
> 
> 
> 
> Heiko Strathmann wrote:
> > Hello again,
> > 
> > the freeze seems to depend on the kernel matrix.
> > With another kernel matrix of similiar size, gernerated with the same
> > kernel, but on another dataset, there is no freeze.
> > 
> > I have put a workspace with the working matrix and one with the freezing
> > matrix online for testing (see old email)
> > http://www-stud.uni-due.de/~sfhestra/
> > 
> > In my eyes this behavior is really strange, and i have no clue, what to
> > do to solve this.
> > 
> > Regards,
> > Heiko Strathmann
> > 
> > Am Sonntag, den 29.11.2009, 14:21 +0100 schrieb Heiko Strathmann:
> >> Hello,
> >>
> >> I am using kernlab to do some binary classification on aminoacid
> >> strings.
> >>
> >> I am using a custom kernel, so i use the kernel="matrix" option of the
> >> ksvm method.
> >>
> >> My (normalized) kernel matrix is of size 1309*1309, my results vector
> >> has the same length.
> >>
> >> I am using C-svc.
> >>
> >> My kernlab call is something similiar to this:
> >>
> >> ksvm(kernel="matrix", kernelMatrix, trainingDataYs, type="C-svc",
> >> cross=10, C=2)
> >>
> >> To this point, everything works fine.
> >>
> >> But now, i want to do a search for a good C Parameter, so I call the
> >> ksvm method multiple times in a loop, with changing parameters.
> >> This loop freezes after a few iterations.
> >>
> >>
> >> The following simple example also freezes after few iterations (the
> >> number varies). See that the ksvm call is always the same in every
> >> iteration:
> >>
> >> for (i in c(1:20)) {
> >> print(i)
> >> ksvm(kernel="matrix", kernelMatrix, trainingDataYs,
> >> type="C-svc",
> >> cross=10, C=2)
> >> }
> >>
> >>
> >> Does anybody have an idea what causes this? I am new to R and kernlab,
> >> perhaps i missed something?
> >>
> >> I put my workspace online, which contains the kernel matrix and the
> >> training labels. Simply load workspace, kernlab library and paste the
> >> example code to reproduce:
> >> http://www-stud.uni-due.de/~sfhestra/
> >>
> >> I am using R version 2.10.0 and kernlab 0.9-9.
> >>
> >> Thanks for your help!
> >>
> >> Regards,
> >> Heiko Strathmann
> >>
> >>
> > 
> > __
> > 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.

__
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] kernlab's ksvm method freeze

2009-11-29 Thread Heiko Strathmann
I tried out the code you wrote, it also works for me, but it lacks a
parameter i use in my code.

The problem (at this computer) seems to be this "cross"-parameter of
ksvm - if I, for example, add the parameter cross=10, i get the old
problem:

library("kernlab")
load("freeze_workspace.RDATA")
replicate(10, ksvm(kernel="matrix", kernelMatrix, trainingDataYs, type="C-svc", 
C=2, cross=10))

gets me a frozen R process, CTRL-C does not work anymore, and the only thing 
left is to kill it.

(for cross < 4, the thing still works)

(I also just reinstalled my Ubuntu and R)

Heiko Strathmann


Am Sonntag, den 29.11.2009, 19:52 +0100 schrieb Uwe Ligges:
> 
> Heiko Strathmann wrote:
> > Hello uwe,
> > Thanks for trying out.
> > the freeze happens after about 10 to 20 iterations. Did you try as many?
> 
> I just tried again:
> 
> library("kernlab")
> load("freeze_workspace.RDATA")
> replicate(100, ksvm(kernel="matrix", kernelMatrix, trainingDataYs, 
> type="C-svc", C=2))
> 
> and everything is still fine (same on Linux).
> 
> Uwe Ligges
> 
> 
> 
> > Am Sonntag, den 29.11.2009, 17:22 +0100 schrieb Uwe Ligges:
> >> I just tried
> >>
> >> ksvm(kernel="matrix", kernelMatrix, trainingDataYs, type="C-svc", 
> >> cross=10, C=2)
> >>
> >> several times on both workspaces and both returned some results after a 
> >> couple of seconds under the same versions (R version 2.10.0 and kernlab 
> >> 0.9-9.) under Windows XP.
> >>
> >> There mist be something else going on...
> >>
> >> Best wishes,
> >> Uwe Ligges
> >>
> >>
> >>
> >>
> >>
> >> Heiko Strathmann wrote:
> >>> Hello again,
> >>>
> >>> the freeze seems to depend on the kernel matrix.
> >>> With another kernel matrix of similiar size, gernerated with the same
> >>> kernel, but on another dataset, there is no freeze.
> >>>
> >>> I have put a workspace with the working matrix and one with the freezing
> >>> matrix online for testing (see old email)
> >>> http://www-stud.uni-due.de/~sfhestra/
> >>>
> >>> In my eyes this behavior is really strange, and i have no clue, what to
> >>> do to solve this.
> >>>
> >>> Regards,
> >>> Heiko Strathmann
> >>>
> >>> Am Sonntag, den 29.11.2009, 14:21 +0100 schrieb Heiko Strathmann:
> >>>> Hello,
> >>>>
> >>>> I am using kernlab to do some binary classification on aminoacid
> >>>> strings.
> >>>>
> >>>> I am using a custom kernel, so i use the kernel="matrix" option of the
> >>>> ksvm method.
> >>>>
> >>>> My (normalized) kernel matrix is of size 1309*1309, my results vector
> >>>> has the same length.
> >>>>
> >>>> I am using C-svc.
> >>>>
> >>>> My kernlab call is something similiar to this:
> >>>>
> >>>> ksvm(kernel="matrix", kernelMatrix, trainingDataYs, type="C-svc",
> >>>> cross=10, C=2)
> >>>>
> >>>> To this point, everything works fine.
> >>>>
> >>>> But now, i want to do a search for a good C Parameter, so I call the
> >>>> ksvm method multiple times in a loop, with changing parameters.
> >>>> This loop freezes after a few iterations.
> >>>>
> >>>>
> >>>> The following simple example also freezes after few iterations (the
> >>>> number varies). See that the ksvm call is always the same in every
> >>>> iteration:
> >>>>
> >>>> for (i in c(1:20)) {
> >>>> print(i)
> >>>> ksvm(kernel="matrix", kernelMatrix, trainingDataYs,
> >>>> type="C-svc",
> >>>> cross=10, C=2)
> >>>> }
> >>>>
> >>>>
> >>>> Does anybody have an idea what causes this? I am new to R and kernlab,
> >>>> perhaps i missed something?
> >>>>
> >>>> I put my workspace online, which contains the kernel matrix and the
> >>>> training labels. Simply load workspace, kernlab library and paste the
> >>>> example code to reproduce:
> >>>> http://www-stud.uni-due.de/~sfhestra/
> >>>>
> >>>> I am using R version 2.10.0 and kernlab 0.9-9.
> >>>>
> >>>> Thanks for your help!
> >>>>
> >>>> Regards,
> >>>> Heiko Strathmann
> >>>>
> >>>>
> >>> __
> >>> 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.
> > 
> >

__
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] kernlab's ksvm method freeze

2009-11-30 Thread Heiko Strathmann
Ok, i reported it.
thanks for trying it out again.

Am 30. November 2009 11:06 schrieb Uwe Ligges <
lig...@statistik.tu-dortmund.de>:

> My apologies, that must have been a copy&paste error and the essential
> argument got lost. I can reproduce it now under R-2.10.0 both Windows and
> Linux.
>
> Please report your findings to the package maintainer who might be able to
> debug this under Linux (probably easier than under Windows).
>
> Best,
>
> Uwe Ligges
>
>
>
>
>
>
> Heiko Strathmann wrote:
>
>> I tried out the code you wrote, it also works for me, but it lacks a
>> parameter i use in my code.
>>
>> The problem (at this computer) seems to be this "cross"-parameter of
>> ksvm - if I, for example, add the parameter cross=10, i get the old
>> problem:
>>
>> library("kernlab")
>> load("freeze_workspace.RDATA")
>> replicate(10, ksvm(kernel="matrix", kernelMatrix, trainingDataYs,
>> type="C-svc", C=2, cross=10))
>>
>> gets me a frozen R process, CTRL-C does not work anymore, and the only
>> thing left is to kill it.
>>
>> (for cross < 4, the thing still works)
>>
>> (I also just reinstalled my Ubuntu and R)
>>
>> Heiko Strathmann
>>
>>
>> Am Sonntag, den 29.11.2009, 19:52 +0100 schrieb Uwe Ligges:
>>
>>> Heiko Strathmann wrote:
>>>
>>>> Hello uwe,
>>>> Thanks for trying out.
>>>> the freeze happens after about 10 to 20 iterations. Did you try as many?
>>>>
>>> I just tried again:
>>>
>>> library("kernlab")
>>> load("freeze_workspace.RDATA")
>>> replicate(100, ksvm(kernel="matrix", kernelMatrix, trainingDataYs,
>>> type="C-svc", C=2))
>>>
>>> and everything is still fine (same on Linux).
>>>
>>> Uwe Ligges
>>>
>>>
>>>
>>>  Am Sonntag, den 29.11.2009, 17:22 +0100 schrieb Uwe Ligges:
>>>>
>>>>> I just tried
>>>>>
>>>>> ksvm(kernel="matrix", kernelMatrix, trainingDataYs, type="C-svc",
>>>>> cross=10, C=2)
>>>>>
>>>>> several times on both workspaces and both returned some results after a
>>>>> couple of seconds under the same versions (R version 2.10.0 and kernlab
>>>>> 0.9-9.) under Windows XP.
>>>>>
>>>>> There mist be something else going on...
>>>>>
>>>>> Best wishes,
>>>>> Uwe Ligges
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Heiko Strathmann wrote:
>>>>>
>>>>>> Hello again,
>>>>>>
>>>>>> the freeze seems to depend on the kernel matrix.
>>>>>> With another kernel matrix of similiar size, gernerated with the same
>>>>>> kernel, but on another dataset, there is no freeze.
>>>>>>
>>>>>> I have put a workspace with the working matrix and one with the
>>>>>> freezing
>>>>>> matrix online for testing (see old email)
>>>>>> http://www-stud.uni-due.de/~sfhestra/<http://www-stud.uni-due.de/%7Esfhestra/>
>>>>>>
>>>>>> In my eyes this behavior is really strange, and i have no clue, what
>>>>>> to
>>>>>> do to solve this.
>>>>>>
>>>>>> Regards,
>>>>>> Heiko Strathmann
>>>>>>
>>>>>> Am Sonntag, den 29.11.2009, 14:21 +0100 schrieb Heiko Strathmann:
>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I am using kernlab to do some binary classification on aminoacid
>>>>>>> strings.
>>>>>>>
>>>>>>> I am using a custom kernel, so i use the kernel="matrix" option of
>>>>>>> the
>>>>>>> ksvm method.
>>>>>>>
>>>>>>> My (normalized) kernel matrix is of size 1309*1309, my results vector
>>>>>>> has the same length.
>>>>>>>
>>>>>>> I am using C-svc.
>>>>>>>
>>>>>>> My kernlab call is something similiar to this:
>>>>>>>
>>>>>>> ksvm(kernel="matrix", kernelMatrix, trainingDataYs, t

Re: [R] kernlab's ksvm method freeze

2009-11-30 Thread Heiko Strathmann
Hello again,

i got this message from the maintainer:


Am Montag, den 30.11.2009, 11:22 +0100 schrieb Heiko Strathmann:
> Ok, i reported it.
> thanks for trying it out again.
> 
> Am 30. November 2009 11:06 schrieb Uwe Ligges
> :
> My apologies, that must have been a copy&paste error and the
> essential argument got lost. I can reproduce it now under
> R-2.10.0 both Windows and Linux.
> 
> Please report your findings to the package maintainer who
> might be able to debug this under Linux (probably easier than
> under Windows).
> 
> Best,
> 
> 
> Uwe Ligges
> 
>     
> 
> 
> 
> 
> Heiko Strathmann wrote:
> I tried out the code you wrote, it also works for me,
> but it lacks a
> parameter i use in my code.
> 
> The problem (at this computer) seems to be this
> "cross"-parameter of
> ksvm - if I, for example, add the parameter cross=10,
> i get the old
> problem:
> 
> library("kernlab")
> load("freeze_workspace.RDATA")
> replicate(10, ksvm(kernel="matrix", kernelMatrix,
> trainingDataYs, type="C-svc", C=2, cross=10))
> 
> gets me a frozen R process, CTRL-C does not work
> anymore, and the only thing left is to kill it.
>     
> (for cross < 4, the thing still works)
> 
> (I also just reinstalled my Ubuntu and R)
> 
>     Heiko Strathmann
> 
> 
> Am Sonntag, den 29.11.2009, 19:52 +0100 schrieb Uwe
> Ligges:
> Heiko Strathmann wrote:
> Hello uwe,
> Thanks for trying out.
> the freeze happens after about 10 to
> 20 iterations. Did you try as many?
> I just tried again:
> 
> library("kernlab")
> load("freeze_workspace.RDATA")
> replicate(100, ksvm(kernel="matrix",
> kernelMatrix, trainingDataYs, type="C-svc",
> C=2))
> 
> and everything is still fine (same on Linux).
> 
> Uwe Ligges
> 
> 
> 
> Am Sonntag, den 29.11.2009, 17:22
> +0100 schrieb Uwe Ligges:
> I just tried
> 
> ksvm(kernel="matrix",
> kernelMatrix, trainingDataYs,
> type="C-svc", cross=10, C=2)
> 
> several times on both
> workspaces and both returned
> some results after a couple of
> seconds under the same
> versions (R version 2.10.0 and
> kernlab 0.9-9.) under Windows
> XP.
> 
> There mist be something else
> going on...
>         
> Best wishes,
> Uwe Ligges
> 
> 
> 
> 
> 
> Heiko Strathmann wrote:
> Hello again,
> 
> the freeze seems to
> d

Re: [R] kernlab's ksvm method freeze

2009-11-30 Thread Heiko Strathmann
Sorry, heres the message:

Hi

yes the freeze is rather a result of the kernelMatrix being non-positive
definite, have a look at the eigenvalues of kernelMatrix
with eigs and you will see even small negative values. This is usualy
the result of small numerical inacuracies in the computation of the
kernel matrix that normally do not have an effect but can cause
problems.
The issue is amplified by the fact that you are doing 10-fold cross
validation and in effect training 220 models (sampled from the
kernelMatrix) in a 20 fold loop.

You can get around this issue by adding a small epsilon to the diagonal
of your kernelMatrix thus making sure that all sampled kernelMatrices
are positive semidefinite i.e.

diag(kernelMatrix) <- diag(kernelMatrix) + 0.05

seems to do the trick for me.

regards
Alexandros



Am Montag, den 30.11.2009, 11:22 +0100 schrieb Heiko Strathmann:
> Ok, i reported it.
> thanks for trying it out again.
> 
> Am 30. November 2009 11:06 schrieb Uwe Ligges
> :
> My apologies, that must have been a copy&paste error and the
> essential argument got lost. I can reproduce it now under
> R-2.10.0 both Windows and Linux.
> 
> Please report your findings to the package maintainer who
> might be able to debug this under Linux (probably easier than
> under Windows).
> 
> Best,
> 
> 
> Uwe Ligges
> 
>     
>     
> 
> 
> 
> Heiko Strathmann wrote:
> I tried out the code you wrote, it also works for me,
> but it lacks a
> parameter i use in my code.
> 
> The problem (at this computer) seems to be this
> "cross"-parameter of
> ksvm - if I, for example, add the parameter cross=10,
> i get the old
> problem:
> 
> library("kernlab")
> load("freeze_workspace.RDATA")
> replicate(10, ksvm(kernel="matrix", kernelMatrix,
> trainingDataYs, type="C-svc", C=2, cross=10))
> 
> gets me a frozen R process, CTRL-C does not work
> anymore, and the only thing left is to kill it.
>     
>     (for cross < 4, the thing still works)
> 
> (I also just reinstalled my Ubuntu and R)
>     
> Heiko Strathmann
> 
> 
> Am Sonntag, den 29.11.2009, 19:52 +0100 schrieb Uwe
> Ligges:
> Heiko Strathmann wrote:
> Hello uwe,
> Thanks for trying out.
> the freeze happens after about 10 to
> 20 iterations. Did you try as many?
> I just tried again:
> 
> library("kernlab")
> load("freeze_workspace.RDATA")
> replicate(100, ksvm(kernel="matrix",
> kernelMatrix, trainingDataYs, type="C-svc",
> C=2))
> 
> and everything is still fine (same on Linux).
> 
> Uwe Ligges
> 
> 
> 
> Am Sonntag, den 29.11.2009, 17:22
> +0100 schrieb Uwe Ligges:
> I just tried
> 
> ksvm(kernel="matrix",
> kernelMatrix, trainingDataYs,
> type="C-svc", cross=10, C=2)
> 
> several times on both
> workspaces and both returned
> some results after a couple of
> seconds under the same
> versions (R version 2.10.0 and
> kernlab 0.9-9.) under 

Re: [R] kernlab's ksvm method freeze

2009-12-01 Thread Heiko Strathmann
Sorry i forget to paste it.
But it should be there in another mail.

Also, the suggested trick fixes the problem in with the given workspace,
but still fails in another one (where the kernel matrix IS positive
definite)
http://www-stud.uni-due.de/~sfhestra/freeze_on_pos_def_matrix.tar.gz

This is not a R-workspace, but my zipped working directory.
The file I run is parameterSearch.R.
The freeze happens more or less late in the search, but not at a fixed
point.


Heiko

Am Dienstag, den 01.12.2009, 10:25 +0100 schrieb Uwe Ligges:
> 
> Heiko Strathmann wrote:
> > Hello again,
> > 
> > i got this message from the maintainer:
> 
> And which part is from the maintainer?
> 
> Uwe
> 
> 
> 
> > 
> > Am Montag, den 30.11.2009, 11:22 +0100 schrieb Heiko Strathmann:
> >> Ok, i reported it.
> >> thanks for trying it out again.
> >>
> >> Am 30. November 2009 11:06 schrieb Uwe Ligges
> >> :
> >> My apologies, that must have been a copy&paste error and the
> >> essential argument got lost. I can reproduce it now under
> >> R-2.10.0 both Windows and Linux.
> >> 
> >> Please report your findings to the package maintainer who
> >> might be able to debug this under Linux (probably easier than
> >> under Windows).
> >>     
> >> Best,
> >> 
> >> 
> >> Uwe Ligges
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> Heiko Strathmann wrote:
> >> I tried out the code you wrote, it also works for me,
> >> but it lacks a
> >> parameter i use in my code.
> >> 
> >> The problem (at this computer) seems to be this
> >> "cross"-parameter of
> >> ksvm - if I, for example, add the parameter cross=10,
> >> i get the old
> >> problem:
> >> 
> >> library("kernlab")
> >> load("freeze_workspace.RDATA")
> >> replicate(10, ksvm(kernel="matrix", kernelMatrix,
> >>     trainingDataYs, type="C-svc", C=2, cross=10))
> >> 
> >> gets me a frozen R process, CTRL-C does not work
> >>     anymore, and the only thing left is to kill it.
> >> 
> >> (for cross < 4, the thing still works)
> >> 
> >> (I also just reinstalled my Ubuntu and R)
> >> 
> >> Heiko Strathmann
> >> 
> >> 
> >> Am Sonntag, den 29.11.2009, 19:52 +0100 schrieb Uwe
> >> Ligges:
> >> Heiko Strathmann wrote:
> >> Hello uwe,
> >> Thanks for trying out.
> >> the freeze happens after about 10 to
> >> 20 iterations. Did you try as many?
> >> I just tried again:
> >> 
> >> library("kernlab")
> >> load("freeze_workspace.RDATA")
> >> replicate(100, ksvm(kernel="matrix",
> >> kernelMatrix, trainingDataYs, type="C-svc",
> >> C=2))
> >> 
> >> and everything is still fine (same on Linux).
> >> 
> >> Uwe Ligges
> >> 
> >> 
> >> 
> >> Am Sonntag, den 29.11.2009, 17:22
> >> +0100 schrieb Uwe Ligges:
> >> I just tried
> >> 
> >> ksvm(kernel="matrix",
> >> kernelMatrix, trainingDataYs,
> >> type="C-svc", cross=10, C=2)

[R] Problems while plotting with ROCR

2009-12-04 Thread Heiko Strathmann
Hello all,

I have two problems with the ROCR package.

First Problem:
the add=TRUE option does not work for plotting performance objects

The following code is taken from the reference manual (example for
ROCR.hiv, page2)

data(ROCR.hiv)
attach(ROCR.hiv)
pred.svm <- prediction(hiv.svm$predictions, hiv.svm$labels)
perf.svm <- performance(pred.svm, 'tpr', 'fpr')
pred.nn <- prediction(hiv.nn$predictions, hiv.svm$labels)
perf.nn <- performance(pred.nn, 'tpr', 'fpr')
plot(perf.svm, lty=3, col="red",main="SVMs and NNs for prediction of
HIV-1 coreceptor usage")

now I see some dotted red ROC curves.
Now after the next command:
plot(perf.nn, lty=3, col="blue",add=TRUE)

there happens exactly the same as if i would call:
plot(perf.nn, lty=3, col="blue")

I now see only some dotted blue ROC curves, the red ones and the main
caption of the plot are gone.

Second problem:
the averaging of multiple performance curves does not work correctly

 (using the same example code, skipping some comands)
data(ROCR.hiv)
attach(ROCR.hiv)
pred.svm <- prediction(hiv.svm$predictions, hiv.svm$labels)
perf.svm <- performance(pred.svm, 'tpr', 'fpr')
pred.nn <- prediction(hiv.nn$predictions, hiv.svm$labels)
perf.nn <- performance(pred.nn, 'tpr', 'fpr')

plot(perf.svm, avg="vertical", lwd=3, col="red",
 spread.estimate="stderror",plotCI.lwd=2)

this does not give me an average curve, but multiple ones:
see screenshot:
http://www-stud.uni-due.de/~sfhestra/Bildschirmfoto.png

I already tried reinstalling R and ROCR

thanks for your help

Heiko

__
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] kernlab's ksvm method freeze

2011-12-21 Thread Heiko Strathmann
Hi Wuming,

it has been a while. I was not able to fix this problem these day.
Also I could not get in contact with the developer, so I switched to
SHOGUN, which has an interface for R.
With the SHOGUN interface to libsvm, everything worked fine. Also, its
a cool package and worth that you check it out :)
Cheers,
Heiko

2011/12/21 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, so I
> used nearPD() from Matrix package to correct kernel.  This sometimes solved
> the freeze problem.  But sometimes ksvm() still freeze even with the
> corrected matrix with all positive eigenvalues. Then I checked document of
> libsvm and found the following FAQ
>
>
> Q: The training time is too long. What should I do?
> For large problems, please specify enough cache size (i.e., -m). Slow
> convergence may happen for some difficult cases (e.g. -c is large). You can
> try to use a looser stopping tolerance with -e. If that still doesn't work,
> you may train only a subset of the data. You can use the program subset.py
> in the directory "tools" to obtain a random subset.
>
> If you have extremely large data and face this difficulty, please contact
> us. We will be happy to discuss possible solutions.
>
> When using large -e, you may want to check if -h 0 (no shrinking) or -h 1
> (shrinking) is faster. See a related question below.
>
>
> So I changed tor from 0.001 to 0.01 and turn off shrinking heuristic. This
> seems working well for most of the other freeze problems.
>
> Wuming
>
>
> On Tue, Dec 1, 2009 at 5:46 AM, Heiko Strathmann
>  wrote:
>> Sorry i forget to paste it.
>> But it should be there in another mail.
>>
>> Also, the suggested trick fixes the problem in with the given workspace,
>> but still fails in another one (where the kernel matrix IS positive
>> definite)
>> http://www-stud.uni-due.de/~sfhestra/freeze_on_pos_def_matrix.tar.gz
>>
>> This is not a R-workspace, but my zipped working directory.
>> The file I run is parameterSearch.R.
>> The freeze happens more or less late in the search, but not at a fixed
>> point.
>>
>>
>> Heiko
>>
>> Am Dienstag, den 01.12.2009, 10:25 +0100 schrieb Uwe Ligges:
>>>
>>> Heiko Strathmann wrote:
>>> > Hello again,
>>> >
>>> > i got this message from the maintainer:
>>>
>>> And which part is from the maintainer?
>>>
>>> Uwe
>>>
>>>
>>>
>>> >
>>> > Am Montag, den 30.11.2009, 11:22 +0100 schrieb Heiko Strathmann:
>>> >> Ok, i reported it.
>>> >> thanks for trying it out again.
>>> >>
>>> >> Am 30. November 2009 11:06 schrieb Uwe Ligges
>>> >> :
>>> >>         My apologies, that must have been a copy&paste error and the
>>> >>         essential argument got lost. I can reproduce it now under
>>> >>         R-2.10.0 both Windows and Linux.
>>> >>
>>> >>         Please report your findings to the package maintainer who
>>> >>         might be able to debug this under Linux (probably easier than
>>> >>         under Windows).
>>> >>
>>> >>         Best,
>>> >>
>>> >>
>>> >>         Uwe Ligges
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>         Heiko Strathmann wrote:
>>> >>                 I tried out the code you wrote, it also works for me,
>>> >>                 but it lacks a
>>> >>                 parameter i use in my code.
>>> >>
>>> >>                 The problem (at this computer) seems to be this
>>> >>                 "cross"-parameter of
>>> >>                 ksvm - if I, for example, add the parameter cross=10,
>>> >>                 i get the old
>>> >>                 problem:
>>> >>
>>> >>                 library("kernlab")
>>> >>                 load("freeze_workspace.RDATA")
>>> >>                 replicate(10, ksvm(kernel="matrix", kernelMatrix,
>>> >>                 trainingDataYs, type="C-svc", C=2, cross=10))
>&g