USGS-R / river-dl

Deep learning model for predicting environmental variables on river systems
Creative Commons Zero v1.0 Universal
21 stars 14 forks source link

adds a function for making composite models #204

Closed janetrbarclay closed 1 year ago

janetrbarclay commented 1 year ago

This PR adds a function for combining predictions from multiple models. This can be used for averaging predictions across multiple runs of the same model or for combining outputs from models with different structures / training data / etc.

The inputs are a list of prediction files to merge, weights (optional), predicted variables (optional) and an output file for the composite predictions. Weights can be left blank (in which case the prediction files are weighted equally); specified as a list of weights, 1 for each model; or specified as a list of dataframes, 1 for each model, that has columns with the "modelWeight" (0 to 1) and the space and/or time indices to which the weights apply. The function requires that the weights sum to 1 +/- 0.01.

The function assumes that all prediction files are the same shape and that the first 2 columns are space / time and the remaining columns are predicted variables. The default behavior is to merge all predicted variables, but this can be overridden by specifying the predicted variables to merge. (in which case other predicted variables are dropped from the composite prediction file)