Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PSO-GM-BP Numerical Prediction Framework

A MATLAB framework for ordered numerical prediction using a PSO-optimized GM(1,1) trend and a PSO-initialized BP neural network for residual correction.

The final forecast is:

prediction = PSO-GM trend + PSO-BP residual

This is a clean implementation inspired by the referenced methodology. It is not a line-by-line reproduction of the legacy scripts or the paper.

Requirements

  • MATLAB R2020b or newer
  • Deep Learning Toolbox

No Global Optimization Toolbox is required; PSO is implemented locally.

Quick start

From the repository root:

run("examples/run_excavation_example.m")

For a complete test and example run from a terminal:

powershell -ExecutionPolicy Bypass -File .\run_example.ps1
chmod +x run_example.sh
./run_example.sh

The example uses the first 45 ordered observations for model fitting and the last 7 for independent testing. The fit function reserves the final 20% of its input rows as a chronological validation block. It prints the test metrics and saves four-panel value and single-step change figures under results/.

Example results

Overall trend

Overall value prediction

Single-step changes

Each point is the current value minus the preceding value. The first test change is calculated against the final training value.

Single-step change prediction

API

options = struct("Seed", 42, "HiddenSize", 5);
[model, info] = psogmbp.fit(X, y, options);
result = psogmbp.predict(model, XFuture);

X is an n-by-p numeric feature matrix and y is a positive n-by-1 target vector. Rows are treated as chronological and are never shuffled. XFuture must contain the known feature values for the next contiguous time steps. The result table contains Trend, Residual, and Prediction.

Options

Option Default Meaning
Seed 42 Random seed
ValidationFraction 0.2 Final training rows used for validation
GMWindow 6 Recent target rows used by rolling GM(1,1)
ResidualWindow 8 Recent rolling residuals used by PSO-BP
HiddenSize 5 BP hidden neurons
SwarmSize 20 Particles in each PSO search
MaxIterations 50 PSO iterations
Inertia 0.8 PSO inertia weight
Cognitive, Social 1.49445 PSO learning factors
WeightLimit 1 BP weight search bound [-limit, limit]
Epochs 1000 Maximum BP training epochs
Goal 1e-6 BP performance goal
MaxFail 6 Validation failures before early stopping
ShowWindow false Show MATLAB training UI

Data

data/excavation_monitoring.csv contains 52 anonymized, ordered observations:

  • step: sequence index, not a model feature
  • stress_1, stress_2, water_settlement: external features
  • target: positive prediction target

The CSV contains values only; formulas, derived predictions, empty columns, and identifying project information were removed.

Tests

results = runtests("tests");
assert(all([results.Passed]));
run("examples/run_excavation_example.m");

Tests cover deterministic training, an exponential GM trend, output decomposition, finite dimensions, and input validation. Run all three lines from the repository root for a complete test and visualization check.

Limitations

  • GM(1,1) currently requires a positive target series.
  • The GM component uses a configurable recent window to follow changing trends.
  • The BP component uses recent residuals so obsolete operating regimes do not dominate.
  • Future external features must already be known or forecast upstream.
  • The first release supports one target and one hidden BP layer.
  • Small monitoring datasets can still overfit; held-out evaluation remains essential.

Reference

Zhang, Z.Y (2023). PSO-GM-BP Multivariate Model-Based Construction Engineering Deformation Prediction System V1.0. Computer Software Copyright Registration No. 2023SR1465171 (Certificate No. 12052344), China. Registered November 20, 2023.

License

MIT

About

A numerical prediction framework integrating particle swarm optimization, grey modeling, and BP neural networks.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages