### Install Python Implementation from Source Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Recommended method for contributors and users needing to run examples or modify the codebase. ```bash # 1. Clone the repository git clone https://github.com/your-repo/fastLPR.git cd fastLPR/fastLPR_py # 2. Create virtual environment (recommended) python -m venv .venv # 3. Activate virtual environment # On Linux/macOS: source .venv/bin/activate # On Windows PowerShell: .venv\Scripts\Activate.ps1 # On Windows CMD: .venv\Scripts\activate.bat # 4. Install in editable mode pip install -e . # 5. Verify installation python -c "from fastlpr import cv_fastlpr; print('fastLPR installed successfully!')" ``` -------------------------------- ### Setup fastLPR in R Source: https://github.com/rigelfalcon/fastlpr/blob/master/QUICKSTART.md Install required dependencies and source the setup script. ```r setwd("fastLPR_R") install.packages(c("Matrix", "fftw", "interp", "akima")) source("setup.R") ``` -------------------------------- ### MATLAB Installation and Setup Source: https://context7.com/rigelfalcon/fastlpr/llms.txt Installs and verifies the fastLPR library in MATLAB by running the setup function and checking the help documentation. ```matlab % MATLAB Installation cd fastLPR fastlpr_setup(); % Adds paths and verifies installation % Verify help fastLPR ver fastLPR ``` -------------------------------- ### Install fastLPR from Source Source: https://github.com/rigelfalcon/fastlpr/blob/master/replication/README.md Recommended installation method. Clones the repository, creates a virtual environment, and installs the package in editable mode. ```bash # Clone the repository (or unzip the submission archive) cd fastLPR_py # Create a virtual environment (recommended) uv venv # Install the package from source uv pip install -e . # Verify installation uv run python -c "from fastlpr import cv_fastlpr; print('fastLPR installed successfully')" ``` -------------------------------- ### Install matplotlib Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Install matplotlib dependency for running examples. ```bash pip install matplotlib>=3.7.0 ``` -------------------------------- ### Example Usage Commands Source: https://github.com/rigelfalcon/fastlpr/blob/master/fastLPR_py/README.md Commands to run various example scripts provided in the 'examples/' directory. Change to the 'examples' directory before execution. ```bash cd examples python example_fig2_fastkde.py # KDE (1D, 2D, 3D) python example_fig3_boundary_comparison.py # NW vs LL vs LQ python example_fig4_complex.py # Complex-valued regression python example_fig5_heteroscedasticity.py # Heteroscedastic regression python reproduce_all_figures.py # Run all examples ``` -------------------------------- ### Run Python Examples Source: https://github.com/rigelfalcon/fastlpr/blob/master/QUICKSTART.md Execute the provided example scripts. ```bash cd examples python example_fig2_fastkde.py ``` -------------------------------- ### Setup fastLPR in MATLAB Source: https://github.com/rigelfalcon/fastlpr/blob/master/QUICKSTART.md Initialize the environment by running the setup script. ```matlab cd fastLPR fastLPR_setup(); ``` -------------------------------- ### Run MATLAB Examples Source: https://github.com/rigelfalcon/fastlpr/blob/master/QUICKSTART.md Execute the provided example scripts. ```matlab cd example example_fig2_fastkde ``` -------------------------------- ### Install fastLPR in MATLAB Source: https://github.com/rigelfalcon/fastlpr/blob/master/README.md Navigate to the fastLPR directory and run the setup script for MATLAB installation. ```matlab cd fastLPR fastLPR_setup ``` -------------------------------- ### R Installation Source: https://context7.com/rigelfalcon/fastlpr/llms.txt Installs the fastLPR R package by sourcing the setup script or using R CMD INSTALL. Includes verification steps. ```r # R Installation setwd("fastLPR_R") source("setup.R") # Or install as package # R CMD INSTALL . # Verify library(fastlpr) ``` -------------------------------- ### Install fastLPR from source Source: https://github.com/rigelfalcon/fastlpr/blob/master/fastLPR_py/README.md Clone the repository and install the package in development mode using uv pip. Verify the installation by running a simple command. ```bash git clone https://github.com/rigelfalcon/fastLPR.git cd fastLPR/fastLPR_py uv pip install -e . uv run python -c "from fastlpr import cv_fastlpr, cv_fastkde; print('Installation successful!')" ``` -------------------------------- ### Source setup script Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Navigate to the project directory and source the setup script to load dependencies and functions. ```r # Navigate to fastLPR_R directory setwd("path/to/fastLPR_R") # Source setup script source("setup.R") ``` -------------------------------- ### Run R examples Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Execute provided example scripts from the examples directory. ```r # Navigate to examples directory setwd("examples") # Run basic examples source("example_kde_1d.R") source("example_regression_1d.R") ``` -------------------------------- ### Run R Examples Source: https://github.com/rigelfalcon/fastlpr/blob/master/QUICKSTART.md Execute the provided example scripts. ```r setwd("examples") source("example_kde_1d.R") ``` -------------------------------- ### Install fastlpr from source Source: https://github.com/rigelfalcon/fastlpr/blob/master/fastLPR_R/README.md Instructions for setting up the development environment or installing the package from the source directory. ```r # Clone repository and navigate to fastLPR_R setwd("path/to/fastLPR_R") # Option 1: Source setup script (for development) source("setup.R") # Option 2: Install as package (recommended) # From command line: # R CMD INSTALL . ``` -------------------------------- ### Install fastLPR in R Source: https://github.com/rigelfalcon/fastlpr/blob/master/README.md Source the setup.R script for R installation from source. Alternatively, install from CRAN after acceptance. ```r # From source setwd("fastLPR_R") source("setup.R") # After CRAN acceptance: # install.packages("fastlpr") ``` -------------------------------- ### Test fastLPR in Python Source: https://github.com/rigelfalcon/fastlpr/blob/master/QUICKSTART.md Verify installation by running a basic cross-validation example. ```python import numpy as np from fastlpr import cv_fastlpr, get_hlist x = np.random.rand(100, 1) y = x**2 + 0.1*np.random.randn(100, 1) hlist = get_hlist(10, [0.01, 1.0]) regs = cv_fastlpr(x, y, hlist, {'order': 1}) print(f"Selected bandwidth: {regs.bandwidth}") ``` -------------------------------- ### Setup FastLPR in WSL Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Instructions for setting up FastLPR within the Windows Subsystem for Linux (WSL), including navigating to the directory and installing the package in editable mode. ```bash wsl cd /mnt/c/path/to/fastLPR_py pip install -e . ``` -------------------------------- ### Run Python examples Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Execute Python example scripts from the correct directory. ```bash # Always run examples from the examples directory cd fastLPR_py/examples python example_fig2_fastkde.py ``` -------------------------------- ### Run Python Examples and Tests Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Commands to execute provided example scripts and the test suite. ```bash cd examples # Run individual examples python example_fig2_fastkde.py python example_fig3_boundary_comparison.py python example_fig4_complex.py python example_fig5_heteroscedasticity.py python example_fig6_applications.py # Or run all examples at once python reproduce_all_figures.py ``` ```bash cd tests pytest test_matlab_python_cross_validation.py -v ``` -------------------------------- ### Test fastLPR in R Source: https://github.com/rigelfalcon/fastlpr/blob/master/QUICKSTART.md Verify installation by running a basic cross-validation example. ```r x <- matrix(rnorm(200), ncol=1) hlist <- get_hlist(10, c(0.1, 1.0)) kde <- cv_fastkde(x, hlist) print(paste("Selected bandwidth:", kde$h_opt)) ``` -------------------------------- ### Benchmark Prerequisites Source: https://github.com/rigelfalcon/fastlpr/blob/master/benchmark/README.md Setup commands for MATLAB, Python, and R environments. ```matlab cd jss-code run('./setup.m') ``` ```bash cd fastLPR_py uv pip install -e . ``` ```r install.packages(c("R.matlab", "ks", "FKSUM", "locfit", "npregfast")) ``` -------------------------------- ### Test fastLPR in MATLAB Source: https://github.com/rigelfalcon/fastlpr/blob/master/QUICKSTART.md Verify installation by running a basic cross-validation example. ```matlab x = rand(500, 1); y = sin(2*pi*x) + 0.1*randn(500, 1); hlist = get_hList(20, [0.01, 1], @logspace); opt.order = 1; regs = cv_fastLPR(x, y, hlist, opt); fastLPR_plot(regs.fpp_yhat); ``` -------------------------------- ### Accessing FastLPR R Documentation and Examples Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Commands to navigate to the R directory and execute the provided KDE example script. ```bash cd examples && source("example_kde_1d.R") ``` -------------------------------- ### Setup MATLAB Path Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Initializes the toolbox by adding necessary directories to the MATLAB path. ```matlab % Navigate to fastLPR directory cd path/to/fastLPR % Run setup script (adds folders to path) fastLPR_setup(); ``` -------------------------------- ### Install Required R Packages Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Install all necessary packages for FastLPR in R, including 'Matrix', 'fftw', 'interp', and 'akima'. This is a prerequisite before sourcing the setup script. ```r # Install all required packages install.packages(c("Matrix", "fftw", "interp", "akima")) # Retry setup source("setup.R") ``` -------------------------------- ### Configure Persistent MATLAB Setup Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Adds the setup script to the user's startup.m file for automatic initialization. ```matlab % Edit MATLAB startup file edit(fullfile(userpath, 'startup.m')) % Add this line: run('path/to/fastLPR/fastLPR_setup.m'); ``` -------------------------------- ### 3D KDE Example Source: https://context7.com/rigelfalcon/fastlpr/llms.txt Example of performing 3D Kernel Density Estimation with memory efficiency flag. ```python import numpy as np from fastlpr import cv_fastlpr, get_hlist x_3d = np.random.randn(500, 3) hlist_3d = get_hlist([5, 5, 5], [[0.2, 1.0], [0.2, 1.0], [0.2, 1.0]]) opt = {'flag_power2': False} kde_3d = cv_fastlpr(x_3d, hlist_3d, opt) print(f"3D bandwidth: {kde_3d.bandwidth}") ``` -------------------------------- ### Run MATLAB Examples and Tests Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Commands to execute example scripts and the full test suite. ```matlab % Navigate to examples directory cd example % Run individual examples example_fig2_fastkde % 1D and 2D KDE example_fig3_boundary_comparison % NW vs LL vs LQ example_fig4_complex % Complex-valued data example_fig5_heteroscedasticity % Variance estimation example_fig6_applications % Real-world data % Or run all examples reproduce_all_figures % Generates all paper figures ``` ```matlab cd tests run_all % Runs all 12 tests ``` -------------------------------- ### Python Installation Source: https://context7.com/rigelfalcon/fastlpr/llms.txt Installs the fastLPR Python package using pip. Supports installation with development dependencies. ```bash # Python Installation cd fastLPR_py pip install -e . # With development dependencies pip install -e ".[dev]" # Verify python -c "from fastlpr import cv_fastlpr, cv_fastkde; print('OK')" ``` -------------------------------- ### Install Python via Git Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Direct installation method using pip and the repository URL. ```bash # Install directly from repository pip install -e "git+https://github.com/your-repo/fastLPR.git#egg=fastlpr&subdirectory=fastLPR_py" ``` -------------------------------- ### Run example figures Source: https://github.com/rigelfalcon/fastlpr/blob/master/fastLPR_R/README.md Execute individual example scripts included in the package to visualize results. ```R source(system.file("examples", "example_fig2_fastkde.R", package = "fastlpr")) ``` -------------------------------- ### Install fastLPR for Python Source: https://github.com/rigelfalcon/fastlpr/blob/master/QUICKSTART.md Commands to set up a virtual environment and install the package in editable mode. ```bash cd fastLPR_py python -m venv .venv source .venv/bin/activate # Windows: .venv\Scripts\activate pip install -e . ``` -------------------------------- ### Add FastLPR to MATLAB Path Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Navigate to the FastLPR directory and run the setup function to add the library to your MATLAB path. Verify the installation by checking the path of the 'cv_fastLPR' function. ```matlab % Navigate to fastLPR directory cd path/to/fastLPR % Run setup fastLPR_setup(); % Verify which cv_fastLPR % Should show path to function ``` -------------------------------- ### Windows Environment Setup Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Commands for setting up the environment on Windows using WSL or Anaconda. ```bash wsl --install wsl cd /mnt/c/path/to/fastLPR_py ``` ```bash conda activate myenv pip install -e . ``` -------------------------------- ### Install R and Build Tools on Linux Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Install R base and development packages on Linux using apt-get. Build tools are also installed, which may be required for compiling certain R packages from source. ```bash sudo apt-get install r-base r-base-dev sudo apt-get install build-essential ``` -------------------------------- ### Install fastLPR Toolbox Source: https://github.com/rigelfalcon/fastlpr/blob/master/fastLPR/README.md Methods for initializing the toolbox environment within MATLAB. ```matlab cd fastLPR fastlpr_setup(); ``` ```matlab cd fastLPR install_fastlpr(); % Prompts to save path ``` -------------------------------- ### Initialize fastLPR Environment in R Source: https://github.com/rigelfalcon/fastlpr/blob/master/fastLPR_R/inst/examples/README.md Sets the working directory and executes the setup and demo scripts. ```r # Navigate to working directory setwd("path/to/fastLPR_R") # Run setup script source("../verification/setup_fastLPR_pure.R") # Run basic demo source("demo_basic.R") ``` -------------------------------- ### Install fastLPR from PyPI Source: https://github.com/rigelfalcon/fastlpr/blob/master/replication/README.md Alternative installation method using pip, suitable when the package is published to PyPI. ```bash pip install fastlpr==1.0.0 ``` -------------------------------- ### Example Figures Source: https://github.com/rigelfalcon/fastlpr/blob/master/fastLPR_R/README.md Scripts to generate example figures for the fastlpr package. ```APIDOC ## Example Figures This section outlines the scripts used to generate various figures demonstrating the capabilities of the fastlpr package. ### Figure Generation Scripts | Figure | Description | Script | |---|---|---| | Fig 2 | KDE (1D/2D/3D) | `example_fig2_fastkde.R` | | Fig 3 | Boundary comparison (NW/LL/LQ) | `example_fig3_boundary_comparison.R` | | Fig 4 | Complex-valued regression | `example_fig4_complex.R` | | Fig 5 | Heteroscedastic variance | `example_fig5_heteroscedasticity.R` | | Fig 6 | Applications (qEEG/MRI) | `example_fig6_applications.R` | ### Running Individual Figures To run an individual figure script, you can use the following R command: ```r source(system.file("examples", "example_fig2_fastkde.R", package = "fastlpr")) ``` ``` -------------------------------- ### Verify Python package installation Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md List installed packages to confirm fastlpr is present. ```bash pip list | grep fastlpr ``` -------------------------------- ### Install fastLPR with development dependencies Source: https://github.com/rigelfalcon/fastlpr/blob/master/fastLPR_py/README.md Install the package with development dependencies, including testing and linting tools like pytest, black, and ruff. ```bash uv pip install -e ".[dev]" ``` -------------------------------- ### Install fastlpr in editable mode Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Install the Python package in editable mode from the source directory. ```bash cd fastLPR_py pip install -e . ``` -------------------------------- ### Install fastLPR in Python Source: https://github.com/rigelfalcon/fastlpr/blob/master/README.md Change directory to fastLPR_py and install the package using uv pip. ```bash cd fastLPR_py uv pip install -e . ``` -------------------------------- ### Verify Python Installation Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Run a minimal regression test to ensure the library is correctly configured. ```python import numpy as np from fastlpr import cv_fastlpr, get_hlist # Generate test data np.random.seed(42) x = np.random.rand(100, 1) y = x**2 + 0.1*np.random.randn(100, 1) # Run regression with bandwidth selection hlist = get_hlist(10, [0.01, 1.0]) opt = {'order': 1, 'dstd': 0} regs = cv_fastlpr(x, y, hlist, opt) print(f"✓ fastLPR is working! Selected bandwidth: {regs.bandwidth}") ``` -------------------------------- ### Install fastlpr dependencies Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Install required and suggested R packages from CRAN. ```r # Install required packages from CRAN install.packages(c("Matrix", "fftw", "interp", "akima")) # Optional: Install suggested packages install.packages(c("testthat", "roxygen2", "ggplot2")) ``` -------------------------------- ### Install Python using Homebrew on macOS Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md On macOS, it's recommended to use Homebrew to install Python, especially for Apple Silicon (M1/M2/M3) to ensure native ARM64 performance. This command installs Python 3.11. ```bash brew install python@3.11 ``` -------------------------------- ### Verify fastLPR Installation Source: https://github.com/rigelfalcon/fastlpr/blob/master/replication/README.md A simple Python command to verify if the fastLPR module has been installed correctly. ```python python -c "import fastlpr" ``` -------------------------------- ### Install Python with System Package Manager on Linux Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md On Linux, use the system's package manager (e.g., apt-get) to install Python 3 and pip. Virtual environments are recommended for managing project dependencies. ```bash sudo apt-get install python3-pip python3 -m venv .venv ``` -------------------------------- ### Install Python Development Dependencies Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Installs additional tools for testing and code quality, including pytest, black, and ruff. ```bash cd fastLPR/fastLPR_py pip install -e ".[dev]" ``` -------------------------------- ### Verify installation with 1D tests Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Run basic 1D KDE and regression tests to ensure the R environment is correctly configured. ```r # Test 1D KDE x <- matrix(rnorm(200), ncol=1) hlist <- get_hlist(10, c(0.1, 1.0)) kde <- cv_fastkde(x, hlist) print(paste("Selected bandwidth:", kde$h_opt)) # Test 1D regression (order 1) x <- matrix(runif(100), ncol=1) y <- sin(2*pi*x) + rnorm(100, sd=0.1) hlist <- get_hlist(10, c(0.01, 1.0)) opt <- list(order=1, N=100, dstd=0) regs <- cv_fastlpr(x, y, hlist, opt) print(paste("Selected bandwidth:", regs$h_opt)) ``` -------------------------------- ### Verify fastLPR Installation Source: https://github.com/rigelfalcon/fastlpr/blob/master/fastLPR/README.md Commands to check the toolbox help and version information. ```matlab help fastLPR ver fastLPR ``` -------------------------------- ### Install Optimized FFT Libraries Source: https://github.com/rigelfalcon/fastlpr/blob/master/fastLPR_py/README.md To potentially improve FFT performance, especially on Windows, install optimized libraries like MKL using conda. ```bash conda install numpy scipy mkl ``` -------------------------------- ### Verify R Installation Source: https://github.com/rigelfalcon/fastlpr/blob/master/fastLPR_R/inst/examples/README.md Commands to check R version and path configuration. ```r # Install R from: https://cran.r-project.org/ # Set path to: D:\Software\R\R-4.5.1\bin # Verify with: R --version ``` -------------------------------- ### Install dos2unix and Convert Line Endings Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Use this command to install the dos2unix utility and convert Python script line endings if the repository was cloned without proper Git autocrlf settings. ```bash pip install dos2unix dos2unix src/fastlpr/*.py ``` -------------------------------- ### Install R Packages Source: https://github.com/rigelfalcon/fastlpr/blob/master/fastLPR_R/inst/examples/README.md Installs required packages using a specific CRAN mirror to resolve dependency issues. ```r # Try alternative CRAN mirror: install.packages("Matrix", repos = "https://cloud.r-project.org") ``` -------------------------------- ### Install Test Dependencies and Run Cross-Language Verification Source: https://github.com/rigelfalcon/fastlpr/blob/master/replication/README.md Install pytest and pytest-cov using uv pip, then run the cross-language verification tests located in the tests/xl/ directory. This verifies numerical agreement with the MATLAB implementation. ```bash cd fastLPR_py # Install test dependencies uv pip install pytest pytest-cov # Run cross-language verification tests pytest tests/xl/ -v ``` -------------------------------- ### Manual Figure Reproduction (Individual Figures) Source: https://github.com/rigelfalcon/fastlpr/blob/master/replication/README.md Scripts to reproduce individual figures by running specific example files. Figures are saved to `fastLPR_py/fig/reproduced/`. ```python cd fastLPR_py/examples # Figure 2: Kernel Density Estimation (1D, 2D, 3D) python example_fig2_fastkde.py # Figure 3: Boundary Comparison (NW vs LL vs LQ) python example_fig3_boundary_comparison.py # Figure 4: Complex-Valued Regression python example_fig4_complex.py # Figure 5: Heteroscedastic Regression (1D and 2D) python example_fig5_heteroscedasticity.py # Figure 6: Real-World Applications (qEEG and MRI) python example_fig6_applications.py ``` -------------------------------- ### Install R on macOS Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Install R on macOS either from CRAN or using Homebrew. Ensure Xcode Command Line Tools are installed, as they are often required for R package installations. ```bash brew install r xcode-select --install ``` -------------------------------- ### Run KDE Competitor Benchmarks Source: https://github.com/rigelfalcon/fastlpr/blob/master/benchmark/README.md Execute benchmarks for KDE competitors ks and FKSUM in R. ```bash Rscript benchmark/scripts/r/benchmark_ks.R ``` ```bash Rscript benchmark/scripts/r/benchmark_fksum.R ``` -------------------------------- ### Execute Demos via Command Line Source: https://github.com/rigelfalcon/fastlpr/blob/master/fastLPR_R/inst/examples/README.md Runs all available demos sequentially using the Rscript utility. ```bash cd path/to/fastLPR_R Rscript run_all_demos.R ``` -------------------------------- ### Run Baseline Method Benchmark Source: https://github.com/rigelfalcon/fastlpr/blob/master/benchmark/README.md Execute the MATLAB direct method as a reference baseline for speedup calculations. ```bash matlab -batch "run('benchmark/scripts/matlab/benchmark_direct.m')" ``` -------------------------------- ### Enable Quick Test Mode for 3D KDE Source: https://github.com/rigelfalcon/fastlpr/blob/master/replication/README.md Sets an environment variable to enable quick test mode for 3D KDE, reducing computation time by using a smaller sample size. Useful for faster testing or when encountering performance issues. ```bash export FASTLPR_QUICK_TEST=1 ``` -------------------------------- ### Execute R Benchmarks Source: https://github.com/rigelfalcon/fastlpr/blob/master/fastLPR/example/README_BENCHMARKS.md Commands to run the R-based KDE comparison benchmark. ```r # In R (from repository root) setwd("fastLPR_R/examples") source("benchmark_tab4_kde_comparison.R") # Table 4 ``` -------------------------------- ### Directory Structure Source: https://github.com/rigelfalcon/fastlpr/blob/master/benchmark/README.md Overview of the benchmark repository layout. ```text benchmark/ ├── scripts/ # Benchmark scripts │ ├── run_all_benchmarks.py # ★ UNIFIED RUNNER (recommended) │ ├── matlab/ # MATLAB: benchmark_fastlpr.m, benchmark_direct.m │ ├── python/ # Python: benchmark_fastlpr.py │ ├── cpp/ # C++: benchmark_stopt.py, stopt_wrapper.py │ ├── r/ # R: benchmark_fastlpr.R, benchmark_ks.R, benchmark_fksum.R, │ │ # benchmark_locfit.R, benchmark_npregfast.R │ ├── plotting/ # Figure generation │ │ └── plot_fig7_benchmark.py # JSS Figure 7 (3x3 grid: speed/memory/accuracy) │ └── memory_monitor.py # Signal-based USS/RSS delta monitoring ├── data/ # Results output │ ├── benchmark_results.csv # ★ Main output │ └── ground_truth/ # Ground truth .mat files (from benchmark_direct.m) └── README.md # This file ``` -------------------------------- ### Python: Options Dictionary Source: https://context7.com/rigelfalcon/fastlpr/llms.txt Configure fastLPR settings in Python using a dictionary. Options include polynomial order, kernel type, output, bandwidth multiplier, DOF calculation, and performance flags. ```python opt = { 'order': 1, # Polynomial order 'kernel_type': 'gaussian', 'y_type_out': 'mean', # 'mean' or 'variance' 'dstd': 1, # 1-SE rule multiplier 'calc_dof': True, 'verbose': False, 'flag_power2': True, # Use power-of-2 grid (set False for 3D) } ``` -------------------------------- ### Execute Unified Benchmarks Source: https://github.com/rigelfalcon/fastlpr/blob/master/benchmark/README.md Commands to run the unified benchmark suite with various configurations. ```bash # Quick test (N_RUNS=1, for testing) uv run python benchmark/scripts/run_all_benchmarks.py --quick --methods fastlpr # Full benchmark (N_RUNS=3, for publication) uv run python benchmark/scripts/run_all_benchmarks.py --methods all # All methods, quick mode uv run python benchmark/scripts/run_all_benchmarks.py --quick --methods all # Specific methods uv run python benchmark/scripts/run_all_benchmarks.py --methods fastlpr ks stopt # Specific dimensions uv run python benchmark/scripts/run_all_benchmarks.py --methods fastlpr --dims 1 2 ``` -------------------------------- ### Install Dependencies Source: https://github.com/rigelfalcon/fastlpr/blob/master/replication/README.md Installs required Python package dependencies using uv pip. Ensures numpy, scipy, and matplotlib meet the specified version requirements. ```bash uv pip install -e . ``` -------------------------------- ### Run LPR Competitor Benchmarks Source: https://github.com/rigelfalcon/fastlpr/blob/master/benchmark/README.md Execute benchmarks for LPR competitors locfit, npregfast, and StOpt-NW. ```bash Rscript benchmark/scripts/r/benchmark_locfit.R ``` ```bash Rscript benchmark/scripts/r/benchmark_npregfast.R ``` ```bash uv run python benchmark/scripts/cpp/benchmark_stopt.py ``` -------------------------------- ### Verify MATLAB Installation Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Checks function accessibility and runs a basic regression test. ```matlab % Check that main functions are accessible help cv_fastLPR help cv_fastKDE help fastLPR_predict % Run a simple test x = rand(500, 1); y = sin(2*pi*x) + 0.1*randn(500, 1); hlist = get_hList(20, [0.01, 1], @logspace); opt.order = 1; regs = cv_fastLPR(x, y, hlist, opt); fastLPR_plot(regs.fpp_yhat); ``` -------------------------------- ### Configure API options Source: https://github.com/rigelfalcon/fastlpr/blob/master/fastLPR_R/README.md Define the configuration list for regression and density estimation parameters. ```R opt <- list( order = 1, # Polynomial order: 0, 1, or 2 kernel_type = "gaussian", # Kernel: "gaussian" or "epanechnikov" N = 100, # Grid size per dimension accuracy = 6, # NUFFT accuracy (1-12) calc_dof = TRUE, # Compute DOF for GCV dstd = 0 # Std devs for 1-SE rule (0 = minimum GCV) ) ``` -------------------------------- ### Enable Quick Test Mode on Windows Source: https://github.com/rigelfalcon/fastlpr/blob/master/replication/README.md Set the FASTLPR_QUICK_TEST environment variable to 1 to enable faster testing with reduced sample sizes and grid resolution. This mode is intended for development and testing only. ```cmd set FASTLPR_QUICK_TEST=1 python examples\reproduce_all_figures.py ``` -------------------------------- ### Perform 1D Kernel Density Estimation Source: https://github.com/rigelfalcon/fastlpr/blob/master/fastLPR/README.md Example of estimating density for bimodal data using fastKDE. ```matlab % Generate bimodal data x = [randn(100,1)-2; randn(100,1)+2]; % Fast KDE with automatic bandwidth selection hlist = get_hList(20, [0.01, 1], @logspace); kde = cv_fastKDE(x, hlist); % Visualize fastKDE_plot(kde); ``` -------------------------------- ### Perform 1D Local Linear Regression Source: https://github.com/rigelfalcon/fastlpr/blob/master/fastLPR/README.md Example of generating test data and performing regression with automatic bandwidth selection. ```matlab % Generate test data x = rand(500, 1); y = sin(2*pi*x) + 0.1*randn(500, 1); % Fast regression with automatic bandwidth selection hlist = get_hList(20, [0.01, 1], @logspace); opt.order = 1; % Local linear regs = cv_fastLPR(x, y, hlist, opt); % Visualize fastLPR_plot(regs.fpp_yhat); ``` -------------------------------- ### Python Docker Configuration Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Dockerfile and build commands for a reproducible Python environment. ```dockerfile FROM python:3.11-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ git \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies COPY fastLPR_py/pyproject.toml /app/ RUN pip install --no-cache-dir numpy>=1.23 scipy>=1.10 matplotlib>=3.7 # Copy fastLPR code COPY fastLPR_py /app/fastLPR_py # Install fastLPR RUN cd fastLPR_py && pip install -e . # Set working directory to examples WORKDIR /app/fastLPR_py/examples CMD ["python", "example_fig2_fastkde.py"] ``` ```bash docker build -t fastlpr-python . docker run -v $(pwd)/fig:/app/fig fastlpr-python ``` -------------------------------- ### Enable Quick Test Mode on Linux/macOS Source: https://github.com/rigelfalcon/fastlpr/blob/master/replication/README.md Set the FASTLPR_QUICK_TEST environment variable to 1 to enable faster testing with reduced sample sizes and grid resolution. This mode is intended for development and testing only. ```bash export FASTLPR_QUICK_TEST=1 python examples/reproduce_all_figures.py ``` -------------------------------- ### Check Python Architecture on macOS Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Verify the architecture of your Python installation on macOS. For Apple Silicon (M1/M2/M3), the output should be 'arm64' for optimal performance. ```python import platform; print(platform.machine()) ``` -------------------------------- ### Reinstall FFTW Package in R Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md If the 'fftw' package is not available in R, try reinstalling it from source or using an alternative CRAN mirror. This is often necessary if the initial installation failed. ```r # Reinstall fftw install.packages("fftw", type="source") # Or use alternative CRAN mirror install.packages("fftw", repos="https://cloud.r-project.org") ``` -------------------------------- ### Run test suite Source: https://github.com/rigelfalcon/fastlpr/blob/master/fastLPR_R/README.md Execute the package test suite using testthat or devtools. ```R # Using testthat setwd("fastLPR_R") testthat::test_dir("tests/testthat") # Or via devtools devtools::test() ``` -------------------------------- ### Use Fewer Bandwidth Candidates Source: https://github.com/rigelfalcon/fastlpr/blob/master/INSTALL.md Reduce the number of bandwidth candidates in the 'hlist' to conserve memory when processing large datasets in MATLAB. This example uses 10 candidates instead of the default 20. ```matlab hlist = get_hList(10, [0.01, 1], @logspace); % Instead of 20 ``` -------------------------------- ### MATLAB: Complete Options Reference Source: https://context7.com/rigelfalcon/fastlpr/llms.txt Configure fastLPR settings in MATLAB. Options control polynomial order, kernel type, output, bandwidth selection, grid resolution, DOF calculation, and performance. ```matlab opt = struct(); % Polynomial order (required for regression) opt.order = 1; % 0=Nadaraya-Watson, 1=local linear, 2=local quadratic % Kernel function opt.kernel_type = 'gaussian'; % 'gaussian' (default) or 'epanechnikov' % Output type opt.y_type_out = 'mean'; % 'mean' (default) or 'variance' % Bandwidth selection opt.dstd = 0; % 0=minimum GCV, 1+=1-SE rule (more conservative) % Grid settings opt.N = 100; % Grid resolution per dimension opt.xrange = [0, 1]; % Evaluation range (default: data range) % DOF estimation opt.calc_dof = true; % Compute degrees of freedom (needed for GCV) % Performance opt.verbose = false; % Print progress messages opt.accuracy = 6; % NUFFT accuracy (1-12, higher=more accurate but slower) ``` -------------------------------- ### Run MATLAB Benchmarks Source: https://github.com/rigelfalcon/fastlpr/blob/master/benchmark/README.md Command to execute individual MATLAB benchmark scripts. ```bash # MATLAB matlab -batch "run('benchmark/scripts/matlab/benchmark_fastlpr.m')" ``` -------------------------------- ### Run Pytest Suite Source: https://github.com/rigelfalcon/fastlpr/blob/master/fastLPR_py/README.md Execute the test suite using pytest. Navigate to the project root directory first. ```bash cd fastLPR_py # Run pytest test suite pytest tests/ -v --tb=short ``` -------------------------------- ### Generate Benchmark Figures Source: https://github.com/rigelfalcon/fastlpr/blob/master/benchmark/README.md Run the plotting script to generate figures from benchmark results. ```bash uv run python benchmark/scripts/plotting/plot_fig7_benchmark.py ```