pythoncharmers / maxentropy Goto Github PK
View Code? Open in Web Editor NEWMaximum entropy and minimum divergence models in Python
License: Other
Maximum entropy and minimum divergence models in Python
License: Other
After installing ‘maxentropy’, and also ‘six’ (because of issue #1) and ‘numpy’ (because of issue #2):
$ python3 -m pip install six numpy maxentropy
Collecting six
Using cached six-1.10.0-py2.py3-none-any.whl
Collecting numpy
Using cached numpy-1.13.1-cp36-cp36m-manylinux1_x86_64.whl
Collecting maxentropy
Installing collected packages: six, numpy, maxentropy
Successfully installed maxentropy-0.2.3 numpy-1.13.1 six-1.10.0
it fails to import:
$ python3 -c 'import maxentropy'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/bignose/bayesml/lib/python3.6/site-packages/maxentropy/__init__.py", line 84, in <module>
from .basemodel import BaseModel
File "/home/bignose/bayesml/lib/python3.6/site-packages/maxentropy/basemodel.py", line 10, in <module>
from scipy import optimize
ModuleNotFoundError: No module named 'scipy'
The Distutils metadata has not declared this dependency.
Hi,
When I run your example for truncated Gaussian, I always get this error.
It seems like an issue with indentation but very hard to spot. can you please help.
Regards
After installing ‘maxentropy’, and also ‘six’ (because of issue #1):
$ python3 -m pip install six maxentropy
Collecting six
Using cached six-1.10.0-py2.py3-none-any.whl
Collecting maxentropy
Installing collected packages: six, maxentropy
Successfully installed maxentropy-0.2.3 six-1.10.0
it fails to import:
$ python3 -c 'import maxentropy'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/bignose/bayesml/lib/python3.6/site-packages/maxentropy/__init__.py", line 84, in <module>
from .basemodel import BaseModel
File "/home/bignose/bayesml/lib/python3.6/site-packages/maxentropy/basemodel.py", line 9, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
The Distutils metadata has not declared this dependency.
After installing ‘maxentropy’, and also ‘six’ (because of issue #1), ‘numpy’ (because of issue #2), ‘scipy’ (because of issue #3):
$ python3 -m pip install six numpy scipy maxentropy
Collecting six
Using cached six-1.10.0-py2.py3-none-any.whl
Collecting numpy
Using cached numpy-1.13.1-cp36-cp36m-manylinux1_x86_64.whl
Collecting scipy
Using cached scipy-0.19.1-cp36-cp36m-manylinux1_x86_64.whl
Collecting maxentropy
Installing collected packages: six, numpy, scipy, maxentropy
Successfully installed maxentropy-0.2.3 numpy-1.13.1 scipy-0.19.1 six-1.10.0
it fails to import:
$ python3 -c 'import maxentropy'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/bignose/bayesml/lib/python3.6/site-packages/maxentropy/__init__.py", line 84, in <module>
from .basemodel import BaseModel
File "/home/bignose/bayesml/lib/python3.6/site-packages/maxentropy/basemodel.py", line 12, in <module>
from sklearn.utils import check_array
ModuleNotFoundError: No module named 'sklearn'
The Distutils metadata has not declared this dependency.
I think this is probably related to #5.
When I try to use the ConditionalModel
class, I get TypeError: __init__() missing 2 required positional arguments: 'features' and 'samplespace'
from the call super(ConditionalModel, self).__init__()
in ConditonalModel.__init__()
.
Is this due to a current round of refactoring? Should it be necessary to pass feature functions and sample space in to ConditionalModel
? It looks like it wasn't always necessary (e.g. this old python 2 example https://github.com/stefanv/scipy3/blob/master/scipy/maxentropy/examples/conditionalexample2.py).
If I comment out the call to super
, then the fit
function fails because model
is not defined. Not sure if these things are directly related, or if this is a separate issue.
Hello,
I'm not sure if this is the best place for such a discussion, but I am having issues with divergence and wonder if it stems from how I have formulated my feature set. My feature set consists of random perceptrons ie. sigmoidal functions with weights drawn from a standard normal. This design comes from a paper I am studying on how to compress distributions. I have tried different sizes (n = 5 to n = 500) of this feature set to reconstruct a simple uniform discrete distribution, but I am getting divergence errors in all cases. Do you have any intuition for why my features would be ill-defined? If this is best discussed over email, you can reach me at [email protected].
Thank you
For the truncated Gaussians notebook, the line for target_expectations seems wrong. You are using:
target_expectations = [f0(mv).mean(), f1(mv).mean()]
when you only want the second constraint to be 1, not the mean. The next question is the one that asks for the second constraint to be the mean. So, this should be used for target_expectations.
target_expectations = [f0(mv).mean(),1]
In the Loaded die notebook, this is used:
model = maxentropy.Model(samplespace)
When Model requires more than 1 argument and therefore gives an error in the notebook. Should be:
model = maxentropy.Model(f,samplespace)
In the same notebook, this is used:
model.fit(f, K)
Which gives an error, and should be just:
model.fit(K)
Also, I don't understand why the Model class has "if self.priorlogprobs is not None" i.e it's checking for priorlogprobs, when it doesn't even accept priorlogprobs in its parameter list.
Do the Model and BigModel class have any use? It seems the MinDivergenceModel and MCMinDivergenceModel rely only on BaseModel. Can Model and BigModel be deleted, without affecting the code?
Thank you.
Hi there,
I was trying to run the examples but got stuck at the very beginning, showing
Traceback (most recent call last):
File "berger_example.py", line 43, in
model = maxentropy.Model(f, samplespace)
File "/Users/yianyin/anaconda/lib/python3.6/site-packages/maxentropy-0.2.3-py3.6.egg/maxentropy/model.py", line 53, in init
super(Model, self).init()
TypeError: init() missing 1 required positional argument: 'prior_log_probs'
Anyone has ideas what's going on? Thanks a lot!
After installing ‘maxentropy’:
$ python3 -m pip install maxentropy
Collecting maxentropy
Installing collected packages: maxentropy
Successfully installed maxentropy-0.2.3
it fails to import:
$ python3 -c 'import maxentropy'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/bignose/bayesml/lib/python3.6/site-packages/maxentropy/__init__.py", line 84, in <module>
from .basemodel import BaseModel
File "/home/bignose/bayesml/lib/python3.6/site-packages/maxentropy/basemodel.py", line 8, in <module>
import six
ModuleNotFoundError: No module named 'six'
The Distutils metadata has not declared this dependency.
According to this page, and deprecation error occurring when I try to run tests on a package using maxentropy, sklearn should not be listed as a requirement anymore, but instead scikit-learn.
What sort of solutions are out there for those of us who want to do maximum entropy reconstruction of continuous distributions?
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.