Harmonization error estimation does not work for kNN algorithms.
This line asserts a 2D classification map: https://gitext.gfz-potsdam.de/geomultisens/spechomo/blob/master/spechomo/prediction.py#L490
However, in case of kNN classification, the classification map is 3D (contains classification maps respecting N neighbours). This causes the following exception:
Performing k-nearest neighbour spectral angle mapper (kNN_SAM; k=10) image classification...
2019/09/25 00:10:31: Total classification time: 00:00:00
2019/09/25 00:10:31: Predicting tile ((0, 49), (0, 49))...
2019/09/25 00:10:31: Total prediction time: 00:00:00
2019/09/25 00:10:31: Inpainting error values for cluster #0...
/home/gfz-fe/scheffler/python/spechomo/spechomo/prediction.py:490: VisibleDeprecationWarning: boolean index did not match indexed array along dimension 2; dimension is 11 but corresponding boolean dimension is 10
errors[self.classif_map[:] == pixVal] = rmse_per_band_int
Error
Traceback (most recent call last):
File "/home/gfz-fe/python_GFZ/python/lib/python3.6/unittest/case.py", line 59, in testPartExecutor
yield
File "/home/gfz-fe/python_GFZ/python/lib/python3.6/unittest/case.py", line 605, in run
testMethod()
File "/home/gfz-fe/scheffler/python/spechomo/tests/test_prediction.py", line 91, in test_predict_by_machine_learner__LR_L8_S2
nodataVal=-9999
File "/home/gfz-fe/scheffler/python/spechomo/spechomo/prediction.py", line 178, in predict_by_machine_learner
errors = PR.compute_prediction_errors(im_homo, cls, nodataVal=nodataVal, cmap_nodataVal=nodataVal)
File "/home/gfz-fe/scheffler/python/spechomo/spechomo/prediction.py", line 490, in compute_prediction_errors
errors[self.classif_map[:] == pixVal] = rmse_per_band_int
Exception: shape mismatch: value array of shape (11,) could not be broadcast to indexing result of shape (287,)