pulsatrix
Loading...
Searching...
No Matches
weighted_linear_regression.hpp File Reference

Weighted least squares via normal equations – the shared fitting primitive Phase 3's LIME and KernelSHAP explainers both reduce to. More...

#include <cstddef>
#include <stdexcept>
#include <utility>
#include <vector>
#include "pulsatrix/assert.hpp"
#include "pulsatrix/linear_algebra.hpp"
Include dependency graph for weighted_linear_regression.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  pulsatrix
 

Functions

std::vector< float > pulsatrix::fit_weighted_linear_regression (const std::vector< std::vector< float > > &samples, const std::vector< float > &targets, const std::vector< float > &weights, float l2_lambda)
 Fits w* = argmin_w sum_i weight_i*(target_i - w^T sample_i)^2 + l2_lambda*||w||^2 via the normal equations (X^T W X + l2_lambda*I) w = X^T W y.
 

Detailed Description

Weighted least squares via normal equations – the shared fitting primitive Phase 3's LIME and KernelSHAP explainers both reduce to.