1. Andrej T.
  2. orange

Commits

Andrej T.  committed 47a59df

Updates to "Load data" tutorial; draft for imputation unit test.

  • Participants
  • Parent commits 55d9c65
  • Branches default

Comments (0)

Files changed (4)

File Orange/testing/unit/tests/test_imputation.py

View file
  • Ignore whitespace
+from Orange.misc import testing
+from Orange.misc.testing import datasets_driven, test_on_data
+try:
+	import unittest2 as unittest
+except:
+	import unittest
+
+@datasets_driven(datasets=["bridges"])
+class TestImputation(testing.DataTestCase):
+
+	def setUp(self):
+		pass
+
+	@test_on_data
+	def test_imputation(self, dataset):
+		print dataset
+
+if __name__ == "__main__":
+	unittest.main()

File docs/tutorial/rst/code/lenses.py

View file
  • Ignore whitespace
 # Description: Read data, list attributes and class values, print first few data instances
 # Category:    description
-# Uses:        lenses.tab
-# Classes:     ExampleTable
+# Classes:     Table
 # Referenced:  load_data.htm
 
-import orange
-data = orange.ExampleTable("lenses")
+import Orange
+data = Orange.data.Table("lenses")
 print "Attributes:",
 for i in data.domain.attributes:
     print i.name,

File docs/tutorial/rst/load-data.rst

View file
  • Ignore whitespace
 Python. In the interactive Python shell, import Orange and the data
 file:
 
->>> import orange
->>> data = orange.ExampleTable("lenses")
+>>> import Orange
+>>> data = Orange.data.Table("lenses")
 >>>
 
 This creates an object called data that holds your data set and
 reads lenses data, prints out names of the attributes and class, and
 lists first 5 data instances (:download:`lenses.py <code/lenses.py>`)::
 
-   import orange
-   data = orange.ExampleTable("lenses")
+   import Orange
+   data = Orange.data.Table("lenses")
    print "Attributes:",
    for i in data.domain.attributes:
        print i.name,
    print
    print "Class:", data.domain.classVar.name
-   
+
    print "First 5 data items:"
    for i in range(5):
       print data[i]
 :download:`car.names <code/car.names>` and run the following code::
 
    > python
-   >>> car_data = orange.ExampleTable("car")
+   >>> car_data = Orange.data.Table("car")
    >>> print car_data.domain.attributes
    <buying, maint, doors, persons, lugboot, safety>
    >>>
 spreadsheet, you may now store your C4.5 data file to a Orange native
 (.tab) format:
 
->>> orange.saveTabDelimited ("car.tab", car_data)
+>>> Orange.core.saveTabDelimited ("car.tab", car_data)
 >>>
 
-Similarly, saving to C4.5 format is possible through ``orange.saveC45``.
+Similarly, saving to C4.5 format is possible through ``Orange.core.saveC45``.
 
 Above all applies if you run Python through Command Prompt. If you use
 PythonWin, however, you have to tell it where exactly your data is
 located. You may either need to specify absolute path of your data
 files, like (type your commands in Interactive Window):
 
->>> car_data = orange.ExampleTable("c:/orange/car")
+>>> car_data = Orange.data.Table("c:/orange/car")
 >>>
 
 or set a working directory through Python's os library:

File docs/tutorial/rst/start.rst

View file
  • Ignore whitespace
 type import Orange, brackets are in the following to denote shell's
 prompt):
 
->>> import orange
+>>> import Orange
 >>> 
 
 If this leaves no error and warning, Orange and python are properly