Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-transformed data in MFT #2

Closed
seaney11 opened this issue Sep 1, 2017 · 2 comments
Closed

Non-transformed data in MFT #2

seaney11 opened this issue Sep 1, 2017 · 2 comments

Comments

@seaney11
Copy link

seaney11 commented Sep 1, 2017

In the MFT class, the fft object is initialised with the windowSize when the MFT instance is initialised, however when the array size is set later:

int arraySize = Math.max(l+this.startOffset, this.windowSize);

and when this is used in line 107:

mftData = Arrays.copyOf(timeSeries.getData(), arraySize);
this.fft.realForward(mftData);
mftData[1] = 0;

if arraySize is larger than the windowSize, then it leaves some of the mftData not transformed and is then used later on in the rest of the MFT and in the classification.

I saw this happen at windowSize = 5, l = 4 and so arraySize = 6

This has an implication on the creation of words especially at small window sizes, however I am not sure how often this occurs or how much it affects the final results

@patrickzib
Copy link
Owner

Wow, thanks a lot for pointing this out!

Now, the Fourier transform is always applied to data of size windowSize:

double[] dft = new double[this.windowSize];
System.arraycopy(timeSeries.getData(), 0, dft, 0, this.windowSize);
this.fft.realForward(dft);

// if windowSize > mftData.length, the remaining data should be 0 now.
System.arraycopy(dft, 0, mftData, 0, Math.min(mftData.length, dft.length));

Any remaining coefficients should be 0 from thereon.

This should fix the issue.

@seaney11
Copy link
Author

seaney11 commented Sep 4, 2017

great, thanks for the response.

@seaney11 seaney11 closed this as completed Sep 4, 2017
patrickzib pushed a commit that referenced this issue Sep 11, 2017
upstream documentation updates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants