-
-
Notifications
You must be signed in to change notification settings - Fork 342
Add Gaussian Process Regression #235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds a Gaussian Process (GP) regression example using kernlab, alongside new k-NN, CNN, and Kadane’s algorithm scripts. Key changes:
- Introduces a GP regression script with rbfdot kernel and plotting.
- Adds a from-scratch k-NN implementation with classification/regression and examples.
- Adds Kadane’s algorithm and a simple CNN architecture example.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| machine_learning/guassian_process.r | New GP regression script using kernlab with example and plotting |
| machine_learning/k-NN.r | New k-NN implementation (classification/regression) with normalization and examples |
| machine_learning/cnn.r | CNN architecture definition using keras; prints model summary |
| dynamic_programming/kadane's_algo.r | Kadane’s algorithm with examples and a circular variant |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
|
Please resolve conflicts |
| @@ -0,0 +1,162 @@ | |||
| # Kadane's Algorithm in R | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This algorithm is already implemented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| @@ -0,0 +1,87 @@ | |||
| # ============================================== | |||
Copilot
AI
Oct 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filename contains typo: 'guassian_process.r' should be 'gaussian_process.r' (missing 'i' in Gaussian).
| @@ -0,0 +1,87 @@ | |||
| # ============================================== | |||
Copilot
AI
Oct 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File extension must be lowercase '.r'. The filename 'guassian_process.r' uses lowercase extension, which is correct, but the filename itself contains a spelling error ('guassian' instead of 'gaussian'). Please rename to 'gaussian_process.r'.
Overview
This implementation defines a Gaussian Process (GP) regression model in R using the kernlab package. GP is a non-parametric Bayesian regression algorithm that predicts continuous outputs while providing uncertainty estimates. It models a prior over functions via a kernel and updates the posterior distribution using observed data.
Features
Performs regression with uncertainty quantification for predictions.
Supports small datasets effectively and works well with sparse data.
Uses a kernel function (e.g., RBF) to define similarity between data points.
Provides mean and variance (confidence) for each prediction.
Handles non-linear relationships automatically through the kernel.
Demonstrates predictions on synthetic or real regression datasets.
Plotting functionality included for visualizing predictions against observations.
Complexity
Time Complexity: O(n³) due to kernel matrix inversion
Space Complexity: O(n²) for storing the kernel matrix
Demonstration
The included R script trains a GP model on a synthetic sine-wave dataset with noise.
Predictions are made on test inputs, including plotting mean predictions.
Replace x and y with other datasets for custom regression tasks.
For large datasets, consider sparse GP approximations.