Comments (2)
Hey @kuzeko
Thanks for the question. There was a typo in the readme, which I've fixed which would have made this tough.
What I would do in this example is:
from saxpy import SAX
import math
query = [ math.sin(x)*2 for x in range(2, 5)]
target = [math.sin(x)*2 for x in range(0, 100)]
s = SAX(3, 7) # 3 letter words, 7 letter alphabet
(queryString, queryIndices) = s.to_letter_rep(query)
(targetStrings, targetIndices) = s.sliding_window(target, 33, 0.6)
comparisonScores = s.batch_compare(targetStrings, queryString)
From there, comparisonScores
will be a list of comparison scores between subsections of the target and the query.
The lowest comparisonScores
values will map to which sections were the most similar. The index of the lowest values can be used with targetIndices
to find the position in the original dataset which were the lowest.
For instance when I ran it, comparisonScores[2]
and comparisonScores[3]
were both 0.0, and targetIndices[2]
, and targetIndices[3]
were respectively (2,5)
(exactly the same as the query, which is expected) and (3,6)
which is pretty close. There will be other entries in comparisonScores
which are 0.0 because the sine function is periodic.
Good luck!
from saxpy.
Fantastic! Thanks a lot!
from saxpy.
Related Issues (6)
- No license for project HOT 1
- Bug in implementation? HOT 17
- About scalingFactor HOT 1
- Missing return in normalize HOT 2
- import error HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from saxpy.