Skip to content

Instantly share code, notes, and snippets.

🍀

Philipp Gayret SkPhilipp

🍀
Block or report user

Report or block SkPhilipp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View docker-clean.sh
#!/bin/bash
docker ps -a -q | xargs docker kill
docker ps -a -q | xargs docker rm
docker network prune -f
docker system prune -f
docker volume prune -f
@SkPhilipp
SkPhilipp / polynomial-regression-predict.py
Created Apr 29, 2017
polynomial-regression-predict.py
View polynomial-regression-predict.py
# returns array([[ 154.98253014],
# [ 249.58103463]])
model.predict([[28], [30]])
@SkPhilipp
SkPhilipp / polynomial-regression.py
Last active Nov 13, 2017
polynomial-regression.py
View polynomial-regression.py
from sklearn.linear_model import Ridge
from sklearn.preprocessing import PolynomialFeatures
from sklearn.pipeline import make_pipeline
for n in [2, 5]:
# Create a model which includes a polynomial to the N-th degree
model = make_pipeline(PolynomialFeatures(n), Ridge())
# Train the model using the rolls and prices defined before
model.fit(rolls[:, np.newaxis], prices)
# Plot out what the model predicts
@SkPhilipp
SkPhilipp / linear-regression-predict.py
Created Apr 29, 2017
linear-regression-predict.py
View linear-regression-predict.py
# returns array([[ 175.61018994],
# [ 195.60932458]])
model.predict([[28], [30]])
View linear-regression-plot.py
from matplotlib import pyplot
import numpy as np
from sklearn import linear_model
# Taste of Hate rolls, from highest roll to lowest. First 99 entries.
rolls = np.array([30,30,30,30,30,30,30,29,29,29,29,29,29,29,29,29,29,28,28,28,28,28,28,28,28,28,28,28,27,27,27,27,27,27,26,26,26,26,26,26,25,25,25,25,25,24,24,24,24,24,24,24,24,24,23,23,23,23,23,23,23,23,23,23,23,23,23,23,22,22,22,22,22,22,21,21,21,20,20,20])
prices = np.array([233,186,200,372,233,233,372,150,150,214,165,170,150,200,145,155,200,186,165,186,186,186,145,140,140,232.5,110,135,140,139,139,139.5,139.5,140,150,115,186,120,110,140,110,120,125,130,115,279,116,110,110,120,140,120,115,110,120,186,114,104,186,110,110,105,93,114,115,130,145,120,130,186,99,112,110,110,135,186,118,110,110,115])
# Plot out all the rolls, prices and our prediction
pyplot.scatter(rolls, prices)
View linear-regression.py
from sklearn import linear_model
# Create train a linear regression model
model = linear_model.LinearRegression()
model.fit(rolls[:, np.newaxis], prices)
# Plot out all the rolls, prices
pyplot.scatter(rolls, prices)
pyplot.xlabel('roll')
pyplot.ylabel('price')
@SkPhilipp
SkPhilipp / install.sh
Last active Nov 13, 2017
My configuration for a hosted Jupyter Notebook
View install.sh
apt -y install python-pip
pip install jupyterlab
useradd -m jupyterhost
su - jupyterhost
mkdir notebooks
cat > .jupyter/jupyter_notebook_config.py << EOF
c.NotebookApp.open_browser = False
c.NotebookApp.token = ''
# Format "<hash method>:<salt>:<hash>", with salt appeneded to password. The example represents password "memes".
c.NotebookApp.password = u'sha1:faeeb4164638:80b264dcc5d723961c5f77a5b7efa20544116c0b'
You can’t perform that action at this time.