<jupyter_start><jupyter_text>DATASET II<jupyter_code>data_3l = pd.read_csv('column_3C_weka.csv')
print(data_3l.shape)
data_3l.head()
data_3l.describe()
data_3l.isnull().sum()
data_3l['class'].value_counts()<jupyter_output><empty_output><jupyter_text>PLOTTING<jupyter_code>corre = data_3l.corr()
plt.figure(figsize=(10,10))
sns.heatmap(corre)
data_3l.hist(figsize = (10,10), edgecolor = 'Black')
colors = ['Red' if i=='Hernia' else 'Blue' if i=='Spondylolisthesis' else 'Yellow' for  i in data_3l['class']]
pd.plotting.scatter_matrix(data_3l.iloc[:,:-1], color = colors , figsize=(20,20), marker = "*", alpha = 0.75, s = 70)
plt.show()
plt.figure(figsize = (8,8))
ax = sns.countplot(data_3l['class'])
plt.xlabel('Class', fontdict={'fontsize':20})
plt.ylabel('Count',fontdict={'fontsize':20})
plt.tick_params(labelsize = 12)
for i in ax.patches:
    plt.text(i.get_x() + 0.35, i.get_height() + 2, str(i.get_height()), fontdict={'fontsize':12})
means = data_3l.groupby('class').agg(np.mean)
means
means.columns
means.plot(kind = 'bar', figsize = (20,10), fontsize = 20)
plt.xlabel('Class',fontdict={'fontsize': 25})
plt.ylabel('Means',fontdict={'fontsize': 25})
plt.tick_params(labelrotation = 45)
plt.title('UNDERSTANDING THE CAUSES', fontdict={"fontsize":30})<jupyter_output><empty_output><jupyter_text>PREPROCESSING<jupyter_code>X = data_3l.iloc[:,:6].values
y = data_3l['class']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.1)<jupyter_output><empty_output><jupyter_text>MODEL IMPLEMENTATION<jupyter_code>lr = LogisticRegression(C = 6, solver='liblinear', multi_class='auto', max_iter= 400)
lr.fit(X_train,y_train)
predictions = lr.predict(X_test)
print('Accuracy = {0}'.format(lr.score(X_test,y_test)))
print(classification_report(y_test, predictions))
knn = KNeighborsClassifier(n_neighbors=10)
knn.fit(X_train, y_train)
predict = knn.predict(X_test)
print('Accuracy = {0}'.format(knn.score(X_test,y_test)))
print(classification_report(y_test, predict))
list_scores = []
list_no = []
for i in range(1,20):
    knn = KNeighborsClassifier(n_neighbors=i)
    knn.fit(X_train, y_train)
    list_scores.append(knn.score(X_test, y_test))
    list_no.append(i)
plt.figure(figsize=(20,10))
plt.xticks(range(1,20))
plt.xlabel('Neighbours', fontdict={'fontsize':20})
plt.ylabel('Scores', fontdict={'fontsize':20})
plt.title('Score vs Neighbours', fontdict={'fontsize':30})
plt.tick_params(labelsize = 15)
plt.plot(list_no, list_scores, color = 'RED')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1836734693877551, 'fraction_numerical': 0.03601440576230492, 'mean_word_length': 8.541984732824428, 'pattern_counts': {'":': 1, '<': 17, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '346469', 'license': 'Apache-2.0', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1032, 'n_words': 142, 'path': 'Biomechanical Features of Orthopedic Patients/Bio-mechanical features of orthopedic patients PART-II.ipynb', 'repo_name': 'KJKR73/Data-Science-BIG', 'size': '2499'}