python regression code (in progress)