Skip to main content

Generate regression models from data

Reason this release was yanked:

Flaw with installation

Project description

Regressions Library

A collection of algorithms for fitting data to different functional models by using matrices. This library will be made publically available after it is uploaded to Python's database of libraries. It contains all the code for determining regression equations, as well as the code for evaluating said regressions and presenting their results in a raw format.

Contents

  1. File Structure
  2. Code Examples

File Structure

regressions_library  
|-- matrices  
|   |-- matrix.py  
|   |-- magnitude.py  
|   |-- dot_product.py  
|   |-- column.py  
|   |-- additions.py  
|   |-- scalar.py  
|   |-- multiplication.py  
|   |-- determinant.py  
|   |-- cofactors.py  
|   |-- minors.py  
|   |-- inverse.py  
|   |-- transpose.py  
|-- regressions  
|   |-- run_all.py  
|   |-- best.py  
|   |-- error.py  
|   |-- linear.py  
|   |-- quadratic.py  
|   |-- cubic.py  
|   |-- hyperbolic.py  
|   |-- exponential.py  
|   |-- logarithmic.py  
|   |-- logistic.py  
|   |-- sinusoidal.py  
|-- tests  
|   |-- matrices.py  
|   |-- regressions.py  
|-- READE.md  
|-- .gitignore  

Code Examples

Linear Regression

def linear(data):
    independent_matrix = []
    dependent_matrix = []
    for i in range(len(data)):
        independent_matrix.append([data[i][0], 1])
        dependent_matrix.append([data[i][1]])
    transposition = transpose(independent_matrix)
    product = multiplication(transposition, independent_matrix)
    product_matrix = matrix(product, dtype='float')
    inversion = inv(product_matrix)
    inversion_list = matrix.tolist(inversion)
    second_product = multiplication(inversion_list, transposition)
    solution = multiplication(second_product, dependent_matrix)
    equation = lambda x: solution[0][0]*x + solution[1][0]
    inaccuracy = error(data, equation)
    result = {
        'constants': solution,
        'error': inaccuracy
    }
    return result

Error Calculation

def error(data, equation):
    summation = 0
    for i in range(len(data)):
        summation += (data[i][1] - equation(data[i][0]))**2
    result = summation**(1/4)
    return result

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

regressions-1.0.tar.gz (2.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

regressions-1.0-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

regressions-1.0-py2-none-any.whl (2.2 kB view details)

Uploaded Python 2

File details

Details for the file regressions-1.0.tar.gz.

File metadata

  • Download URL: regressions-1.0.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for regressions-1.0.tar.gz
Algorithm Hash digest
SHA256 a556b964cc6aa94114d40960a22edc5b675fd27afe86b1f52097dab4282821e6
MD5 5fd914d99ef42cc947e91268af0fba55
BLAKE2b-256 95b7b0e1b6764af0e1b03301426af222fe51d6dab05172bf025f3551ecd1d48c

See more details on using hashes here.

File details

Details for the file regressions-1.0-py3-none-any.whl.

File metadata

  • Download URL: regressions-1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for regressions-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e7e1f40d4cec9ff9a2bd3c2f6a37c152e555cdfad33b5afe5d46f9347e0d2fd4
MD5 98918b01dfde0352accfa4c3f34f50ff
BLAKE2b-256 1ad555b40d68c189d97a34c077122d2703e0c9d217352b891111fdeb7f5b25cf

See more details on using hashes here.

File details

Details for the file regressions-1.0-py2-none-any.whl.

File metadata

  • Download URL: regressions-1.0-py2-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for regressions-1.0-py2-none-any.whl
Algorithm Hash digest
SHA256 78c86cc67fed64c98fa5f6b921a29d109864778fc3d1c9532d5f7fbed182daf7
MD5 8eb396c16fb2a6a497b96b634ebb46fd
BLAKE2b-256 914024f0046bf62ac6d6d2c6dd2e94c6ac797a0950b49af0bd16449accd13abf

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