Пример #1
0
 def test_sparse_pps(self):
     with self.data.unlocked():
         self.data.X = csr_matrix(self.data.X)
     out = AdaptiveNormalize()(self.data)
     true_out = Scale(center=Scale.NoCentering, scale=Scale.Span)(self.data)
     np.testing.assert_array_equal(out, true_out)
     self.data = self.data.X.toarray()
Пример #2
0
class OneClassSVMLearner(_OutlierLearner):
    name = "One class SVM"
    __wraps__ = OneClassSVM
    preprocessors = SklLearner.preprocessors + [AdaptiveNormalize()]

    def __init__(self, kernel='rbf', degree=3, gamma="auto", coef0=0.0,
                 tol=0.001, nu=0.5, shrinking=True, cache_size=200,
                 max_iter=-1, preprocessors=None):
        super().__init__(preprocessors=preprocessors)
        self.params = vars()
Пример #3
0
 def test_dense_pps(self):
     true_out = Normalize()(self.data)
     out = AdaptiveNormalize()(self.data)
     np.testing.assert_array_equal(out, true_out)
Пример #4
0
import sklearn.svm as skl_svm

from Orange.classification import SklLearner
from Orange.preprocess import AdaptiveNormalize

__all__ = ["SVMLearner", "LinearSVMLearner", "NuSVMLearner"]

svm_pps = SklLearner.preprocessors + [AdaptiveNormalize()]


class SVMLearner(SklLearner):
    __wraps__ = skl_svm.SVC
    preprocessors = svm_pps

    def __init__(self,
                 C=1.0,
                 kernel='rbf',
                 degree=3,
                 gamma="auto",
                 coef0=0.0,
                 shrinking=True,
                 probability=False,
                 tol=0.001,
                 cache_size=200,
                 max_iter=-1,
                 preprocessors=None):
        super().__init__(preprocessors=preprocessors)
        self.params = vars()


class LinearSVMLearner(SklLearner):