You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Holger Frey
c10ed0893b
|
2 years ago | |
---|---|---|
.gitignore | 2 years ago | |
LICENSE | 2 years ago | |
Makefile | 2 years ago | |
README.md | 2 years ago | |
linear_regression.py | 2 years ago | |
pytest.ini | 2 years ago | |
requirements.txt | 2 years ago | |
split_uniques.py | 2 years ago |
README.md
snippets
Misc code snippets I sometimes need and always have to look up how it works...
linear_regression.py
Calculate the linear regression on two columns of a data frame. The resulting
object has the function predict()
to calculate x or y values for a given
counterpart.
from linear_regression import linear_regression
df = pd.DataFrame({"temperature":[...], "signal":[...]})
regression = linear_regression(df, x="temperature", y="signal")
repr(regression) == "Regression(intercept=1, coefficient=3, score=0.9998)"
regression.predict(x=3) == 10
regression.predict(y=7) == 2