Commit 144a5e5e authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Spectral homogenization using ridge regression is now working.

parent 15df675c
......@@ -159,7 +159,8 @@ class Test_Classifier_Generator(unittest.TestCase):
CG = Classifier_Generator([RC, RC])
self.assertIsInstance(CG, Classifier_Generator)
def test_create_classifiers_default_params(self):
def test_create_classifiers_LR(self):
"""Test creation of linear regression classifiers."""
CG = Classifier_Generator([refcube_l8, refcube_l5])
CG.create_classifiers(outDir=self.tmpOutdir.name, method='LR')
......@@ -171,7 +172,8 @@ class Test_Classifier_Generator(unittest.TestCase):
self.assertIsInstance(undilled, dict)
self.assertTrue(bool(undilled), msg='Generated classifier collection is empty.')
def test_create_classifiers_ridge_regression(self):
def test_create_classifiers_RR(self):
"""Test creation of ridge regression classifiers."""
CG = Classifier_Generator([refcube_l8, refcube_l5])
CG.create_classifiers(outDir=self.tmpOutdir.name, method='RR')
......@@ -227,7 +229,6 @@ class Test_SpectralHomogenizer(unittest.TestCase):
self.assertEqual(errors.shape, (50, 50, 13))
self.assertEqual(errors.dtype, np.int16)
@unittest.SkipTest # Ridge regression classifiers have not yet been created
def test_predict_by_machine_learner__RR_L8_S2(self):
"""Test ridge regression from Landsat-8 to Sentinel-2A."""
predarr, errors = self.SpH.predict_by_machine_learner(
......@@ -235,7 +236,8 @@ class Test_SpectralHomogenizer(unittest.TestCase):
src_satellite='Landsat-8', src_sensor='OLI_TIRS',
src_LBA=['1', '2', '3', '4', '5', '6', '7'],
tgt_satellite='Sentinel-2A', tgt_sensor='MSI',
tgt_LBA=['1', '2', '3', '4', '5', '6', '7', '8', '8A', '9', '10', '11', '12'])
tgt_LBA=['1', '2', '3', '4', '5', '6', '7', '8', '8A', '9', '10', '11', '12'],
compute_errors=True)
self.assertIsInstance(predarr, GeoArray)
self.assertEqual(predarr.shape, (50, 50, 13))
......@@ -243,4 +245,4 @@ class Test_SpectralHomogenizer(unittest.TestCase):
self.assertIsInstance(errors, np.ndarray)
self.assertEqual(errors.shape, (50, 50, 13))
# TODO add dtype assertion
self.assertEqual(errors.dtype, np.int16)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment