forum.alglib.net

ALGLIB forum
It is currently Tue Jul 05, 2022 4:14 am

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Linear Regression in 3d (three independent variables)
PostPosted: Fri May 14, 2010 2:55 pm 
Offline

Joined: Fri May 14, 2010 2:52 pm
Posts: 3
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!!


Top
 Profile  
 
 Post subject: Re: Linear Regression in 3d (three independent variables)
PostPosted: Sat May 15, 2010 7:04 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 874
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.


Top
 Profile  
 
 Post subject: Re: Linear Regression in 3d (three independent variables)
PostPosted: Sat May 15, 2010 10:49 am 
Offline

Joined: Fri May 14, 2010 2:52 pm
Posts: 3
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!!


Top
 Profile  
 
 Post subject: Re: Linear Regression in 3d (three independent variables)
PostPosted: Sat May 15, 2010 11:50 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 874
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.


Top
 Profile  
 
 Post subject: Re: Linear Regression in 3d (three independent variables)
PostPosted: Sat May 15, 2010 4:09 pm 
Offline

Joined: Fri May 14, 2010 2:52 pm
Posts: 3
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!!


Top
 Profile  
 
 Post subject: Re: Linear Regression in 3d (three independent variables)
PostPosted: Mon May 17, 2010 6:06 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 874
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...


Top
 Profile  
 
 Post subject: Re: Linear Regression in 3d (three independent variables)
PostPosted: Sat Jan 17, 2015 6:31 am 
Offline

Joined: Sat Jan 17, 2015 6:30 am
Posts: 1
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.


Top
 Profile  
 
 Post subject: Re: Linear Regression in 3d (three independent variables)
PostPosted: Sat Feb 14, 2015 10:27 am 
Offline

Joined: Sat Feb 14, 2015 7:26 am
Posts: 1
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). ???


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group