help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: leasqr help


From: Francesco Potorti`
Subject: Re: leasqr help
Date: Fri, 11 Apr 2008 15:08:06 +0200

>> >> >In case a have a "Matrix" as data, would it work right ?
>> >> >In this case my "function" should return a matrix as well ?

Let's start from the beginning, as I suspect some misunderstandings.

First my «function should return an absolute value» statement.

Leasqr does least squares minimisation.  It is used in this typical
case: you have a series of scalar observations y0,y1.. yn (the output of
a system), and a series of vector data x0,x1..xn (the input to a
system).  So you have an observed system that gets an input xi (a
vector) and outputs a scalar yi.  Now you want to fit a function f to
emulate the behaviour of the system.  The function is of the form
yi=f(xi,p), where p is a set of unknown parameters.  The work of leasqr
is to read a list y of scalar observations, a list x of vector values,
the function f(xi,p) and find what are the best p1,p2..pn values.  In
order to work efficiently, f is requested to be given in vector form, so
what we give to leasqr is in fact the vector form of f such that
y=F(x,p).

So, what leasqr takes is indeed a vector function F, but this is only
an optimisation, because the function we care about is in fact f.  This
means that you should write your F so that F(x,p)(i) equals F(x(i,:),p),
that is, it should work element by element.  In other words, you could
write your F like this:

y=function F(x,p) for i=1:rows(x) y(i)=f(x(i,:),p); endfor; endfunction

If your F does not satisfy these criteria, then I cannot tell whether
leasqr can give correct results, and I think in general it will not.

Second my statement about minimising something different from
differences of scalars.

Leasqr minimises the sum of squared differences (let alone weights)
between yi and f(xi,p), where yi is a scalar and f returns a scalar.  In
other words, we define a distance as (yi-f(xi,p))^2 and we minimise the
sum of distances for all elements in y.  Even if I am not a
matematician, it appears to me that the same method could be used to
minimise any distance, if properly defined.  Specifically, one could
have a series of yi that are matrices, an f(xi,p) that returns matrices,
and define a distance between two matrices.  I guess that the definition
of this distance should satisfy the mathematical definition of a
distance (<http://en.wikipedia.org/wiki/Distance#General_case>), but for
real-world cases anything that is intuitively a distance will satisfy
those criteria.  As far as I can understand, leasqr should have no
problems minimising the sum of any distance, if properly modified, and
the modifications would be minimal, as I suggested in my previous mails.

I hope that the above clarifies what I meant and is useful to someone,
and I would be grateful to anyone that can correct my mistakes, if any.

-- 
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa         Email: address@hidden
Web: http://fly.isti.cnr.it/           Key:   fly.isti.cnr.it/public.key


reply via email to

[Prev in Thread] Current Thread [Next in Thread]