Skip to main content

Package for fast regression

Project description

regressor

This is a small library that tries to run simple linear regression quickly on modern x86 hardware. This uses vectorized operations to speed up calculating dot products and means.

As a result, this is ~10X faster than scipy.stats.linregress, but only runs on x86-64 hardware with AVX extensions (most desktops and servers as of 2020).

Install

pip install regressor

Usage

>>> import numpy as np
>>> from regressor import linregress
>>> x = np.array([1.0, 2.0, 3.0, 4.0, 5.0], dtype=np.float32)
>>> y = np.array([5.0, 4.0, 3.0, 2.0, 1.0], dtype=np.float32)
>>> linregress(x, y)
LinregressResult(slope=-1.0, intercept=6.0, rvalue=-1.0, pvalue=1.2e-30, stderr=0.0)

Performance

The graph below compares the times required for simple linear regressions between this package and scipy.stats.linregress, starting from arrays with 100 elements up to arrays with 100 million elements. In general, this package performs simple linear regression in about 1/15th of the time required by scipy.stats.linregress.

Performance

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

regressor-1.0.0.tar.gz (60.3 kB view details)

Uploaded Source

File details

Details for the file regressor-1.0.0.tar.gz.

File metadata

  • Download URL: regressor-1.0.0.tar.gz
  • Upload date:
  • Size: 60.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0.post20200309 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.5

File hashes

Hashes for regressor-1.0.0.tar.gz
Algorithm Hash digest
SHA256 13e271fdbc573778516bca74e7816b8613329eea52201cfee9db5e9406abb274
MD5 4e4905ab14e8172520d6c264a2c36399
BLAKE2b-256 c64d32749a8e57dd4816c6dd7fcd26fbee8093d5f7854d9c48c7fb694e1913ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page