Loading ...
Sorry, an error occurred while loading the content.

Re: aima python doctests problem

Expand Messages
  • mr_caseyj
    I thought I sent my previous message as an email to georgel360 only.But since it somehow made its way to the list, I guess I should explain. My question was in
    Message 1 of 2 , Jan 10, 2005
    • 0 Attachment
      I thought I sent my previous message as an email to georgel360
      only.But since it somehow made its way to the list, I guess I should
      explain. My question was in regard to the problem georgel360 posted
      on Dec 29. When we run "python doctests.py -v *.py" we get a "list
      index out of range" error, apparently from the learning.py module.
      I'm just a python beginner, so I'll probably postpone debugging this
      problem in chapter 18 code, until I've gone through chapters 1-17.

      --- In aima-talk@yahoogroups.com, "georgel360" <george@l...> wrote:


      >
      > Just downloaded and unzipped aima-python.zip
      > I ran doctests.py as follows:
      > [root@localhost AIMA]# python doctests.py -v *.py
      > Traceback (most recent call last):
      > File "doctests.py", line 41, in ?
      > modules = [__import__(name.replace('.py',''))
      > File "/home/george/downloads/python/AIMA/learning.py", line 569,
      in ?
      > def compare(algorithms=[MajorityLearner, NaiveBayesLearner,

      > File "/home/george/downloads/python/AIMA/learning.py", line 533,
      in
      > SyntheticRestaurant
      > return RestaurantDataSet([gen() for i in range(n)])
      > File "/home/george/downloads/python/AIMA/learning.py", line 531,
      in gen
      > example[restaurant.target] = tree.predict(example)
      > File "/home/george/downloads/python/AIMA/learning.py", line 274,
      in
      > predict
      > child = self.branches[example[self.attr]]
      > IndexError: list index out of range
      >
      > I ran this under Red Hat Linux Linux 9, python 2.3.4 (see
      following)
      >
      > [root@localhost AIMA]# python
      > Python 2.3.4 (#1, Dec 28 2004, 20:29:54)
      > [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
      > Type "help", "copyright", "credits" or "license" for more
      information.
      > >>>
      > [root@localhost AIMA]#
      >
      > Help Please



      --- In aima-talk@yahoogroups.com, "mr_caseyj" <mr_caseyj@y...>
      wrote:
      >
      >
      > I'm having the same problem with the doctests as you reported in
      the
      > aima-talk mailing list. I'm also running python 2.3.4, but under

      > OpenBSD 3.6. Have you found the solution yet?
      >
      > Thanks,
      > Casey Jones
    Your message has been successfully submitted and would be delivered to recipients shortly.