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

doctests.py problem IndexError: list index out of range

Expand Messages
  • georgel360
    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):
    Message 1 of 1 , Dec 29, 2004
    • 0 Attachment
      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
    Your message has been successfully submitted and would be delivered to recipients shortly.