예제 #1
0
    def __call__(self, data, weight_id=None):
        """
        Return a classifier trained on the `data` (`weight_id` is ignored).

        :param Orange.data.Table data:
            Training data set.
        :param int weight_id:
            Ignored.
        :rval: Orange.core.LinearClassifier

        .. note::
            The :class:`Orange.core.LinearClassifier` is same class as
            :class:`Orange.classification.svm.LinearClassifier`.

        """
        if not isinstance(data.domain.class_var, Orange.feature.Discrete):
            raise TypeError("Can only learn a discrete class.")

        if data.domain.has_discrete_attributes(False) or self.normalization:
            dc = DomainContinuizer()
            dc.multinomial_treatment = self.multinomial_treatment
            dc.class_treatment = dc.Ignore
            dc.continuous_treatment = \
                    dc.NormalizeByVariance if self.normalization else dc.Leave
            c_domain = dc(data)
            data = data.translate(c_domain)
        return super(LibLinearLogRegLearner, self).__call__(data, weight_id)
예제 #2
0
    def __call__(self, data, weight_id=None):
        """
        Return a classifier trained on the `data` (`weight_id` is ignored).

        :param Orange.data.Table data:
            Training data set.
        :param int weight_id:
            Ignored.
        :rval: Orange.core.LinearClassifier

        .. note::
            The :class:`Orange.core.LinearClassifier` is same class as
            :class:`Orange.classification.svm.LinearClassifier`.

        """
        if not isinstance(data.domain.class_var, Orange.feature.Discrete):
            raise TypeError("Can only learn a discrete class.")

        if data.domain.has_discrete_attributes(False) or self.normalization:
            dc = DomainContinuizer()
            dc.multinomial_treatment = self.multinomial_treatment
            dc.class_treatment = dc.Ignore
            dc.continuous_treatment = \
                    dc.NormalizeByVariance if self.normalization else dc.Leave
            c_domain = dc(data)
            data = data.translate(c_domain)
        return super(LibLinearLogRegLearner, self).__call__(data, weight_id)
예제 #3
0
 def _normalize(self, data):
     dc = DomainContinuizer()
     dc.class_treatment = DomainContinuizer.Ignore
     dc.continuous_treatment = DomainContinuizer.NormalizeBySpan
     dc.multinomial_treatment = DomainContinuizer.AsNormalizedOrdinal
     newdomain = dc(data)
     return data.translate(newdomain)
    def __call__(self, data, weight_id=None):
        if not isinstance(data.domain.class_var, Orange.feature.Discrete):
            raise TypeError("Can only learn a discrete class.")

        if data.domain.has_discrete_attributes(False) or self.normalization:
            dc = DomainContinuizer()
            dc.multinomial_treatment = self.multinomial_treatment
            dc.class_treatment = dc.Ignore
            dc.continuous_treatment = dc.NormalizeByVariance if self.normalization else dc.Leave
            c_domain = dc(data)
            data = data.translate(c_domain)
        return super(LibLinearLogRegLearner, self).__call__(data, weight_id)
    def __call__(self, data, weight_id=None):
        if not isinstance(data.domain.class_var, Orange.feature.Discrete):
            raise TypeError("Can only learn a discrete class.")

        if data.domain.has_discrete_attributes(False) or self.normalization:
            dc = DomainContinuizer()
            dc.multinomial_treatment = self.multinomial_treatment
            dc.class_treatment = dc.Ignore
            dc.continuous_treatment = \
                    dc.NormalizeByVariance if self.normalization else dc.Leave
            c_domain = dc(data)
            data = data.translate(c_domain)
        return super(LibLinearLogRegLearner, self).__call__(data, weight_id)