Giter Club home page Giter Club logo

vmo's People

Contributors

dependabot[bot] avatar ganyeshprasanna avatar jcelerier avatar robinmeier avatar tbazin avatar wangsix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vmo's Issues

Renaming oracle attributes

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.

Direct access to undocumented class attribute 'latent'

@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.

improvise_step function fails

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

Some questions about suffix_method

@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.

Algorithm for finding LRS

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

capture d ecran 2016-09-13 a 11 35 39

Cheers,
Jaime.

Code exemple using Markov Oracle.

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.

Code replication in module oracle.py

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.

Change first state's feature / symbol

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?

using improvise with VMO ?

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.