Utilizei o código:
import seaborn as sns
sns.lineplot(x = "max_depth", y = "train", data = resultados)
sns.lineplot(x = "max_depth", y = "test", data = resultados)
Encontrei o erro:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-58-eab2560d8734> in <cell line: 3>()
1 import seaborn as sns
2
----> 3 sns.lineplot(x = "max-depth", y = "treino", data = resultados)
4 sns.lineplot(x = "max-depth", y = "teste", data = resultados)
3 frames
/usr/local/lib/python3.10/dist-packages/numpy/__init__.py in __getattr__(attr)
322
323 if attr in __former_attrs__:
--> 324 raise AttributeError(__former_attrs__[attr])
325
326 if attr == 'testing':
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
Corrigi criando um gráfico com o matplotlib ao invés do seaborn, segue código:
import matplotlib.pyplot as plt
plt.figure(figsize=(10, 6))
plt.plot(resultados['max-depth'], resultados['treino'], marker='o', label='Treino', color='blue')
plt.plot(resultados['max-depth'], resultados['teste'], marker='o', label='Teste', color='orange')
plt.title('Desempenho do Modelo de Árvore de Decisão')
plt.xlabel('Profundidade Máxima da Árvore (max-depth)')
plt.ylabel('Acurácia (%)')
plt.grid(True)
plt.legend()
plt.show()