- 02/06/12 13:44:31 (2 years ago)
- 1 edited
r9806 r9807 28 28 29 29 :obj:`ImputerConstructor` is the abstract root in the hierarchy of classes 30 that get training data and construct an instance of a class derived from 30 that t training data and construct an instance of a class derived from 31 31 :obj:`Imputer`. When an :obj:`Imputer` is called with an 32 :obj:`Orange.data.Instance` it will returna new example with the 32 :obj:`Orange.data.Instance` it a new example with the 33 33 missing values imputed (leaving the original example intact). If imputer is 34 called with an :obj:`Orange.data.Table` it will returna new example table 34 called with an :obj:`Orange.data.Table` it a new example table 35 35 with imputed instances. 36 36 … … 57 57 58 58 An instance :obj:`Orange.data.Instance` with the default values to be 59 imputed instead of missing . Examples to be imputed must be from the same 60 domainas :obj:`defaults`. 59 imputed instead of missinge 60 as :obj:`defaults`. 61 61 62 62 Instances of this class can be constructed by 63 :obj:`Orange.feature.imputation.ImputerConstructor_minimal`, 64 :obj:`Orange.feature.imputation.ImputerConstructor_maximal`, 65 :obj:`Orange.feature.imputation.ImputerConstructor_average`. 66 67 For continuous features, they will impute the smallest, 68 largest or the average values encountered in the training examples. 69 70 For discrete, they will impute the lowest (the one with index 0, 71 e. g. attr.values), the highest (attr.values[-1]), 72 and the most common value encountered in the data. 73 74 The first two imputers 75 will mostly be used when the discrete values are ordered according to their 76 impact on the class (for instance, possible values for symptoms of some 77 disease can be ordered according to their seriousness). The minimal and maximal 78 imputers will then represent optimistic and pessimistic imputations. 79 80 The following code will load the bridges data, and first impute the values 81 in a single examples and then in the whole table. 82 83 :download:`imputation-complex.py <code/imputation-complex.py>` (uses :download:`bridges.tab <code/bridges.tab>`): 84 85 .. literalinclude:: code/imputation-complex.py 86 :lines: 9-23 87 88 This is example shows what the imputer does, not how it is to be used. Don't 89 impute all the data and then use it for cross-validation. As warned at the top 90 of this page, see the instructions for actual `use of 91 imputers <#using-imputers>`_. 92 93 .. note:: The :obj:`ImputerConstructor` are another class with schizophrenic 94 constructor: if you give the constructor the data, it will return an \ 95 :obj:`Imputer` - the above call is equivalent to calling \ 96 :obj:`Orange.feature.imputation.ImputerConstructor_minimal()(data)`. 97 98 You can also construct the :obj:`Orange.feature.imputation.Imputer_defaults` 63 :obj:`~Orange.feature.imputation.ImputerConstructor_minimal`, 64 :obj:`~Orange.feature.imputation.ImputerConstructor_maximal`, 65 :obj:`~Orange.feature.imputation.ImputerConstructor_average`. 66 67 For continuous features, they will impute the smallest, largest or the average 68 values encountered in the training examples. For discrete, 69 they will impute the lowest (the one with index 0, e. g. attr.values), 70 the highest (attr.values[-1]), and the most common value encountered in the 71 data. 72 73 If values of discrete features are be ordered according to their 74 impact on class (for example, possible values for symptoms of some 75 disease can be ordered according to their seriousness), 76 the minimal and maximal imputers will then represent optimistic and 77 pessimistic imputations. 78 79 To construct the :obj:`~Orange.feature.imputation.Imputer_defaults` 99 80 yourself and specify your own defaults. Or leave some values unspecified, in 100 81 which case the imputer won't impute them, as in the following example. Here,
Note: See TracChangeset for help on using the changeset viewer.