fast-algos / pIRLS

Fast IRLS code for solving p-norm regression problems
13 stars 1 forks source link

Issue in L1 Norm computation on MATLAB #1

Closed Ricbrag closed 4 years ago

Ricbrag commented 4 years ago

I made a simple regression with L1 norm on MATLAB. I expecting that Norm L1 to be more robust to outliers and produce a better fit than Norm L2. I got the same result of Norm L2 on the dataset I tested. That's not correct. Testing MATLAB code: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear all;close all;clc

% User provided norm and desired accuracy p=1; eps = 1e-8;

% Read datapoints table = readtable('xydata.dat'); data = table2array(table);

% Get number of datapoints m = size(data,1)

% Set the number of parameters n = 2

% Parameters for unconstrained optimization C = zeros(n,n); d = zeros(n,n);

% Assemble the Matrix A A=ones(m,2); A(:,2)=data(:,1);

% get the observable data b = data(:,2);

[res,it] = pNorm(eps,A,b,p,C,d) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Dataset: x,y 1.0,4.0 1.5,5.0 2.0,3.8 2.1,3.9 2.9,5.0 3.0,5.0 3.5,5.2 3.55,6.0 4.0,5.0 4.1,5.1 5.0,6.0 6.0,7.0 6.1,7.2 6.2,6.9 6.3,7.2 7.0,9.0 8.0,10.0 8.1,9.9 8.2,9.7 8.5,10.5 9.0,10.0 9.5,11.0 9.7,10.5 9.8,11.0 10.0,3.0

Best Regards, Ricardo de Bragança Ph.D. Student at University of Texas at Austin

deekshadotadil commented 4 years ago

Hi Ricardo, This algorithm is only guaranteed to work for p at least 2. This has been updated in the README now. Sorry for the confusion.

-Deeksha