Changeset 11397:e4b810f1f493 in orange for Orange/classification/svm/__init__.py
 Timestamp:
 03/12/13 17:02:59 (13 months ago)
 Branch:
 default
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Orange/classification/svm/__init__.py
r11377 r11397 20 20 21 21 from Orange.data import preprocess 22 from Orange.data.preprocess import DomainContinuizer 22 23 23 24 from Orange import feature as variable … … 805 806 806 807 def __init__(self, solver_type=L2R_L2LOSS_DUAL, C=1.0, eps=0.01, 807 bias=1.0, normalization=True, **kwargs): 808 bias=1.0, normalization=True, 809 multinomial_treatment=DomainContinuizer.NValues, **kwargs): 808 810 """ 809 811 :param solver_type: One of the following class constants: … … 833 835 :type normalization: bool 834 836 835 .. note:: If the training data contains discrete features they are 836 replaced by indicator columns one for each value of the feature 837 regardless of the value of `normalization`. This is different 838 then in :class:`SVMLearner` where this is done only if 837 :param multinomial_treatment: Defines how to handle multinomial 838 features for learning. It can be one of the 839 :class:`~.DomainContinuizer` `multinomial_treatment` 840 constants (default: `DomainContinuizer.NValues`). 841 842 :type multinomial_treatment: int 843 844 .. versionadded:: 2.6.1 845 Added `multinomial_treatment` 846 847 .. note:: By default if the training data contains discrete features 848 they are replaced by indicator columns one for each value of the 849 feature regardless of the value of `normalization`. This is 850 different then in :class:`SVMLearner` where this is done only if 839 851 `normalization` is ``True``. 840 852 … … 852 864 self.bias = bias 853 865 self.normalization = normalization 866 self.multinomial_treatment = multinomial_treatment 854 867 855 868 for name, val in kwargs.items(): 856 869 setattr(self, name, val) 870 857 871 if self.solver_type not in [self.L2R_L2LOSS_DUAL, self.L2R_L2LOSS, 858 872 self.L2R_L1LOSS_DUAL, self.L1R_L2LOSS]: 859 warnings.warn( """\860 Deprecated 'solver_type', use 861 'Orange.classification.logreg.LibLinearLogRegLearner' 862 to build a logistic regression model using LIBLINEAR. 863 """, 864 DeprecationWarning)873 warnings.warn( 874 " Deprecated 'solver_type', use " 875 "'Orange.classification.logreg.LibLinearLogRegLearner'" 876 "to build a logistic regression models using LIBLINEAR.", 877 DeprecationWarning 878 ) 865 879 866 880 def __call__(self, data, weight_id=None): … … 869 883 870 884 if data.domain.has_discrete_attributes(False) or self.normalization: 871 dc = Orange.data.continuization.DomainContinuizer()872 dc.multinomial_treatment = dc.NValues885 dc = DomainContinuizer() 886 dc.multinomial_treatment = self.multinomial_treatment 873 887 dc.class_treatment = dc.Ignore 874 888 dc.continuous_treatment = \ … … 888 902 889 903 def __init__(self, C=1.0, eps=0.01, bias=1.0, 890 normalization=True, **kwargs): 904 normalization=True, 905 multinomial_treatment=DomainContinuizer.NValues, 906 **kwargs): 891 907 """\ 892 908 :param C: Regularization parameter (default 1.0) … … 904 920 (default True) 905 921 :type normalization: bool 922 923 :param multinomial_treatment: Defines how to handle multinomial 924 features for learning. It can be one of the 925 :class:`~.DomainContinuizer` `multinomial_treatment` 926 constants (default: `DomainContinuizer.NValues`). 927 928 :type multinomial_treatment: int 929 930 .. versionadded:: 2.6.1 931 Added `multinomial_treatment` 906 932 907 933 """ … … 910 936 self.bias = bias 911 937 self.normalization = normalization 938 self.multinomial_treatment = multinomial_treatment 912 939 for name, val in kwargs.items(): 913 940 setattr(self, name, val) … … 920 947 921 948 if data.domain.has_discrete_attributes(False) or self.normalization: 922 dc = Orange.data.continuization.DomainContinuizer()923 dc.multinomial_treatment = dc.NValues949 dc = DomainContinuizer() 950 dc.multinomial_treatment = self.multinomial_treatment 924 951 dc.class_treatment = dc.Ignore 925 952 dc.continuous_treatment = \
Note: See TracChangeset
for help on using the changeset viewer.