emanoelopes commited on
Commit
be8fb9d
·
1 Parent(s): 379c3b4
Files changed (5) hide show
  1. gw0.json +0 -0
  2. main.py +28 -9
  3. output1.csv +2 -2
  4. requirements.txt +3 -1
  5. web.ipynb +102 -0
gw0.json ADDED
File without changes
main.py CHANGED
@@ -2,27 +2,46 @@ from data import create_data
2
  from sklearn.model_selection import train_test_split
3
  from prerequisite_issues import identify_prerequisite_issues
4
  from output import gerar_csv
 
 
5
 
6
  def main():
 
 
7
  # Criando o DataFrame
8
  df, pre_reqs = create_data()
9
 
10
  # Identificando os pré-requisitos que os alunos precisam melhorar
11
  recommendations, metrics_summary = identify_prerequisite_issues(df, pre_reqs)
12
 
13
- # Avaliar modelos
14
- # metrics = evaluate_models(df)
15
-
16
  # Exibir os resultados
17
- print("Recomendações:", recommendations)
18
- print("\nResumo das Métricas:", metrics_summary)
 
 
 
 
 
 
 
 
 
19
 
20
- # # Criando um arquivo csv com os resultados
21
- # gerar_csv(df, 'output.csv')
22
-
23
  # Exporta o DataFrame para um arquivo CSV
24
  df.to_csv('output1.csv', index=False, encoding='utf-8')
25
- print("Arquivo CSV 'output.csv' criado com sucesso.")
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  if __name__ == "__main__":
28
  main()
 
2
  from sklearn.model_selection import train_test_split
3
  from prerequisite_issues import identify_prerequisite_issues
4
  from output import gerar_csv
5
+ import streamlit as st
6
+ import pandas as pd
7
 
8
  def main():
9
+ st.title("Sistema de Identificação de Dificuldades Acadêmicas (SIDA)")
10
+
11
  # Criando o DataFrame
12
  df, pre_reqs = create_data()
13
 
14
  # Identificando os pré-requisitos que os alunos precisam melhorar
15
  recommendations, metrics_summary = identify_prerequisite_issues(df, pre_reqs)
16
 
 
 
 
17
  # Exibir os resultados
18
+ st.subheader("Recomendações por Aluno")
19
+ for aluno, recs in recommendations.items():
20
+ st.write(f"**{aluno}:**")
21
+ for prereq, importance in recs[:3]: # Mostrar apenas os 3 mais importantes
22
+ st.write(f"- {prereq}: {importance:.3f}")
23
+
24
+ st.subheader("Resumo das Métricas dos Modelos")
25
+ for subject, metrics in metrics_summary.items():
26
+ st.write(f"**{subject}:**")
27
+ for model_name, model_metrics in metrics.items():
28
+ st.write(f"- {model_name}: R² = {model_metrics['R²']:.3f}, MAE = {model_metrics['MAE']:.3f}")
29
 
 
 
 
30
  # Exporta o DataFrame para um arquivo CSV
31
  df.to_csv('output1.csv', index=False, encoding='utf-8')
32
+ st.success("Arquivo CSV 'output1.csv' criado com sucesso.")
33
+
34
+ # Visualizações
35
+ st.subheader("Visualizações dos Dados")
36
+
37
+ # Gráfico de barras das notas médias por disciplina
38
+ st.write("**Notas Médias por Disciplina:**")
39
+ mean_scores = df.drop('Aluno', axis=1).mean()
40
+ st.bar_chart(mean_scores)
41
+
42
+ # Tabela com os dados
43
+ st.subheader("Dados dos Alunos")
44
+ st.dataframe(df)
45
 
46
  if __name__ == "__main__":
47
  main()
output1.csv CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:4c9af9042e581cbfd587242f7c243e991dbba1f26b878e3266e12374d3593590
3
- size 2157
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:149b12b3bd66b5ee26142e681b660fbfbe1804f98bf53a1f2d669aeb940f831d
3
+ size 2158
requirements.txt CHANGED
@@ -6,7 +6,9 @@ python-dateutil==2.9.0.post0
6
  pytz==2025.2
7
  scikit-learn==1.6.1
8
  scipy==1.13.1
9
- -e git+https://github.com/emanoelopes/sida.git@af9ff30657a57ab50f46e5162d6cbb05cb2b8173#egg=SIDA
 
 
10
  six==1.17.0
11
  threadpoolctl==3.6.0
12
  tzdata==2025.2
 
6
  pytz==2025.2
7
  scikit-learn==1.6.1
8
  scipy==1.13.1
9
+ streamlit==1.39.0
10
+ pygwalker==0.3.6
11
+ #-e git+https://github.com/emanoelopes/sida.git@af9ff30657a57ab50f46e5162d6cbb05cb2b8173#egg=SIDA
12
  six==1.17.0
13
  threadpoolctl==3.6.0
14
  tzdata==2025.2
web.ipynb ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "9e33bf6a",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import pandas as pd\n",
11
+ "import pygwalker as pyg\n",
12
+ "import streamlit as st\n",
13
+ "import numpy as np"
14
+ ]
15
+ },
16
+ {
17
+ "cell_type": "code",
18
+ "execution_count": null,
19
+ "id": "b9e80420",
20
+ "metadata": {},
21
+ "outputs": [
22
+ {
23
+ "ename": "KeyError",
24
+ "evalue": "'Nota'",
25
+ "output_type": "error",
26
+ "traceback": [
27
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
28
+ "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
29
+ "File \u001b[0;32m~/sida/.venv/lib/python3.9/site-packages/pandas/core/indexes/base.py:3812\u001b[0m, in \u001b[0;36mIndex.get_loc\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 3811\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 3812\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_engine\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_loc\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcasted_key\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 3813\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m err:\n",
30
+ "File \u001b[0;32mpandas/_libs/index.pyx:167\u001b[0m, in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[0;34m()\u001b[0m\n",
31
+ "File \u001b[0;32mpandas/_libs/index.pyx:196\u001b[0m, in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[0;34m()\u001b[0m\n",
32
+ "File \u001b[0;32mpandas/_libs/hashtable_class_helper.pxi:7088\u001b[0m, in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[0;34m()\u001b[0m\n",
33
+ "File \u001b[0;32mpandas/_libs/hashtable_class_helper.pxi:7096\u001b[0m, in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[0;34m()\u001b[0m\n",
34
+ "\u001b[0;31mKeyError\u001b[0m: 'Nota'",
35
+ "\nThe above exception was the direct cause of the following exception:\n",
36
+ "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
37
+ "Cell \u001b[0;32mIn[20], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m df \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mread_csv(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124moutput1.csv\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 2\u001b[0m df\u001b[38;5;241m.\u001b[39mset_index(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mAluno\u001b[39m\u001b[38;5;124m'\u001b[39m, inplace\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n\u001b[0;32m----> 3\u001b[0m st\u001b[38;5;241m.\u001b[39mline_chart(\u001b[43mdf\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mNota\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m)\n",
38
+ "File \u001b[0;32m~/sida/.venv/lib/python3.9/site-packages/pandas/core/frame.py:4107\u001b[0m, in \u001b[0;36mDataFrame.__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 4105\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcolumns\u001b[38;5;241m.\u001b[39mnlevels \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m1\u001b[39m:\n\u001b[1;32m 4106\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_getitem_multilevel(key)\n\u001b[0;32m-> 4107\u001b[0m indexer \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcolumns\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_loc\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 4108\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m is_integer(indexer):\n\u001b[1;32m 4109\u001b[0m indexer \u001b[38;5;241m=\u001b[39m [indexer]\n",
39
+ "File \u001b[0;32m~/sida/.venv/lib/python3.9/site-packages/pandas/core/indexes/base.py:3819\u001b[0m, in \u001b[0;36mIndex.get_loc\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 3814\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(casted_key, \u001b[38;5;28mslice\u001b[39m) \u001b[38;5;129;01mor\u001b[39;00m (\n\u001b[1;32m 3815\u001b[0m \u001b[38;5;28misinstance\u001b[39m(casted_key, abc\u001b[38;5;241m.\u001b[39mIterable)\n\u001b[1;32m 3816\u001b[0m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28many\u001b[39m(\u001b[38;5;28misinstance\u001b[39m(x, \u001b[38;5;28mslice\u001b[39m) \u001b[38;5;28;01mfor\u001b[39;00m x \u001b[38;5;129;01min\u001b[39;00m casted_key)\n\u001b[1;32m 3817\u001b[0m ):\n\u001b[1;32m 3818\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m InvalidIndexError(key)\n\u001b[0;32m-> 3819\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m(key) \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01merr\u001b[39;00m\n\u001b[1;32m 3820\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m:\n\u001b[1;32m 3821\u001b[0m \u001b[38;5;66;03m# If we have a listlike key, _check_indexing_error will raise\u001b[39;00m\n\u001b[1;32m 3822\u001b[0m \u001b[38;5;66;03m# InvalidIndexError. Otherwise we fall through and re-raise\u001b[39;00m\n\u001b[1;32m 3823\u001b[0m \u001b[38;5;66;03m# the TypeError.\u001b[39;00m\n\u001b[1;32m 3824\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_indexing_error(key)\n",
40
+ "\u001b[0;31mKeyError\u001b[0m: 'Nota'"
41
+ ]
42
+ }
43
+ ],
44
+ "source": [
45
+ "# Carregar os dados\n",
46
+ "df = pd.read_csv('output1.csv')\n",
47
+ "\n",
48
+ "# Verificar a estrutura dos dados\n",
49
+ "print(\"Colunas disponíveis:\", df.columns.tolist())\n",
50
+ "print(\"Primeiras linhas:\")\n",
51
+ "print(df.head())\n",
52
+ "\n",
53
+ "# Configurar o índice para o nome do aluno\n",
54
+ "df.set_index('Aluno', inplace=True)\n",
55
+ "\n",
56
+ "# Mostrar estatísticas básicas\n",
57
+ "print(\"\\nEstatísticas descritivas:\")\n",
58
+ "print(df.describe())\n",
59
+ "\n",
60
+ "# Criar visualizações com Streamlit\n",
61
+ "st.title(\"Análise de Dados Acadêmicos - SIDA\")\n",
62
+ "\n",
63
+ "# Gráfico de linha para uma disciplina específica (ex: Números Inteiros)\n",
64
+ "if 'Números Inteiros' in df.columns:\n",
65
+ " st.subheader(\"Notas em Números Inteiros\")\n",
66
+ " st.line_chart(df['Números Inteiros'])\n",
67
+ "else:\n",
68
+ " st.write(\"Coluna 'Números Inteiros' não encontrada. Colunas disponíveis:\", df.columns.tolist())\n",
69
+ "\n",
70
+ "# Gráfico de barras com as médias por disciplina\n",
71
+ "st.subheader(\"Médias por Disciplina\")\n",
72
+ "mean_scores = df.mean()\n",
73
+ "st.bar_chart(mean_scores)\n",
74
+ "\n",
75
+ "# Tabela interativa com PygWalker\n",
76
+ "st.subheader(\"Exploração Interativa dos Dados\")\n",
77
+ "pyg.walk(df, spec=\"./gw0.json\", use_kernel_calc=True, kernel_computation=True, debug=False)"
78
+ ]
79
+ }
80
+ ],
81
+ "metadata": {
82
+ "kernelspec": {
83
+ "display_name": ".venv",
84
+ "language": "python",
85
+ "name": "python3"
86
+ },
87
+ "language_info": {
88
+ "codemirror_mode": {
89
+ "name": "ipython",
90
+ "version": 3
91
+ },
92
+ "file_extension": ".py",
93
+ "mimetype": "text/x-python",
94
+ "name": "python",
95
+ "nbconvert_exporter": "python",
96
+ "pygments_lexer": "ipython3",
97
+ "version": "3.9.2"
98
+ }
99
+ },
100
+ "nbformat": 4,
101
+ "nbformat_minor": 5
102
+ }