some new features
This commit is contained in:
@ -33,10 +33,10 @@
|
||||
{% endif %}
|
||||
|
||||
{% if do_forecasting %}
|
||||
<div class="card mb-4">
|
||||
<div class="card mb-4" id="forecast-section">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Forecast (ARIMA{{ arima_params }}, Seasonal{{ seasonal_params }})</h5>
|
||||
<form method="post" action="/reforecast">
|
||||
<form method="post" action="/reforecast" id="reforecast-form">
|
||||
<div class="mb-3">
|
||||
<label for="train_percent" class="form-label">Training Data Percentage (50-95%):</label>
|
||||
<input type="number" class="form-control" name="train_percent" id="train_percent" value="{{ train_percent }}" min="50" max="95" step="1">
|
||||
@ -49,13 +49,61 @@
|
||||
<label for="forecast_periods" class="form-label">Number of Periods to Forecast (1-24):</label>
|
||||
<input type="number" class="form-control" name="forecast_periods" id="forecast_periods" value="{{ forecast_periods }}" min="1" max="24" step="1">
|
||||
</div>
|
||||
<div class="form-check mb-3">
|
||||
<input class="form-check-input" type="checkbox" name="add_to_existing" id="add_to_existing">
|
||||
<label class="form-check-label" for="add_to_existing">
|
||||
Add to Existing Plots
|
||||
</label>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Re-run Forecast</button>
|
||||
</form>
|
||||
<hr>
|
||||
<p>Training Data: {{ train_percent }}% ({{ train_size }} observations)</p>
|
||||
<p>Test Data: {{ test_percent }}% ({{ test_size }} observations)</p>
|
||||
<p>Forecast Periods: {{ forecast_periods }}</p>
|
||||
{% if metrics %}
|
||||
<p>Mean Absolute Error (MAE): {{ metrics.MAE|round(4) }}</p>
|
||||
<p>Mean Squared Error (MSE): {{ metrics.MSE|round(4) }}</p>
|
||||
<p>Root Mean Squared Error (RMSE): {{ metrics.RMSE|round(4) }}</p>
|
||||
{% endif %}
|
||||
{{ forecast_html | safe }}
|
||||
<hr>
|
||||
<h6>Forecast History</h6>
|
||||
<form method="post" action="/compare_forecasts" id="compare-form">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Run</th>
|
||||
<th>Select</th>
|
||||
<th>Train Percent (%)</th>
|
||||
<th>Test Percent (%)</th>
|
||||
<th>Forecast Periods</th>
|
||||
<th>MAE</th>
|
||||
<th>MSE</th>
|
||||
<th>RMSE</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for entry in forecast_history %}
|
||||
<tr>
|
||||
<td>{{ loop.index }}</td>
|
||||
<td>
|
||||
<input type="checkbox" name="selected_forecasts" value="{{ loop.index0 }}"
|
||||
{% if loop.index0 in selected_indices %}checked{% endif %}>
|
||||
</td>
|
||||
<td>{{ entry.train_percent|round(2) }}</td>
|
||||
<td>{{ entry.test_percent|round(2) }}</td>
|
||||
<td>{{ entry.forecast_periods }}</td>
|
||||
<td>{{ entry.mae|round(4) if entry.mae else 'N/A' }}</td>
|
||||
<td>{{ entry.mse|round(4) if entry.mse else 'N/A' }}</td>
|
||||
<td>{{ entry.rmse|round(4) if entry.rmse else 'N/A' }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<button type="submit" class="btn btn-primary mb-3">Compare Selected Forecasts</button>
|
||||
</form>
|
||||
<a href="/download_forecast_history" class="btn btn-primary mb-3">Download Forecast History (Excel)</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
@ -82,6 +130,10 @@
|
||||
testInput.addEventListener('input', function() {
|
||||
trainInput.value = (100 - parseFloat(this.value)).toFixed(0);
|
||||
});
|
||||
// Scroll to forecast section after re-forecast
|
||||
{% if scroll_to_forecast %}
|
||||
document.getElementById('forecast-section').scrollIntoView({ behavior: 'smooth' });
|
||||
{% endif %}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user