Linear Regression with sklearn – cheat sheet

# import and instantiate model from sklearn.linear_model import LinearRegression model = LinearRegression() #prepare test data features_train = df_train.loc[:, ‘feature_name’] target_train = df_train.loc[:, ‘target_name’] #fit (train) model and print coefficient and intercept model.fit(features_train , target_train ) print(model.coef_) print(model.intercept_) # calculate model quality from sklearn.metrics import mean_squared_error from sklearn.metrics import r2_score target_prediction = model.predict(features_train) print(mean_squared_error(target_train , target_prediction))…

pytest Tutorial – Part 1

At PyConDE Berlin 2019 Florian Bruhin gave a really nice session about testing with pytest, which I try to recap here. Writing Tests If You want to work with pytest you can install it via: pip install pytest When you know basic python unittest fixtures, good news ahead: pytest is compatible and will run your…

SQL-LIKE and wildcards

This article is part of my SQL-Tutorial Motivation Sometimes you need to retrieve data from a database without knowing the exact string to look up so wildcards for the rescue Underscore Se_en represents a pattern with a wildcard character. The _ means you can substitute any individual character here without breaking the pattern. It matches…

Software Testing Concepts

My Tale of Woe When I graduated from university and had my first job as a software engineer at Harman Becker Automotive Systems GmbH I should do the parental leave cover for a colleague. He showed me his project, gave me some info e.g. contact person and went off to Canada. Literally on the second…

Python Package parameterized

Stackoverflowing around I found this nice package https://github.com/wolever/parameterized Parameterized testing in Python sucks. parameterized fixes that. For everything. Parameterized testing for nose, parameterized testing for py.test, parameterized testing for unittest. Reading this description I had very high expectations 🙂 So let’s see if the package can hold up to it.

PyConDE Berlin 2019

I’ve always wanted to go to a conference and with PyConDE I’ve found one that suited me well: The price point of 300 bucks for 3 days of conference, 2 days of workshops and the opportunity to go to Berlin and visit my friend Thomas was fascinating!