<jupyter_start><jupyter_text>ANÁLISE EXPLORATÓRIA<jupyter_code>df = pd.read_csv('column_3C_weka.csv')
df.head()
df.info()
# Check for missing values
df.isna().sum()
#Check for duplicated
df.duplicated().sum()
df['class'].value_counts()
sns.countplot(df['class'])
#explore the correlation between variables
sns.pairplot(df, hue='class')<jupyter_output><empty_output><jupyter_text>PRE-PROCESSING SEPARATION VARIABLES IN PREDICTOR AND TARGET<jupyter_code>x = df.drop('class', axis = 1)
y = df['class']<jupyter_output><empty_output><jupyter_text>TRAIN AND TEST<jupyter_code>xTrain, xTest, yTrain, yTest = train_test_split(x,y,test_size = 0.2, random_state=7)<jupyter_output><empty_output><jupyter_text>PREDICT MACHINE BUILD A MODEL AND TRAIN DATA<jupyter_code>predict =KNeighborsClassifier(n_neighbors=3)
knn = predict.fit(xTrain,yTrain)
knn
predictY = knn.predict(xTest)<jupyter_output><empty_output><jupyter_text>COMPARE ACTUAL AND PREDICT VALUES<jupyter_code>actualVSpredict = pd.DataFrame({'Actual: ':yTest, 'Prediction:': predictY})
actualVSpredict.head(20)<jupyter_output><empty_output><jupyter_text>AVALIATION ACCURACY<jupyter_code>accuracy_score(yTest,predictY)<jupyter_output><empty_output><jupyter_text>CLASSIFICATION METRICS<jupyter_code>print(classification_report(yTest,predictY))<jupyter_output>precision    recall  f1-score   support

           Hernia       0.50      0.57      0.53         7
           Normal       0.80      0.76      0.78        21
Spondylolisthesis       0.97      0.97      0.97        34

         accuracy                           0.85        62
        macro avg       0.76      0.77      0.76        62
     weighted avg       0.86      0.85      0.86        62
{'fraction_non_alphanumeric': 0.11, 'fraction_numerical': 0.04, 'mean_word_length': 3.9304347826086956, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '256037', 'license': 'MIT', 'n_tokens_mistral': 683, 'n_tokens_neox': 640, 'n_words': 99, 'path': 'Untitled.ipynb', 'repo_name': 'recktg095/Avaliacao-saude-KNN', 'size': '1700'}