From c069343e6a9a5b47284b0bbd85b5ab78ba55e1eb Mon Sep 17 00:00:00 2001 From: Andru Liu <90433630+WallabyLester@users.noreply.github.com> Date: Tue, 8 Oct 2024 21:02:38 -0700 Subject: [PATCH] Implemented predict. --- CPP_Implementation/rbf_model.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CPP_Implementation/rbf_model.cpp b/CPP_Implementation/rbf_model.cpp index 9af2bad..123ab0d 100644 --- a/CPP_Implementation/rbf_model.cpp +++ b/CPP_Implementation/rbf_model.cpp @@ -51,3 +51,15 @@ double RBFModel::gaussian(const double* input, const double* center) { } return exp(-0.5 * norm / (sigma * sigma)); } + +/** + * @brief Predict the RBF output for a given input. + */ +double RBFModel::predict(const double* input) { + double output = 0.0; + for (int i = 0; i < numCenters; ++i) { + output += weights[i] * gaussian(input, centers[i]); + } + return output; +} +