import unittest

from autosklearn.pipeline.components.regression.liblinear_svr import \
    LibLinear_SVR
from autosklearn.pipeline.util import _test_regressor

import sklearn.metrics


class SupportVectorComponentTest(unittest.TestCase):
    def test_default_configuration(self):
        for i in range(10):
            predictions, targets = _test_regressor(LibLinear_SVR,
                                                   dataset='boston')
            self.assertAlmostEqual(0.67714499792824023,
                                   sklearn.metrics.r2_score(y_true=targets,
                                                            y_pred=predictions))

import unittest

from autosklearn.pipeline.components.regression.liblinear_svr import \
    LibLinear_SVR
from autosklearn.pipeline.util import _test_regressor

import sklearn.metrics


class SupportVectorComponentTest(unittest.TestCase):
    def test_default_configuration(self):
        for i in range(10):
            predictions, targets = _test_regressor(LibLinear_SVR,
                                                   dataset='boston')
            # Lenient test because of travis-ci which gets quite different
            # results here!
            self.assertAlmostEqual(0.68,
                                   sklearn.metrics.r2_score(y_true=targets,
                                                            y_pred=predictions),
                                   places=2)

FIX numerical issues in test on travis-ci
FIX numerical issues in test on travis-ci

  import unittest
  
  from autosklearn.pipeline.components.regression.liblinear_svr import \
      LibLinear_SVR
  from autosklearn.pipeline.util import _test_regressor
  
  import sklearn.metrics
  
  
  class SupportVectorComponentTest(unittest.TestCase):
      def test_default_configuration(self):
          for i in range(10):
              predictions, targets = _test_regressor(LibLinear_SVR,
                                                     dataset='boston')
+             # Lenient test because of travis-ci which gets quite different
+             # results here!
-             self.assertAlmostEqual(0.67714499792824023,
+             self.assertAlmostEqual(0.68,
                                     sklearn.metrics.r2_score(y_true=targets,
-                                                             y_pred=predictions))
+                                                             y_pred=predictions),
+                                    places=2)
  
FIX numerical issues in test on travis-ci
## Code Before:
import unittest

from autosklearn.pipeline.components.regression.liblinear_svr import \
    LibLinear_SVR
from autosklearn.pipeline.util import _test_regressor

import sklearn.metrics


class SupportVectorComponentTest(unittest.TestCase):
    def test_default_configuration(self):
        for i in range(10):
            predictions, targets = _test_regressor(LibLinear_SVR,
                                                   dataset='boston')
            self.assertAlmostEqual(0.67714499792824023,
                                   sklearn.metrics.r2_score(y_true=targets,
                                                            y_pred=predictions))

## Instruction:
FIX numerical issues in test on travis-ci
## Code After:
import unittest

from autosklearn.pipeline.components.regression.liblinear_svr import \
    LibLinear_SVR
from autosklearn.pipeline.util import _test_regressor

import sklearn.metrics


class SupportVectorComponentTest(unittest.TestCase):
    def test_default_configuration(self):
        for i in range(10):
            predictions, targets = _test_regressor(LibLinear_SVR,
                                                   dataset='boston')
            # Lenient test because of travis-ci which gets quite different
            # results here!
            self.assertAlmostEqual(0.68,
                                   sklearn.metrics.r2_score(y_true=targets,
                                                            y_pred=predictions),
                                   places=2)
