forum.alglib.net
http://forum.alglib.net/

Linear Regression in 3d (three independent variables)
http://forum.alglib.net/viewtopic.php?f=2&t=6
Page 1 of 1

Author:  Juanmihd [ Fri May 14, 2010 2:55 pm ]
Post subject:  Linear Regression in 3d (three independent variables)

Hi!

First of all I have to say that you're doing a great job with your library. Keep going!

Second, I'd like to question something...
Is it possible with the ALGLib to compute a Linear Regression in 3d? I want to calculate a line in 3d from a group of points in 3d. I want that line to be a regression line from a cloud of points that are candidates to be there. Each point has a value of the 'chance' to be part of the line.

I thought that a linear regression could do this for me. Can I do it with the library?

Thanks!!

Author:  Sergey.Bochkanov [ Sat May 15, 2010 7:04 am ]
Post subject:  Re: Linear Regression in 3d (three independent variables)

Quote:
I want that line to be a regression line from a cloud of points that are candidates to be there. Each point has a value of the 'chance' to be part of the line.

Do you really have probabilities, i.e. values strictly within [0,1]? Or just "likelihood values"? Do line have to pass exactly through all points, which are "part of it"? If answers are "probability" and "exactly", then ALGLIB can't solve this task. And I've never heard of regression problem like this.

However you can use linear regression unit to find approximate answer - just set weights to probability values (or square roots of values, I'm not sure) and get approximate line.

Author:  Juanmihd [ Sat May 15, 2010 10:49 am ]
Post subject:  Re: Linear Regression in 3d (three independent variables)

Thanks for your answer!!

The values are not probabilities, there are more likelihood values, and it doesn't have to pass exactly through none of the points.

The problem is that I don't know what function of the library use, I have to use lrbuild? And in that case, how do I fill the variable 'xy'. Because that is just a ap:real_2d_array and I have to handle X, Y, Z, and the value of likelihood (that you recommend me to set the weights, where do I do that?

Thanks again! You're going to be very usefull!!

Author:  Sergey.Bochkanov [ Sat May 15, 2010 11:50 am ]
Post subject:  Re: Linear Regression in 3d (three independent variables)

Now I see - it is weighted principal component analysis problem, not linear regression one. You can use MinLM (or MinLBFGS) unit to minimize F(a,b,c), which is weighted sum of squared distances from points to the line defined by (a,b,c).

Don't know, however, how weights should come into F() - as w[i], or as w[i] squared... You can try both, and see what give you best results.

Author:  Juanmihd [ Sat May 15, 2010 4:09 pm ]
Post subject:  Re: Linear Regression in 3d (three independent variables)

I have another question... that MinLM seems to be useful for NON-LINEAR FITTING. I want to do a linear fitting, because the result that I want to get is a line that "fits" that cloud of points.

I read in the documentation of the functions that MinLM is for NON-LINEAR.

I get these cloud of points from the intersection of the normals of some faces. The idea is that the rotation axis is the line that fit (not exactly but very approximately) the points of the cloud that has more value (the amount of intersection of normals in that point).

First of all I think to use a Hough transform, that is used to detecting shapes (for example a line) in images. So I has the idea of expanding to 3D instead of 2D. But looking for information I saw that a Linear Regression could be useful because, at the end, I want to fit a line from a cloud of points.

I hope that with these little explanation of the problem I'd explained myself more.

So, do you think that MinLM could handle my problem?

Thanks!!

Author:  Sergey.Bochkanov [ Mon May 17, 2010 6:06 am ]
Post subject:  Re: Linear Regression in 3d (three independent variables)

MinLM may be used both for linear and non-linear fitting (linear function is just a special case of non-linear function). But your task is really nonlinear (although it seems linear at the first glance). Try to write equations for distance between your line and point in the space - you won't get linear function. So nonlinear fitting (with MinLM or MinLBFGS) is the only way to solve your problem.

P.S. Try to read something on total least squares. It looks very close to your problem (although you have slightly different formulation: LS deals with restoration of noised dependencies, you want to maximize some merit function). Maybe you'll find some ideas which may help you...

Author:  charles880 [ Sat Jan 17, 2015 6:31 am ]
Post subject:  Re: Linear Regression in 3d (three independent variables)

You don't include probabilities, my spouse and i. electronic. beliefs totally within [0, 1]? Or maybe "likelihood values"? Do range need to pass accurately as a result of many things, which are "part involving it"? If answers are "probability" in addition to "exactly", after that ALGLIB can not clear up this task. Along with I've by no means got word of regression trouble similar to this.

On the other hand you may use linear regression device to get approx . remedy -- just fixed weights in order to probability beliefs (or sq . sources involving beliefs, I am just certainly not sure) and have approx . range.

Author:  itnasasta [ Sat Feb 14, 2015 10:27 am ]
Post subject:  Re: Linear Regression in 3d (three independent variables)

I read in the documentation of the functions that MinLM is for NON-LINEAR. I get these cloud of points from the intersection of the normals of some faces. The idea is that the rotation axis is the line that fit (not exactly but very approximately) the points of the cloud that has more value (the amount of intersection of normals in that point). ???

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/