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

mdp learning using AALpy #5

Closed
roiDaniela opened this issue Jun 4, 2021 · 3 comments
Closed

mdp learning using AALpy #5

roiDaniela opened this issue Jun 4, 2021 · 3 comments

Comments

@roiDaniela
Copy link

roiDaniela commented Jun 4, 2021

def random_mdp_example(num_states, input_len, num_outputs, n_c=20, n_resample=1000, min_rounds=10, max_rounds=1000):

Hello:)

I'm trying to to do the same for an example I created this mdp and tried to learn it same way:
https://github.com/roiDaniela/AALpy/blob/examples_and_tests/myExample.py

but the prediction of probabilities where different than expected

maybe my configuration is not propriate?

https://github.com/roiDaniela/AALpy/blob/examples_and_tests/graphs/learned.pdf

https://github.com/roiDaniela/AALpy/blob/examples_and_tests/graphs/original.pdf

thanks

@emuskardin
Copy link
Member

Hi,

you defined a deterministic automaton, therefore learning returned deterministic automaton.

    s1.transitions['a'].append((s2, 0.2))
    s1.transitions['b'].append((s1, 0.35))
    s1.transitions['c'].append((s3, 0.35))
    s1.transitions['d'].append((s1, 0.1))

In this snipped taken from your example, you can see that 'a' will lead to s2 100% of the time, as the alternative transition for input 'a' from s1 is note defined. This is done for all state/transition pairs, thus this is a deterministic automaton.

In MDP, sum of transitions for each element of input alphabet should be 100%.

As stated, in your example, upon executing 'a' from s1, only possible output is s2.
You would need something like this for it to be an MDP:

    s1.transitions['a'].append((s2, 0.2))
    s1.transitions['a'].append((s3, 0.8))
    s1.transitions['b'].append((s1, 0.35))
    s1.transitions['b'].append((s4, 0.65))
    s1.transitions['c'].append((s3, 0.35))
    s1.transitions['c'].append((s1, 0.65))
    s1.transitions['d'].append((s1, 0.1))
    s1.transitions['d'].append((s5, 0.9))

All best,
Edi

@roiDaniela
Copy link
Author

@emuskardin thanks!

Is it possible to add probability to the transactions in dfa, so the 100% will divided to the alphabet?

@roiDaniela
Copy link
Author

I think this will be good workaround for my need

`s1.transitions['a'].append((s2, 0.2))
s1.transitions['a'].append((s1 0.8))

s1.transitions['b'].append((s1, 1))

s1.transitions['c'].append((s3, 0.35))
s1.transitions['c'].append((s1, 0.65))

s1.transitions['d'].append((s1, 1))`

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