Skip to content

Commit

Permalink
scoring function improved
Browse files Browse the repository at this point in the history
  • Loading branch information
grro committed Jan 3, 2023
1 parent b11c9b9 commit f1f0d99
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pvpower/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def num_samples_last_train(self) -> int:
def retrain(self, train_data: TrainData):
start = time.time()
samples = train_data.samples
samples = [sample for sample in samples if sample.irradiance > 0] # do not train the estimator for zero irradiance
samples = [sample for sample in samples if sample.irradiance > 0] # special handling zero irradiance records
feature_vector_list = [self.__vectorizer.vectorize(sample) for sample in samples]
label_list = [sample.power_watt for sample in samples]
if len(set(label_list)) > 1:
Expand All @@ -223,7 +223,7 @@ def retrain(self, train_data: TrainData):
logging.debug("estimator can not be trained. Insufficient train data")

def predict(self, sample: WeatherForecast) -> int:
if sample.irradiance > 0: # shortcut. no irradiance means no power
if sample.irradiance > 0: # special handling zero irradiance records. no irradiance means no power
if self.__num_samples_last_train < 1:
logging.warning("estimator has not been trained (insufficient train data available). returning 0")
return 0
Expand Down
2 changes: 1 addition & 1 deletion pvpower/trainingcenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def score(self) -> float:
continue
scores.append(self.__score(real, predicted))
scores_without_outliners = self.__without_outliners(scores, 0.1)
return mean(scores_without_outliners)
return round(mean(scores_without_outliners), 2)

@staticmethod
def __without_outliners(scores: List[int], percent: float) -> List[int]:
Expand Down

0 comments on commit f1f0d99

Please sign in to comment.