before rewriting linear fitting methodwq
rewrote linear fitting method for weight sum