28.04.2020 Views

Sách Deep Learning cơ bản

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

152 Chương 11. Transfer learning và data augmentation

# Chia traing set, test set tỉ lệ 80-20

X_train, X_test, y_train, y_test = train_test_split(features, labels, test_size=0.2, rando

# Grid search để tìm các parameter tốt nhất cho model. C = 1/lamda, hệ số trong regularisa

# https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegressio

params = {'C' : [0.1, 1.0, 10.0, 100.0]}

#model = GridSearchCV(LogisticRegression(solver='lbfgs', multi_class='multinomial'), param

model = GridSearchCV(LogisticRegression(), params)

model.fit(X_train, y_train)

print('Best parameter for the model {}'.format(model.best_params_))

# Đánh giá model

preds = model.predict(X_test)

print(classification_report(y_test, preds))

11.1.2 Fine tuning

Ta chỉ giữ lại phần ConvNet trong CNN và bỏ đi FCs. Sau đó thêm các Fully Connected layer mới

vào output của ConvNet.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!