Register to reply

Statisics - linearity and best-fit in 3 dimensions

by jamesson
Tags: bestfit, dimensions, linearity, statisics
Share this thread:
Stephen Tashi
#19
May13-12, 10:00 AM
Sci Advisor
P: 3,313
I'm having a hard time visualizing any practical problem where one would only care about motion parallel to one of the coordinate axes!

In an earlier post, you said
The simplest solution I could come up with is to detect individual motions parallel to the axes (over a limited set of datapoints), then use start and end end points to determine direction
Is the direction that is determined by the start and end points always to be a direction that is parallel to one of the coordinate axes?
jamesson
#20
May13-12, 11:33 AM
P: 24
Well, after we have tested to see if they are indeed parallel then yes. In that post by direction I meant towards or away from origin. Sorry if that was unclear

Re application, think of a mouse or a keyboard. A "click" or "keystroke" only "moves" in one direction. Think of the 6 possible motions (3 axes, 2 directions) as 6 keystrokes. As I said, the 2d recognizer requires an init event to begin gathering data for recognition. The parallel motions will serve as init events.
viraltux
#21
May13-12, 03:06 PM
P: 250
I'd say using Pearson's r is not a good idea, for example, if a line is parallel to one of the axis you use to calculate it the correlation will be zero.

A PCA answers all your three questions at once, if it is a line you will have only one significant eigenvalue and its eigenvector will tell you if its parallel or not to any axis.

For more info:
http://en.wikipedia.org/wiki/Princip...onent_analysis
jamesson
#22
May13-12, 05:34 PM
P: 24
I have had pca suggested to me before. Could you please give an expression involving sums but not integrals or derivative, as the environment I'm working with does not support them? I have been unable to make my way through the wiki article (freshman calc etc).

Also, apologies in advance if this involves matrices and I ask some rookie questions - my matrix skills are kinda weak.

Thanks again

Joe
Stephen Tashi
#23
May14-12, 12:00 AM
Sci Advisor
P: 3,313
Quote Quote by jamesson View Post

Re application, think of a mouse or a keyboard. A "click" or "keystroke" only "moves" in one direction. Think of the 6 possible motions (3 axes, 2 directions) as 6 keystrokes.
OK, I'm going to think of someone giving hand signals to an equipment operator. The one's you want to recognize are left, right, up, down, forward , backward.

The way I'm visualizing the data at present is that you not only have the problem of applying some test to a set of data, you have the problem of picking which sets of data to analyze. If I think of the data as a long series of vectors (x1,y1,z1,t1), (x2,y2,z2,t2).....(xn,yn,zn,tn) then this sequence may contain several different gestures. So you must picked out various "windows" of data to analyze. The data from t10 to t200 might be one gesture and the data from t315 to t390 might be another. Am I correct that picking out sequences of data is part of the problem? Have you solved that part of it already?

Should we think of this as a non-real time system where we can scan back and forth in all the data? Or must the system work in roughly real time as data is coming in?
jamesson
#24
May14-12, 01:00 AM
P: 24
Your concept of "hand signals" is accurate, however selection of windows (if I understand you correctly) is inherently not part of the problem. Once an "init" "hand signal" is received we assume that whatever follows is a 2d gesture. All 2d gestures consist of an arbitrary (but equal) number of datapoints which are compared to a prerecorded library of gestures in realtime. The software then identifies the gesture (there is a tolerance value which tells the software how closely the input gesture must match the recorded gesture). Recording of 2d data continues until the "stop" "hand signal" is received. The "stop" "hand signal" is nothing more than the "init" "hand signal" reversed; that is to say whereas The "begin gesture" (init) "hand signal" moves away from the origin, the "stop" "hand signal" moves toward the origin along the same axis as the "init". When "stop" is received any points beyond the arbitrary preset length are discarded and 2d recognition occurs. I am not yet 100% sure I will need a stop (I may simply trigger recognition when the requisite number of points is received) but far easier to build it and not use it than try to build it later.

Example;

1) user moves hand up
2) 2d datapoint recording begins on the xz plane
3) user moves hand down or requisite length of xz dataset is reached
4) recognition occurred, result is handled, gesture listener resets.

Re realtime, most definitely realtim

Thanks again
viraltux
#25
May14-12, 01:18 AM
P: 250
Quote Quote by jamesson View Post
I have had pca suggested to me before. Could you please give an expression involving sums but not integrals or derivative, as the environment I'm working with does not support them?...

Joe
What is that environment?
jamesson
#26
May14-12, 01:39 AM
P: 24
Max MSP
jamesson
#27
May14-12, 01:41 AM
P: 24
the tutorial article wikipedial links to is actually far ,ore soothing than wikipedia itself. I may give it a shot later tonight.
viraltux
#28
May14-12, 02:00 AM
P: 250
Quote Quote by jamesson View Post
Max MSP
Oh I see, about music?, OK, obviously your best choice would be to find some libraries that you might use from Max MSP to calculate the PCA, but if that is not an option, I would say that the chapter Computing principal components efficiently in the wiki link is pretty much what you need. It gives you a way to calculate the PCA with an iterative computation which only uses products and sums. And in your case you don't even need to calculate all eigenvalues and vectors.

I'm sure Max MSP should be able to deal with that one...

Good luck though!!
jamesson
#29
May14-12, 02:16 AM
P: 24
Don't know when I will get to try this way, but hopefully soon, and I definitely will need help. Thanks again.
viraltux
#30
May14-12, 02:24 AM
P: 250
Quote Quote by jamesson View Post
Don't know when I will get to try this way, but hopefully soon, and I definitely will need help. Thanks again.
You're welcome, but hey, post a video with this project, it looks pretty interesting!
Stephen Tashi
#31
May14-12, 02:39 AM
Sci Advisor
P: 3,313
Let's discuss an utterly simple method. Perhaps objections to it will clarify the problem further.

Let the data points be [itex](x_i,y_i,z_i,t_i) [/itex] for [itex] i = 1 [/itex] to [itex] N [/itex]. If this data represented a line perfectly parallel to the y axis then the [itex] x [/itex] and [itex] z [/itex] values would remain constant while the [itex] y [/itex] value varied.

If we have data from an imperfect line, we could estimate the line that the data is "trying to" follow in various ways. The simplest seems to be to estimate that the [itex] \hat{x} = [/itex] the average of the [itex] x [/itex] values in the data and [itex] \hat{z} = [/itex] the average of the [itex] z [/itex] values.

We can quantify the "error" that the imperfect data has in various ways. The one that comes to my mind first

[tex] \hat{\sigma^2} = (\frac{1}{N}) { \sum_{i=1}^N ( (\hat{x} - x )^2 + (\hat{z}-z)^2)} [/tex]

Of course the idea is to classify the data as a gesture parallel to the y axis when [itex] \hat{\sigma^2} [/itex] is "small". What constitutes a small or large error would have to be determined empirically. You'd have to do a different test for each axis, but this is not an elaborate computation.

One weakness of this method is that it doesn't give any more credit to data that is a perfect straight line but slightly out-of-parallel vs data that is scattered. Is this weakness the reason that you are considering sophisticated statistical methods?


Register to reply

Related Discussions
Linearity for a PDE Calculus & Beyond Homework 1
Dimensions that are not space dimensions nor time dimensions. General Physics 14
Linearity math problem Calculus & Beyond Homework 4
How to genarelize the vector product in three dimensions to higher dimensions? Linear & Abstract Algebra 2
Distances between samples in high dimensions. Curse of dimensions? Differential Geometry 0