Skip to content

Instantly share code, notes, and snippets.

@ebakan
ebakan / Rakefile
Created December 21, 2016 14:44 — forked from schickling/Rakefile
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@ebakan
ebakan / ridge_bias_variance.py
Created May 24, 2019 23:30 — forked from oliverangelil/ridge_bias_variance.py
generate dummy data and apply ridge with varying levels of regularisation. Plots train and test results. This code goes with my blog post: http://snoek.ddns.net/~oliver/mysite/the-bias-variance-tradeoff.html
from sklearn.datasets import make_regression
from sklearn.model_selection import train_test_split
from sklearn.linear_model import Ridge
from sklearn.metrics import mean_squared_error
import numpy as np
import matplotlib.pyplot as plt
# generate data
X, y, w = make_regression(n_samples=1000, n_features=200, coef=True,
random_state=1, bias=0, noise=3, tail_strength=0.9, effective_rank=10)