有约束条件的加权最小二乘的实现加权最小二乘原理Python实现
@[TOC] 有约束条件的加权最小二乘的实现加权最小二乘原理详细见网址:加权最小二乘法Python实现import numpy as npimport pandas as pdfrom scipy.optimize import minimizeclass Constrained_regression: def __init__(self, weight = None, intercept = True): """ 默认选择最小二乘