krrepo / lea Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/lea
License: GNU Lesser General Public License v3.0
Automatically exported from code.google.com/p/lea
License: GNU Lesser General Public License v3.0
Python 3 support is good and easy
Original issue reported on code.google.com by [email protected]
on 12 Mar 2014 at 2:30
It would be good to include a test suite, to validate the different functions
of Lea. A lot of consistency checks can be made internally, between results of
functions themselves: verify basic arithmetics, logical operators,....
Examples: 2*die == die+die, (die==1) | (die>1). For more advanced tests,
different examples with expected results could be found in the literature.
This would allow for better confidence in the tool from the users, as well as
non-regression tests for maintenance.
Original issue reported on code.google.com by [email protected]
on 19 Nov 2014 at 7:46
Consider the following CPT example in Leapp;
x = ?:(1/3)
y = ?:(1/4)
z1 = ?! ( ~x & ~y -> ?:(1/5),
~x & y -> ?:(1/7),
x & ~y -> ?:(1/2),
x & y -> ?:(1/2))
Notice that z1 is independent of y when x is true (i.e. "context-specific
Independence").
Then, in the following refactoring
z0 = ?! ( ~y -> ?:(1/5),
y -> ?:(1/7))
z3 = ?! ( ~x -> z0,
x -> ?:(1/2))
z3 is expected to be equivalent to z1.
However the two distributions unexpectedly differ:
lea> :@ z1 ! y
11/42
lea> :@ z3 ! y
8/21
Original issue reported on code.google.com by [email protected]
on 14 Mar 2015 at 1:53
Hi, here's a suggestion for a nice example using Grime's non-transitive dice,
maybe you want to include something similar in the README?
http://grime.s3-website-eu-west-1.amazonaws.com/
The idea behind Grime's dice is that you have three dice, red, blue, olive
which win against each other in a cyclic way. (one beating the other in about
5:7). When you have two dice of the same colour, they beat each other, too, but
the other way 'round.
red = Lea.fromVals(3,3,3,3,3,6)
blue = Lea.fromVals(2,2,2,5,5,5)
olive = Lea.fromVals(1,4,4,4,4,4)
print(red > blue)
print(blue > olive)
print(olive > red)
print(red+red.clone() > blue+blue.clone())
...
Original issue reported on code.google.com by [email protected]
on 10 Nov 2014 at 7:38
Google Code is closing soon
[http://google-opensource.blogspot.fr/2015/03/farewell-to-google-code.html]. Is
there any plan to migrate lea somewhere else before that happens?
Thanks
Original issue reported on code.google.com by [email protected]
on 3 Jun 2015 at 3:34
CPT do not allow for conditions that are certainly unfeasible. Examples:
lea> a = ?('x','y')
lea> ?! (a==a -> 's',
... _ -> 't')
Lea error: forbidden to define 'other' clause for complete clause set
lea> ?! (a!=a -> 's',
... _ -> 't')
Lea error: some clause condition is not feasible
Even if such conditions are not usual, it should be more sensible to accept
them and produce expected results (e.g. 's' with probability 1 in first case,
't' with probability 1 in second case). See treatment of if-then-else in
programming languages.
Original issue reported on code.google.com by [email protected]
on 16 Mar 2015 at 10:28
Consider the following CPT example in Leapp;
x = ?:(1/3)
y = ?:(1/4)
z1 = ?! ( ~x & ~y -> ?:(1/5),
~x & y -> ?:(1/7),
x & ~y -> ?:(1/2),
x & y -> ?:(1/2))
Notice that z1 is independent of y when x is true (i.e. "context-specific
Independence").
Then, It seems natural to factor out the two last entries as
z2 = ?! ( ~x & ~y -> ?:(1/5),
~x & y -> ?:(1/7),
x -> ?:(1/2))
However the two distributions unexpectedly differ:
lea> :@ z1
61/210
lea> :@ z2
139/630
z1 is right while z2 is wrong.
Original issue reported on code.google.com by [email protected]
on 21 Feb 2015 at 11:46
What steps will reproduce the problem?
1. import lea
What is the expected output? What do you see instead?
I don't expect, need, or want any output if the import goes well, instead I see
this:
"""
Lea 1.3.1 Copyright (C) 2013 Pierre Denis
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions.
For more details, see COPYING and COPYING.LESSER files.
"""
What version of the product are you using? On what operating system?
Lea 1.3.1 on Python 3.4.2 on Linux 3.17.2.
Please provide any additional information below.
Importing a package shouldn't spew out a banner. Doing so makes it useless in
scripts.
Original issue reported on code.google.com by [email protected]
on 10 Nov 2014 at 7:16
What steps will reproduce the problem?
1. Testing the withProb method as described in the [Advanced Tutorial part
1](https://code.google.com/p/lea/wiki/LeaPyTutorial1#Revised_Distributions)
die1 = Lea.fromVals(1,2,3,4,5,6)
dieU = die1.withProb(die1 >=5, 1, 2)
print(dieU)
What is the expected output? What do you see instead?
Expected:
1 : 1/8
2 : 1/8
3 : 1/8
4 : 1/8
5 : 2/8
6 : 2/8
Seen:
1 : 1/6
2 : 1/6
3 : 1/6
4 : 1/6
5 : 1/6
6 : 1/6
What version of the product are you using? On what operating system?
2.1.1 with python 2.7.6 on Mac.
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 12 Jul 2015 at 6:51
Do you plan replace repo to github?
Original issue reported on code.google.com by [email protected]
on 12 Mar 2014 at 2:27
The Lea code contains several loops on dictionaries that use items() or
values() methods. OK, this allows for the same implementation on Python 2 and
3, which is handy. However, this is inefficient on Python 2 because these
methods build lists instead of iterators; there are penalties on speed and
memory. In Python 2, the right methods to call are iteritems() and
itervalues(). Note that these methods were present in the fist versions of Lea,
before porting to Python 3. It would be nice if Lea uses the most efficient
methods depending on the Python version on which it runs.
Original issue reported on code.google.com by [email protected]
on 7 Mar 2015 at 5:42
Consider the following Lea session:
{{{
>>> (die1.times(2)) + die1
3 : 1/216
4 : 3/216
5 : 6/216
6 : 10/216
7 : 15/216
8 : 21/216
9 : 25/216
10 : 27/216
11 : 27/216
12 : 25/216
13 : 21/216
14 : 15/216
15 : 10/216
16 : 6/216
17 : 3/216
18 : 1/216
>>> die1 + (die1.times(2))
3 : 1/6
6 : 1/6
9 : 1/6
12 : 1/6
15 : 1/6
18 : 1/6
}}}
Both results should be the same! The second result can be explained by the
binding mechanism.
A workaround is to clone _die1_ before doing the _times(2)_:
{{{
>>> die1 + (die1.clone().times(2))
3 : 1/216
4 : 3/216
5 : 6/216
6 : 10/216
7 : 15/216
8 : 21/216
9 : 25/216
10 : 27/216
11 : 27/216
12 : 25/216
}}}
Resolution: change the _times_ method to perform a clone of self.
Original issue reported on code.google.com by [email protected]
on 14 Oct 2014 at 8:47
The example shown in the tutorial
die1.withProb(die1>=5,1,2)
causes the message
Lea error: unfeasible: probability shall remain 0
Original issue reported on code.google.com by [email protected]
on 8 Feb 2015 at 8:58
Consider the following CPT example in Leapp;
x = ?:(1/3)
y = ?:(1/4)
z1 = ?! ( ~x & ~y -> ?:(1/5),
~x & y -> ?:(1/7),
x & ~y -> ?:(1/2),
x & y -> ?:(1/2))
Notice that z1 is independent of y when x is true (i.e. "context-specific
Independence").
The following refactoring
z4 = ?! ( ~x -> ?! ( ~y -> ?:(1/5),
y -> ?:(1/7)),
x -> ?:(1/2))
is not correctly parsed by Leapp, which reports
Python error: too many values to unpack (expected 2)
After activating the debug mode of Leapp, the following trace is displayed:
Traceback (most recent call last):
File "/Users/admin/Documents/lea2/leapp_console.py", line 108, in startCmdLoop
self.execLeappTranslatorMultilineStatement(rMultilineStatement)
File "/Users/admin/Documents/lea2/leapp_console.py", line 71, in execLeappTranslatorMultilineStatement
pMultilineStatement = LeappTranslator.getTarget00(rMultilineStatement)
File "/Users/admin/Documents/lea2/leapp_translator.py", line 107, in getTarget00
pStatementLines.append(identStr+LeappTranslator.getTarget0(unindentedLeaStatementLine))
File "/Users/admin/Documents/lea2/leapp_translator.py", line 143, in getTarget0
return headTarget + LeappTranslator.getTarget0b(sourceFragment) + tailTarget
File "/Users/admin/Documents/lea2/leapp_translator.py", line 151, in getTarget0b
target = LeappTranslator.getTarget1(sourceFragment)
File "/Users/admin/Documents/lea2/leapp_translator.py", line 189, in getTarget1
unstringedTargetFragment = LeappTranslator.getTarget(unstringedFragment)
File "/Users/admin/Documents/lea2/leapp_translator.py", line 266, in getTarget
targetFragment = LeappTranslator.parse(targetFragment,'?!' ,'(',')','Lea.buildCPT(*(%s,))',LeappTranslator.treatCPTExpression)
File "/Users/admin/Documents/lea2/leapp_translator.py", line 364, in parse
body = treatFunc(body)
File "/Users/admin/Documents/lea2/leapp_translator.py", line 258, in treatCPTExpression
newCPTExpression = ','.join('(%s,%s)'%(f(condExpr),distribExpr) for (condExpr,distribExpr) in cptItems)
File "/Users/admin/Documents/lea2/leapp_translator.py", line 258, in <genexpr>
newCPTExpression = ','.join('(%s,%s)'%(f(condExpr),distribExpr) for (condExpr,distribExpr) in cptItems)
ValueError: too many values to unpack (expected 2)
Original issue reported on code.google.com by [email protected]
on 14 Mar 2015 at 2:04
One feature I miss is create a distribution from a list.
Original issue reported on code.google.com by [email protected]
on 24 Nov 2014 at 4:14
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.