<jupyter_start><jupyter_text>main model designed<jupyter_code>from numpy import mean
from sklearn.svm import SVC
from sklearn.model_selection import RepeatedStratifiedKFold
from sklearn.metrics import roc_curve, auc
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import cross_val_score
from numpy import std
from numpy import mean


# generate dataset
model = SVC(kernel='rbf', C=1000)
# evaluate the model
model.fit(train_features, train_labels)
# Compare Prediction 
print("Train acc: " , model.score(train_features, train_labels))
print("Test acc: ", model.score(X_test, Y_test))
from sklearn import metrics
from sklearn.metrics import roc_curve, auc
# Prediction
y_pred = np.around(model.predict(X_test))
print(metrics.classification_report(Y_test,y_pred, digits=8))
from sklearn.metrics import confusion_matrix
mat = confusion_matrix(Y_test, y_pred)
mat<jupyter_output><empty_output><jupyter_text>Optimization<jupyter_code>from sklearn.model_selection import GridSearchCV
from keras.wrappers.scikit_learn import KerasClassifier

# create model
model = SVC()
# define the grid search parameters
# Set the parameters by cross-validation
param_grid = [{"kernel": ["linear", 'rbf', 'poly'], "C": [1, 10, 100, 1000]},
 ]
cv = RepeatedStratifiedKFold(n_splits=10, n_repeats=3, random_state=1)
grid = GridSearchCV(estimator=model, param_grid=param_grid, n_jobs=1, cv=10)
grid_result = grid.fit(train_features, train_labels)
# summarize results
print("Best: %f using %s" % (grid_result.best_score_, grid_result.best_params_))
means = grid_result.cv_results_['mean_test_score']
stds = grid_result.cv_results_['std_test_score']
params = grid_result.cv_results_['params']
for mean, stdev, param in zip(means, stds, params):
	print("%f (%f) with: %r" % (mean, stdev, param))
from sklearn import metrics
from sklearn.metrics import roc_curve, auc
# Prediction
y_pred = np.around(grid_result.predict(X_test))
print(metrics.classification_report(Y_test,y_pred, digits=8))
# Compare Prediction 
print("Train acc: " , grid_result.score(train_features, train_labels))
print("Test acc: ", grid_result.score(X_test, Y_test))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10875576036866359, 'fraction_numerical': 0.010599078341013824, 'mean_word_length': 8.045833333333333, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '104467', 'license': 'MIT', 'n_tokens_mistral': 761, 'n_tokens_neox': 730, 'n_words': 173, 'path': 'SVMdiabetes-LMCH.ipynb', 'repo_name': 'chollette/DMPD_System', 'size': '2170'}