Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

FitBasis

Open In Colab

Overview

FitBasis performs least-squares regression to fit a basis function to sample data. It builds a factor graph from samples and solves for basis parameters that best explain the data under a Gaussian noise model.

Key Functionality / API

  • FitBasis(sequence, model, N) constructs and solves the least-squares problem.

  • parameters() returns the fitted parameter vector.

  • NonlinearGraph(...) and LinearGraph(...) expose intermediate graphs.

C++ Usage Example

std::map<double, double> samples = {{0.0, 1.0}, {0.5, 0.2}, {1.0, -0.1}};
auto model = gtsam::noiseModel::Isotropic::Sigma(1, 0.1);
size_t N = 5;
gtsam::FitBasis<gtsam::Chebyshev2> fit(samples, model, N);
gtsam::Vector params = fit.parameters();

Python Example

FitBasisFourierBasis parameters: [ 2.242 -1.242 -1.986]