diff --git a/A_Naive_Bayes_Classifier_of_Spatial_Prepositions.ipynb b/A_Naive_Bayes_Classifier_of_Spatial_Prepositions.ipynb index bf7d818..56d6fcb 100644 --- a/A_Naive_Bayes_Classifier_of_Spatial_Prepositions.ipynb +++ b/A_Naive_Bayes_Classifier_of_Spatial_Prepositions.ipynb @@ -5,7 +5,7 @@ "colab": { "private_outputs": true, "provenance": [], - "authorship_tag": "ABX9TyOtAws7g+Ww5md7+Ng1v7T2", + "authorship_tag": "ABX9TyO/HriD8rlWF7QYjff37k8Q", "include_colab_link": true }, "kernelspec": { @@ -380,7 +380,7 @@ { "cell_type": "code", "source": [ - "# Split corpus into Train (80%) and Test (20%)\n", + "# Splits corpus into Train (80%) and Test (20%)\n", "\n", "from sklearn.model_selection import train_test_split\n", "\n", @@ -417,10 +417,8 @@ { "cell_type": "code", "source": [ - "# Hora de classificar o conjunto de treinamento\n", - "\n", - "model = MultinomialNB() # Cria um objeto do tipo \"Classificador Bayesiano Multinomial\"\n", - "model.fit(X_train, y_train) # Busca ajustar os dados às etiquetas" + "model = MultinomialNB() # Creates MNB model\n", + "model.fit(X_train, y_train) # Adjests data according to the tags" ], "metadata": { "id": "tSQ06050QRWB" @@ -442,7 +440,7 @@ { "cell_type": "code", "source": [ - "predictions[:3] # Conferindo..." + "predictions[:3] " ], "metadata": { "id": "uHz4gI5LQW1P" @@ -453,8 +451,7 @@ { "cell_type": "code", "source": [ - "# Cálculo das métricas com sklearn\n", - "\n", + "# Using Scikit-learn\n", "from sklearn.metrics import classification_report\n", "\n", "print(classification_report(y_test, predictions))" @@ -514,8 +511,8 @@ { "cell_type": "code", "source": [ - "# Probabilidades (prévia) das classes\n", - "# Muito útil, pois mostra o viés\n", + "# Probabilitues (prior) of classes\n", + "# Shows bias\n", "\n", "model.class_log_prior_" ], @@ -539,7 +536,7 @@ { "cell_type": "code", "source": [ - "# N. of atributes\n", + "# N. of attributes\n", "\n", "model.n_features_in_" ], @@ -552,8 +549,8 @@ { "cell_type": "code", "source": [ - "# Probabilidade posterior de cada atributo (logarítmica)\n", - "# A primeira lista corresponde à classe 0 (Negativo) e, a segunda, à classe 1 (Positivo)\n", + "# Post probability of each attribute (logarithmic)\n", + "# The first list corresponds to class 0 (Negative) and the second to class 1 (Positive)\n", "\n", "model.feature_log_prob_" ], @@ -566,7 +563,7 @@ { "cell_type": "code", "source": [ - "# Nomes dos atributos indexados alfabeticamente\n", + "# Alphabetically indexed attribute names\n", "\n", "vetor.get_feature_names_out()" ], @@ -606,10 +603,7 @@ { "cell_type": "code", "source": [ - "df['Ratio SPATIAL/NON-SPATIAL'] = df['SPATIAL'] / df['NON-SPATIAL'] \n", - "\n", - "# O DataFrame resultante poderá ser ordenado por \"espacialidade\" \n", - "# (como são números negativos, quanto menor a razão acima, mais \"epacial\")\n", + "df['Ratio SPATIAL/NON-SPATIAL'] = df['SPATIAL'] / df['NON-SPATIAL'] #The smaller the ratio, the more \"spatial\" is the term.\n", "df" ], "metadata": {