Created
October 30, 2015 05:23
-
-
Save maruware/6854972955ffdf384434 to your computer and use it in GitHub Desktop.
Enigma on GridSearchCV & requests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from sklearn.grid_search import GridSearchCV | |
from sklearn.linear_model import LogisticRegression | |
import requests | |
import numpy as np | |
import random | |
sample_num = 1400 | |
dimension = 100 | |
#Add request | |
requests.get('http://google.com') | |
X = [] | |
y = [] | |
for i in range(0, sample_num): | |
x = [] | |
for j in range(0, dimension): | |
x.append(random.random()) | |
X.append(x) | |
y.append(i%2) | |
print('start gscv') | |
tuned_parameters = [{'C': [10]}] | |
gscv = GridSearchCV(LogisticRegression(class_weight='auto'), tuned_parameters, cv=2, n_jobs=-1) | |
gscv.fit(X, y) | |
print('finished') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from sklearn.grid_search import GridSearchCV | |
from sklearn.linear_model import LogisticRegression | |
import requests | |
import numpy as np | |
import random | |
sample_num = 1400 | |
dimension = 100 | |
# requests.get('http://google.com') | |
X = [] | |
y = [] | |
for i in range(0, sample_num): | |
x = [] | |
for j in range(0, dimension): | |
x.append(random.random()) | |
X.append(x) | |
y.append(i%2) | |
print('start gscv') | |
tuned_parameters = [{'C': [10]}] | |
gscv = GridSearchCV(LogisticRegression(class_weight='auto'), tuned_parameters, cv=2, n_jobs=-1) | |
gscv.fit(X, y) | |
print('finished') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from sklearn.grid_search import GridSearchCV | |
from sklearn.linear_model import LogisticRegression | |
import requests | |
import numpy as np | |
import random | |
sample_num = 1300 # Decrease from 1400 | |
dimension = 100 | |
requests.get('http://google.com') | |
X = [] | |
y = [] | |
for i in range(0, sample_num): | |
x = [] | |
for j in range(0, dimension): | |
x.append(random.random()) | |
X.append(x) | |
y.append(i%2) | |
print('start gscv') | |
tuned_parameters = [{'C': [10]}] | |
gscv = GridSearchCV(LogisticRegression(class_weight='auto'), tuned_parameters, cv=2, n_jobs=-1) | |
gscv.fit(X, y) | |
print('finished') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from sklearn.grid_search import GridSearchCV | |
from sklearn.linear_model import LogisticRegression | |
import requests | |
import numpy as np | |
import random | |
sample_num = 1400 | |
dimension = 100 | |
requests.get('http://google.com') | |
X = [] | |
y = [] | |
for i in range(0, sample_num): | |
x = [] | |
for j in range(0, dimension): | |
x.append(random.random()) | |
X.append(x) | |
y.append(i%2) | |
print('start gscv') | |
tuned_parameters = [{'C': [10]}] | |
gscv = GridSearchCV(LogisticRegression(class_weight='auto'), tuned_parameters, cv=2) # Delete n_jobs | |
gscv.fit(X, y) | |
print('finished') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment