wangsix / vmo Goto Github PK
View Code? Open in Web Editor NEWPython Modules of Variable Markov Oracle
Home Page: http://acsweb.ucsd.edu/~chw160/projects/MO.php
License: GNU General Public License v3.0
Python Modules of Variable Markov Oracle
Home Page: http://acsweb.ucsd.edu/~chw160/projects/MO.php
License: GNU General Public License v3.0
I find the name data
to be confusing in the oracle's class attributes.
I'd rather go for symbols
instead, to clearly distinguish it from the concrete data, the features. With an -s, because there are several possible symbols accessible for a given state!
And rename f_array
to feature
at the same time, because, who knows, a feature doesn't necessarily have to be an array! And anyway, the interface should be kept separate from the actual implementation, so mentioning arrays is bad practice.
@wangsix Both demo notebooks use direct accesses to VMO.latent
. Furthermore, this method is not documented in the class' definition.
Consider creating a method to access this attribute if it is really needed, in order to respect the encapsulation principle.
Given
SYMBOLIC_SEQ = [0, 0, 1, 0, 2, 0, 0, 1, 0, 1, 0, 2, 0, 0, 1]
p = build_oracle(SYMBOLIC_SEQ, 'f')
print(vmo.generate.improvise(p, 5))
I get
Traceback (most recent call last):
File "test.py", line 9, in <module>
print(vmo.generate.improvise(p, 15))
File "/home/jcelerier/score/base/addons/score-addon-vmo/3rdparty/vmo/vmo/generate.py", line 87, in improvise
s.append(improvise_step(oracle, k, LRS, weight))
File "/home/jcelerier/score/base/addons/score-addon-vmo/3rdparty/vmo/vmo/generate.py", line 47, in improvise_step
trn_link = [s + 1 for s in oracle.latent[oracle.data[i]] if
TypeError: only integer scalar arrays can be converted to a scalar index
I changed the function to the following to make it work (just a cast to int for the oracle data sequence):
latent = oracle.latent[int(oracle.data[i])]
if prune:
prune_list = range(i % prune, oracle.n_states - 1, prune)
trn_link = [s + 1 for s in latent if
(oracle.lrs[s] >= lrs and
(s + 1) < oracle.n_states) and
s in prune_list]
else:
trn_link = [s + 1 for s in latent if
(oracle.lrs[s] >= lrs and (s + 1) < oracle.n_states)]
if not trn_link:
if i == oracle.n_states - 1:
n = 1
else:
n = i + 1
else:
if weight == 'lrs':
lrs_link = [oracle.lrs[s] for s in latent if
(oracle.lrs[s] >= lrs and (s + 1) < oracle.n_states)]
lrs_pop = list(itertools.chain.from_iterable(itertools.chain.from_iterable(
[[[i] * _x for (i, _x) in zip(trn_link, lrs_link)]])))
n = np.random.choice(lrs_pop)
else:
n = trn_link[int(np.floor(random.random() * len(trn_link)))]
return n
@wangsix : the MO
class offers a parameter suffix_method
(currently with two recognized values,
'inc'
and 'complete'
), VMO
and FO
don't support it.
Where is this parameter introduced? Is it specific to the repository or does it appear in an article?
Is there any reason why MO
should benefit from it and not FO
/ VMO
?
I am rewriting all three classes to use a unified add_class
method, and shall integrate
this parameter regarding the suffix links within this generic function in case it's relevant.
Hello,
when going to the http://chengiwang.com/ website, it's only a "default" page.
Where could we get more informations on VMO ?
Best,
Hi,
I saw that vmo implements the algorithm found at
Lefebvre, A., Lecroq, T., & Alexandre, J. (2003). An Improved Algorithm for Finding Longest Repeats with a Modified Factor Oracle. Journal of Automata, Languages and Combinatorics, 8(4), 647โ657.
However, the factor oracle for the string abbcabcdabc
built by vmo does not correspond to the shown in the paper (figure below). VMO returns lrs[11] = 2
and sfx[11] = 4
Cheers,
Jaime.
I have a request which would greatly help me for project on which I am curently working.
I would be interested to have a code exemple which uses Markov Oracle in VMO, similar to the one you use in your publication (A Novel Sequential Data Points Clustering algorithm with aplication to 3D Gesture) into the experiments sections.
Thanks.
The codes for classes FactorOracle
, MO
and VMO
are all very close and share many identical lines, making it hard to uniformly update it.
This could probably be fixed by refactoring the code.
I think having (for all newly created oracle
) oracle.symbol[0] == None
rather than oracle.symbol[0] == 0
would make more sense.
What do You think about it?
Given this code :
from vmo.VMO.oracle import build_oracle
import vmo.generate
SYMBOLIC_SEQ = [0, 0, 1, 0, 2, 0, 0, 1, 0, 1, 0, 2, 0, 0, 1]
p = build_oracle(SYMBOLIC_SEQ, 'a')
print(vmo.generate.improvise(p, 5))
I get (all the time)
vmo/VMO/oracle.py:567: RuntimeWarning: invalid value encountered in less
I = np.where(dvec < self.params['threshold'])[0]
[1, 2, 3, 4, 5]
what should I do to get correct improvisation ? thanks!
Hello,
It would be interesting to have the python notebooks (VMO tutorials) in binder
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.