<jupyter_start><jupyter_text>Load Data<jupyter_code>data = load_iris()
# Convert To DataFrame
iris = pd.DataFrame(data.data, columns=data.feature_names)
iris['target'] = data.target
iris.head()
iris.describe()<jupyter_output><empty_output><jupyter_text>Create Model<jupyter_code>svc = SVC()<jupyter_output><empty_output><jupyter_text>Data => Train and Test<jupyter_code>from sklearn.model_selection import train_test_split
X = iris[['sepal length (cm)', 'sepal width (cm)', 'petal length (cm)',
       'petal width (cm)']]
y = iris.target
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42, test_size=0.3)<jupyter_output><empty_output><jupyter_text>Set parameter for SVM gamma =  [0.1, 0.01, 0.001, 0.0001] C           =  [ 1, 10, 100, 1000 ] kernel = Linear<jupyter_code>param_grid = {'C':(1, 10, 100, 1000), 'gamma':(0.1, 0.01, 0.001, 0.0001)}
param_grid
grid_search = GridSearchCV(svc, param_grid, cv=10, verbose=10)
grid_search.fit(X_train, y_train)
grid_search.best_params_
svc = SVC(C=10, gamma=0.1).fit(X_train, y_train)
svc.score(X_test, y_test)
y_pred = svc.predict(X_test)
print("Confusion Matrix: ")
print(confusion_matrix(y_test, y_pred))
print()
print("Classifiction Report :")
print(classification_report(y_test, y_pred))<jupyter_output>Confusion Matrix: 
[[19  0  0]
 [ 0 13  0]
 [ 0  0 13]]

Classifiction Report :
              precision    recall  f1-score   support

           0       1.00      1.00      1.00        19
           1       1.00      1.00      1.00        13
           2       1.00      1.00      1.00        13

    accuracy                           1.00        45
   macro avg       1.00      1.00      1.00        45
weighted avg       1.00      1.00      1.00        45
{'fraction_non_alphanumeric': 0.12810155799192152, 'fraction_numerical': 0.07847663012117714, 'mean_word_length': 2.949886104783599, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '266804', 'license': 'Apache-2.0', 'n_tokens_mistral': 741, 'n_tokens_neox': 661, 'n_words': 139, 'path': 'machine_learning/16_SVM_ris.ipynb', 'repo_name': 'Aliktk/Python_Chilla', 'size': '1733'}