Giter Club home page Giter Club logo

entropy-calculator's People

Contributors

petebleackley avatar

Watchers

 avatar

entropy-calculator's Issues

Almost PEP style formatted code

Hi Team,

This is a wonderful implementation.

I just cleaned code and almost include PEP standard to the code.

The enhanced code is available at https://gist.github.com/jaganadhg/7117483

Please have a look.

Best regards

Jagan 

Original issue reported on code.google.com by [email protected] on 23 Oct 2013 at 12:16

improve sentence spliiter

What steps will reproduce the problem?

the current regex SplitSentences=re.compile(u'[.!?]') splits  expressions like 
'4.5 $US' to ['4', '$US']


split_sentences = re.compile(u'[.!?]\s+')

is more precise as it checks a whitespace following the end sentence mark

Original issue reported on code.google.com by christian.ledermann on 1 Nov 2013 at 8:21

Not Working with Windows and Cygwin Python

I have Python v2.7.3 on Windows and Python v2.6.5 on Cygwin (a BASH shell in 
Windows). Both of them throw the error "ImportError: cannot import name lgamma" 
when am trying to run the main program.

It could very well be my setup and being a Python newbie, I have to figure it 
out but any help would be appreciated.

Full IO -
$ python.exe Entropy.py paper.txt out.csv
Traceback (most recent call last):
  File "Entropy.py", line 3, in <module>
    import EntropyCalculator
  File "/cygdrive/e/Coding-Sample-Home-Projects/SIT-Entropy-Distribution-Python/EntropyCalculator.py", line 3, in <module>
    from math import log,exp,lgamma
ImportError: cannot import name lgamma

Original issue reported on code.google.com by [email protected] on 22 Oct 2013 at 11:52

ValueError: math domain error

What steps will reproduce the problem?

it fails with this text:

u'EAP: Threatened Marine Ecosystems Get Boost from USD 4.5 Million Grant from 
the GEF\n\nThe World Bank\u2019s Board of Executive Directors today approved a 
project to support the Capturing Coral Reef and Related Ecosystem Services 
Project, with USD 4.5 million in grant funding provided by the Global 
Environment Facility (GEF). This regional project will design innovative models 
for valuing mangrove, sea grass and coral reef ecosystems services to inform 
policy and decision making for improved environmental stewardship of these 
critical resources.\n\nThe project focuses on Indonesia and the Philippines, 
where coral reefs and related ecosystem services are critical to livelihoods, 
food security and climate resilience, and includes activities to: quantify the 
value and market potential of coral reef and mangrove ecosystem services; forge 
community-led innovation in capturing and sustaining benefits from marine 
eco-system services and enhancing resilience in the face of climate change; and 
promote behavior change through outreach and widely disseminate scientific 
information to inform policy- and decision-making.\n\nCoastal and marine 
resources and their associated ecosystem services in the region are linked to 
globally important marine biodiversity and underpin an enormous part of the 
regional economy.\n\n\u201cCapturing the economic and cultural values of marine 
natural capital through the valuation of ecosystem services, and quantifying 
the cost of lost services due to environmental degradation, has enormous 
potential. We can transform the development and stewardship of coastal areas by 
translating ecological value into financial terms for local stakeholders and 
policy makers,\u201d said Marea Hatziolos, Senior Environmental Specialist and 
the World Bank\u2019s team leader for the project.\n\n\u201cThis wealth of 
natural capital has the potential to be a major driver of inclusive green 
growth in the region, if we overcome some huge challenges. We especially need 
better resource governance regimes, measures to adequately value the 
environment for current and future generations when calculating economic 
benefits, and good scientific information to inform decision making and 
tradeoffs,\u201d she added.\n\nThe world\u2019s biodiversity epicenter lies 
within the Coral Triangle \u2013 an area that extends from the northern 
Philippines to Malaysia in the west, East Timor to the South, Eastern Indonesia 
and Papua New Guinea to the East and trailing off to the Solomon Islands toward 
the Southeast. Here, coral reefs are most abundant and diverse and support 
large populations of people who are highly dependent on coral reef fisheries 
for the livelihoods and food security. In the Western and Central Pacific, 
healthy coral reefs and mangroves form the first critical line of defense 
against storm surge and sea-level rise for low lying islands and atolls.\n\nThe 
GEF grant will be administered by the Global Change Institute of the University 
of Queensland.\n\nThe University is contributing USD 2 million in additional 
financing and research partners will provide another USD 3.9 million in 
contributions. An additional $21.9 million in parallel co-financing is provided 
by World Bank-financed projects: the Coral Reef Rehabilitation and Management 
Program-Coral Triangle Initiative (COREMAP-CTI) in Indonesia and the Rural 
Development Project in the Philippines.\n'


What is the expected output? What do you see instead?

Traceback (most recent call last):
  File "Entropy.py", line 18, in <module>
    H.AnalyseText()
  File "/home/ledermac/devel/mongo/entropy-calculator/EntropyCalculator.py", line 123, in AnalyseText
    self.RankedWords=[(self.Entropy(word),word) for word in self.unique]
  File "/home/ledermac/devel/mongo/entropy-calculator/EntropyCalculator.py", line 72, in Entropy
    result=self.AnalyticEntropy(n)-H
  File "/home/ledermac/devel/mongo/entropy-calculator/EntropyCalculator.py", line 59, in AnalyticEntropy
    result-=self.MarginalProb(m,n)*x*log(x,2)
  File "/home/ledermac/devel/mongo/entropy-calculator/EntropyCalculator.py", line 46, in MarginalProb
    result=LogCombinations(n,m)
  File "/home/ledermac/devel/mongo/entropy-calculator/EntropyCalculator.py", line 16, in LogCombinations
    result-=lgamma(x-y+1)
ValueError: math domain error


What version of the product are you using? On what operating system?
svn trunk, Python 2.7.2, linux

Please provide any additional information below.

Original issue reported on code.google.com by christian.ledermann on 31 Oct 2013 at 1:49

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.