<jupyter_start><jupyter_text>We will be working with a dataset containing 150 entries. **Importing Dataset**<jupyter_code>dt = pd.read_csv('iris_csv-210120-132620.csv')
# Snapshot of dataset

dt.head()<jupyter_output><empty_output><jupyter_text>**Visualize and analyze the data set**<jupyter_code>print('Number of rows:', len(dt['class']))
print('Columns in the dataset:')
for col in dt.columns:
    print(col)
print(dt.groupby('class').size())
plt.figure(figsize = (15, 10))
plt.subplot(2, 2, 1)
sns.boxplot(x = 'class', y = 'sepallength', data = dt)
plt.subplot(2, 2, 2)
sns.boxplot(x = 'class', y = 'sepalwidth', data = dt)
plt.subplot(2, 2, 3)
sns.boxplot(x = 'class', y = 'petallength', data = dt)
plt.subplot(2, 2, 4)
sns.boxplot(x = 'class', y = 'petalwidth', data = dt)<jupyter_output><empty_output><jupyter_text>**Data Cleaning**<jupyter_code>dt.isnull().values.any()
dt.info()<jupyter_output><class 'pandas.core.frame.DataFrame'>
RangeIndex: 150 entries, 0 to 149
Data columns (total 5 columns):
 #   Column       Non-Null Count  Dtype  
---  ------       --------------  -----  
 0   sepallength  150 non-null    float64
 1   sepalwidth   150 non-null    float64
 2   petallength  150 non-null    float64
 3   petalwidth   150 non-null    float64
 4   class        150 non-null    object 
dtypes: float64(4), object(1)
memory usage: 6.0+ KB<jupyter_text>**Splitting data**<jupyter_code>from sklearn.model_selection import train_test_split
array = dt.values
X = array[:, 0:4]
y = array[:, 4]
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.3, random_state = 0)<jupyter_output><empty_output><jupyter_text>**Apply algorithm and evaluate** Support vector classifier<jupyter_code>from sklearn.svm import SVC
from sklearn.metrics import accuracy_score
svc = SVC(max_iter = 1000, gamma = 'auto')
svc.fit(X_train, y_train)
y_pred = svc.predict(X_test)
acc_svc = round(accuracy_score(y_pred, y_test), 2) * 100
print("Accuracy: ", acc_svc, "%")<jupyter_output>Accuracy:  98.0 %<jupyter_text>Decision Tree Classifier<jupyter_code>from sklearn.tree import DecisionTreeClassifier
decisiontree = DecisionTreeClassifier(random_state = 0)
decisiontree.fit(X_train, y_train)
y_pred = decisiontree.predict(X_test)
acc_decisiontree = round(accuracy_score(y_pred, y_test), 2)*100
print('Accuracy:', acc_decisiontree, '%')<jupyter_output>Accuracy: 98.0 %<jupyter_text>Logistic Regression<jupyter_code>from sklearn.linear_model import LogisticRegression
logreg = LogisticRegression(max_iter = 1000)
logreg.fit(X_train, y_train)
y_pred = logreg.predict(X_test)
acc_logreg = round(accuracy_score(y_pred, y_test), 2) * 100
print('Accuracy:', acc_logreg, '%')<jupyter_output>Accuracy: 98.0 %
{'fraction_non_alphanumeric': 0.14407407407407408, 'fraction_numerical': 0.04037037037037037, 'mean_word_length': 5.587804878048781, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 26, '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': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '629389', 'license': 'MIT', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1018, 'n_words': 219, 'path': 'IRIS-Classification.ipynb', 'repo_name': 'amnksngh/IRIS-Classification', 'size': '2700'}