jbytecode / LinRegOutliers

Direct and robust methods for outlier detection in linear regression
MIT License
43 stars 6 forks source link

Singularity #20

Closed jbytecode closed 3 years ago

jbytecode commented 3 years ago

@tantei3 we have

ols(X::Array{Float64,2}, y::Array{Float64,1})::OLS = OLS(X, y, inv(X' * X) * X' * y)

in /src/ols.jl and the method inv throws error in the case of singularity. How about changing the method as

ols(X::Array{Float64,2}, y::Array{Float64,1}; inversefunction = inv)::OLS = OLS(X, y, inversefunction(X' * X) * X' * y)

so some methods can call it using pinv from package LinearAlgebra using

ols(X, y, inversefunction = pinv)

by this change, you can remove the try catch block in ransac method.