Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import time
- import warnings
- import numpy as np
- import matplotlib.pyplot as plt
- from sklearn import cluster, datasets, mixture
- from sklearn.neighbors import kneighbors_graph
- from sklearn.preprocessing import StandardScaler
- from itertools import cycle, islice
- from sklearn.metrics import fbeta_score, make_scorer
- n_samples = 1500
- X, y = datasets.make_circles(n_samples=n_samples, factor=.5,
- noise=.05)
- import numpy as np
- from sklearn.linear_model import Ridge
- from sklearn.grid_search import GridSearchCV
- # prepare a range of alpha values to test
- alphas = np.array([10, 1, 0.1, 0.01, 0.001, 0.0001, 0])
- # create and fit a ridge regression model, testing each alpha
- model = Ridge()
- ftwo_scorer = make_scorer(fbeta_score, beta=2)
- grid = GridSearchCV(estimator=model, param_grid=dict(alpha=alphas), scoring=Ridge.score)
- grid.fit(X, y)
- print(grid)
- print("asdasdasdsada")
- # summarize the results of the grid search
- print(grid.best_score_)
- print(grid.best_estimator_.alpha)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement