|
@@ -65,26 +65,19 @@ def ensemble_model_v2(X_train, y_train):
|
|
|
|
|
|
def rfe_svm_model(X_train, y_train, n_components=1):
|
|
|
|
|
|
- Cs = [0.001, 0.01, 0.1, 1, 10, 100, 1000]
|
|
|
- gammas = [0.001, 0.01, 0.1, 1, 5, 10, 100]
|
|
|
- param_grid = [{'estimator__C': Cs, 'estimator__gamma' : gammas}]
|
|
|
+ # Cs = [0.001, 0.01, 0.1, 1, 10, 100, 1000]
|
|
|
+ # gammas = [0.001, 0.01, 0.1, 1, 5, 10, 100]
|
|
|
+ # param_grid = [{'estimator__C': Cs, 'estimator__gamma' : gammas}]
|
|
|
+
|
|
|
+ gammas = [0.001, 0.01, 0.1]
|
|
|
+ param_grid = [{'estimator__gamma' : gammas}]
|
|
|
|
|
|
estimator = svm.SVC(kernel="linear")
|
|
|
selector = RFECV(estimator, step=1, cv=4, verbose=0)
|
|
|
clf = GridSearchCV(selector, param_grid, cv=5, verbose=1)
|
|
|
clf.fit(X_train, y_train)
|
|
|
|
|
|
- print(clf.best_estimator_)
|
|
|
- print('------------------------------')
|
|
|
- print(clf.best_estimator_.n_features_)
|
|
|
- print('------------------------------')
|
|
|
- print(clf.best_estimator_.ranking_)
|
|
|
- print('------------------------------')
|
|
|
- print(clf.best_estimator_.support_)
|
|
|
- print('------------------------------')
|
|
|
- print(clf.best_estimator_.grid_scores_)
|
|
|
-
|
|
|
- return clf.best_estimator_.estimator_
|
|
|
+ return (clf.best_estimator_, clf.best_estimator_.support_)
|
|
|
|
|
|
|
|
|
def get_trained_model(choice, X_train, y_train):
|