This file contains hidden or 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
summary(c[2]) | |
freq | |
Min. : 4.0 | |
1st Qu.: 521.0 | |
Median : 634.0 | |
Mean : 632.3 | |
3rd Qu.: 747.0 | |
Max. :1215.0 |
This file contains hidden or 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
aggregate(data$age, by=list(data$group), FUN=mean)[2] |
This file contains hidden or 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
df2 <- subset(df, article_id %in% names(tt[tt > 200])) |
This file contains hidden or 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
0.863635408019 | |
{'estimator__kernel': 'rbf', 'estimator__C': 8, 'estimator__gamma': 0.00048828125} |
This file contains hidden or 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
{'estimator__kernel': 'rbf', 'estimator__C': 8, 'estimator__degree': 3.0517578125e-05} |
This file contains hidden or 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
from sklearn.datasets import load_iris | |
from sklearn.multiclass import OneVsRestClassifier | |
from sklearn.svm import SVC | |
from sklearn.grid_search import GridSearchCV | |
from sklearn.metrics import f1_score | |
model_to_set = OneVsRestClassifier(SVC()) | |
parameters = { | |
"estimator__C": [2e-5, 2e-3, 2e-1, 2e1, 2e3, 2e5, 2e7, 2e9, 2e11, 2e13, 2e15], |
This file contains hidden or 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
mean = [] | |
for bid, loc in bid_loc.iteritems(): | |
try: | |
mean.append(np.mean(pid_ftr[loc],axis=0)) | |
except IndexError: | |
pass | |
np.save('mean_vector', mean) |
This file contains hidden or 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
bid_loc = defaultdict(list) | |
i = 0 | |
for key, value in bid_img.iteritems(): | |
for v in value: | |
bid_loc[key].append(idx[i]) | |
i += 1 |
This file contains hidden or 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
t = time.time() | |
idx = [] | |
for key, value in bid_img.iteritems(): | |
for v in value: | |
loc = -1 | |
for pid in pid_lst: | |
loc += 1 | |
if v == pid: | |
idx.append(loc) |
This file contains hidden or 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
i = 0 | |
for x in y_train: | |
i += 1 | |
if not x: | |
print i |