# http://blog.datadive.net/selecting-good-features-part-iv-stability-selection-rfe-and-everything-side-by-side/
from sklearn.linear_model import RandomizedLasso
from sklearn.datasets import load_boston

boston = load_boston()

# using the Boston housing data
# Data gets scaled automatically by sklearn's implementation
X = boston["data"]
Y = boston["target"]
names = boston["feature_names"]
print(names)

rlasso = RandomizedLasso(alpha=0.025)
rlasso.fit(X, Y)

print("Features sorted by their score: ")
print(sorted(zip(map(lambda x: round(x, 4), rlasso.scores_), names), reverse=True))
