Skip to content

Commit

Permalink
fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
relyt29 committed Aug 21, 2024
1 parent 7078f38 commit b7850d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ func GetCombinedInference(logger log.Logger, inPalette SynthPalette) (

weights, err = palette.CalcWeightsGivenWorkers()
if err != nil {
errorsmod.Wrap(err, "Error calculating weights for combined inference")
return RegretInformedWeights{}, InferenceValue{}, err
return RegretInformedWeights{}, InferenceValue{}, errorsmod.Wrap(err, "Error calculating weights for combined inference")
}

combinedInference, err = palette.CalcWeightedInference(weights)
if err != nil {
errorsmod.Wrap(err, "Error calculating combined inference")
return RegretInformedWeights{}, InferenceValue{}, err
return RegretInformedWeights{}, InferenceValue{}, errorsmod.Wrap(err, "Error calculating combined inference")
}

logger.Debug(fmt.Sprintf("Combined inference calculated for topic %v is %v", inPalette.TopicId, combinedInference))
Expand Down Expand Up @@ -248,15 +246,15 @@ func GetOneOutForecasterInferences(
oneOutForecasterInferences []*emissions.WithheldWorkerAttributedValue, err error) {
logger.Debug(fmt.Sprintf("Calculating one-out forecaster inferences for topic %v with %v forecasters", palette.TopicId, len(palette.Forecasters)))
// Calculate the one-out forecast-implied inferences per forecaster
oneOutImpliedInferences := make([]*emissions.WithheldWorkerAttributedValue, 0)
oneOutForecasterInferences = make([]*emissions.WithheldWorkerAttributedValue, 0)
// If there is only one forecaster, there's no need to calculate one-out inferences
if len(palette.Forecasters) > 1 {
for _, worker := range palette.Forecasters {
oneOutInference, err := calcOneOutForecasterInference(logger, palette, worker)
if err != nil {
return []*emissions.WithheldWorkerAttributedValue{}, errorsmod.Wrapf(err, "Error calculating one-out forecaster inferences")
}
oneOutImpliedInferences = append(oneOutImpliedInferences, &emissions.WithheldWorkerAttributedValue{
oneOutForecasterInferences = append(oneOutForecasterInferences, &emissions.WithheldWorkerAttributedValue{
Worker: worker,
Value: oneOutInference,
})
Expand Down
4 changes: 4 additions & 0 deletions x/emissions/keeper/inference_synthesis/network_inferences.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ func GetNetworkInferences(
}
var weights RegretInformedWeights
networkInferences, weights, err = CalcNetworkInferences(Logger(ctx), synthPalette)
if err != nil {
Logger(ctx).Warn(fmt.Sprintf("Error calculating network inferences: %s", err.Error()))
return networkInferences, nil, infererWeights, forecasterWeights, inferenceBlockHeight, lossBlockHeight, nil
}
forecastImpliedInferencesByWorker = synthPalette.ForecastImpliedInferenceByWorker
infererWeights = weights.inferers
forecasterWeights = weights.forecasters
Expand Down

0 comments on commit b7850d7

Please sign in to comment.