regpy

Link to Git repository.

regpy is a python library meant to make the prototyping process for fitting regression data as painless as possible. You can plot any regression line in as little as four lines of Python.


import regpy.linreg as lrp
linReg = lrp.LinearRegression([1, 2, 3], [1, 2, 3])
lrp.plotLinReg(linReg)
lrp.drawPlots()
view raw firstreg.py hosted with ❤ by GitHub

This will plot this graph (regpy uses matplotlib in the background):



The minimal effort of using this library means it is a perfect choice for rapid development over small datasets, or even for use in educational settings. Plotting multiple graphs is also possible, and neat formatting is handled entirely for you. The following script:


from random import uniform
import regpy.linreg as lrp
# 4 randomly generated regressions
for i in range(4):
x = []
y = []
rand_range = uniform(-5, 5)
rand_scale = uniform(-1, 1)
# 20 points per regression
for i in range(20):
x.append(i + rand_range)
rand_noise = uniform(-1 * rand_range, rand_range)
y.append((i * rand_scale) + rand_noise)
# Create the regression
linReg = lrp.LinearRegression(x, y)
# Queue each regression to be plotted
lrp.plotLinReg(linReg, scatter=True)
lrp.drawPlots()
view raw fourreg.py hosted with ❤ by GitHub

May produce the following graphs:



This library currently only supports creating linear regressions, but it is a WIP, and in the future may be expanded to encompass multiple types of regression.

Read the docs.
Contact Me