Trabajo
Trabajo
Trabajo
import pandas as pd
import numpy as np
from sklearn import linear_model
from sklearn import model_selection
from sklearn.metrics import classification_report
from sklearn.metrics import confusion_matrix
from sklearn.metrics import accuracy_score
import matplotlib.pyplot as plt
import seaborn as sb
%matplotlib inline
import pandas as pd
dataframe.describe()
1 de 5 28/05/2024, 21:20
Untitled10.ipynb - Colab https://colab.research.google.com/drive/15LGs5x72u4a8FcApdQ5Vs...
print(dataframe.groupby('clase').size())
clase
0 86
1 40
2 44
dtype: int64
dataframe.drop(['clase'], axis=1).hist()
plt.show()
2 de 5 28/05/2024, 21:20
Untitled10.ipynb - Colab https://colab.research.google.com/drive/15LGs5x72u4a8FcApdQ5Vs...
3 de 5 28/05/2024, 21:20
Untitled10.ipynb - Colab https://colab.research.google.com/drive/15LGs5x72u4a8FcApdQ5Vs...
import numpy as np
X = np.array(dataframe.drop(['clase'], axis=1))
y = np.array(dataframe['clase'])
print(X.shape)
(170, 4)
predictions = model.predict(X)
print(predictions[:5])
[2 2 2 2 2]
model.score(X,y)
0.7823529411764706
validation_size = 0.20
seed = 7
X_train, X_validation, Y_train, Y_validation = model_selection.train_test_split(X, y, test_
4 de 5 28/05/2024, 21:20
Untitled10.ipynb - Colab https://colab.research.google.com/drive/15LGs5x72u4a8FcApdQ5Vs...
0.8529411764705882
print(confusion_matrix(Y_validation, predictions))
[[16 0 2]
[ 3 3 0]
[ 0 0 10]]
print(classification_report(Y_validation, predictions))
accuracy 0.85 34
macro avg 0.89 0.80 0.81 34
weighted avg 0.87 0.85 0.84 34
5 de 5 28/05/2024, 21:20