Commit 36ae2aa1 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Added wavelengths to classifiers.

parent 3a3c74a2
Pipeline #3053 failed with stage
in 13 minutes and 58 seconds
......@@ -1260,7 +1260,7 @@ class ClusterClassifier_Generator(object):
def mean_absolute_percentage_error(y_true, y_pred):
y_true, y_pred = np.array(y_true), np.array(y_pred)
return np.mean(np.abs((y_true - y_pred) / y_true), axis=0) * 100
return np.mean(np.abs((y_true - y_pred) / y_true), axis=0) * 100 # TODO avoid division by 0
###########################
# compute RMSE, MAE, MAPE #
......@@ -1391,13 +1391,15 @@ class ClusterClassifier_Generator(object):
# add some metadata
ML.src_satellite = src_cube.satellite
ML.src_sensor = src_cube.sensor
ML.tgt_satellite = tgt_cube.satellite
ML.src_sensor = src_cube.sensor
ML.tgt_sensor = tgt_cube.sensor
ML.src_LBA = src_LBA
ML.tgt_LBA = tgt_LBA
ML.src_n_bands = len(ML.src_LBA)
ML.tgt_n_bands = len(ML.tgt_LBA)
ML.src_wavelengths = list(np.array(src_cube.wavelengths).astype(np.float32))
ML.tgt_wavelengths = list(np.array(tgt_cube.wavelengths).astype(np.float32))
ML.n_clusters = n_clusters
ML.clusterlabel = clusterlabel
ML.cluster_center = cluster_center
......@@ -1665,6 +1667,8 @@ class Cluster_Learner(object):
self.tgt_LBA = sample_MLinst.tgt_LBA
self.src_n_bands = sample_MLinst.src_n_bands
self.tgt_n_bands = sample_MLinst.tgt_n_bands
self.src_wavelengths = sample_MLinst.src_wavelengths
self.tgt_wavelengths = sample_MLinst.tgt_wavelengths
self.n_clusters = sample_MLinst.n_clusters
self.cluster_centers = np.array([cc.cluster_center for cc in self.MLdict.values()])
......
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