Skip to content

Instantly share code, notes, and snippets.

View aafaqin's full-sized avatar
:octocat:
probably weight training rn!

AAFAQ INAMDAR aafaqin

:octocat:
probably weight training rn!
View GitHub Profile
@aafaqin
aafaqin / ransac_polyfit.py
Created March 17, 2021 10:05 — forked from geohot/ransac_polyfit.py
RANSAC polyfit. Fit polynomials with RANSAC in Python
def ransac_polyfit(x, y, order=3, n=20, k=100, t=0.1, d=100, f=0.8):
# Thanks https://en.wikipedia.org/wiki/Random_sample_consensus
# n – minimum number of data points required to fit the model
# k – maximum number of iterations allowed in the algorithm
# t – threshold value to determine when a data point fits a model
# d – number of close data points required to assert that a model fits well to data
# f – fraction of close data points required
besterr = np.inf