Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
sheriff4000 committed Jun 4, 2024
1 parent acbe80a commit c3e11f4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Backtest/forecast/Combine.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module Combine
This struct represents a forecaster that can be combined with others
"""
struct Forecaster
forecastFunction::Function
params::Vector{Real}
forecastFunction::Function
params::Vector{Real}
end

"""
Expand All @@ -20,14 +20,14 @@ Returns:
- combinedForecast::Vector{Real}: The combined forecast
"""
function combineForecasts(
forecasters::Vector{Tuple{Forecaster, Real}}, data::Vector{Real}; F::Int = 1,
forecasters::Vector{Tuple{Forecaster,Real}}, data::Vector{Real}; F::Int=1
)
combinedForecast = zeros(F)
for (forecaster, weight) in forecasters
forecast = forecaster.forecastFunction(data, forecaster.params...; F = F)
combinedForecast += forecast .* weight
end
return combinedForecast
combinedForecast = zeros(F)
for (forecaster, weight) in forecasters
forecast = forecaster.forecastFunction(data, forecaster.params...; F=F)
combinedForecast += forecast .* weight
end
return combinedForecast
end

end

0 comments on commit c3e11f4

Please sign in to comment.