Last active
July 4, 2017 19:52
-
-
Save shgidi/0051327b6bc3244133b9be6d544a5242 to your computer and use it in GitHub Desktop.
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
from keras.applications.resnet50 import ResNet50 | |
from scipy.misc import imresize | |
resnet=ResNet50() | |
imgs_new=[] | |
for i,img in enumerate(imgs_new_rand): | |
imgs_new[i]=imresize(img,(224,224,3)) | |
resnet_preds=resnet.predict(imgs_new) | |
from sklearn.model_selection import train_test_split | |
train_idx,val_idx=train_test_split(range(len(resnet_preds)),test_size=0.2) | |
trn,val=resnet_preds[train_idx],resnet_preds[val_idx] | |
y,y_val=tags_encoded[train_idx],tags_encoded[val_idx] | |
import xgboost as xgb | |
clf = xgb.XGBClassifier(max_depth=10, n_estimators=1000,min_child_weight=9,learning_rate=0.01, | |
nthread=8, subsample=0.80,colsample_bytree=0.80,seed=4242) | |
clf.fit(trn , y,eval_set=[(val, y_val)], eval_metric='mlogloss', verbose=True, early_stopping_rounds=50) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment