I have an table and I want pass the features = “train_1, train_2, train_3, train_4” and target_result = result_cor.
I want know when the values are = “1 or 2” in my predicion:
follow my data
follow my code:
from enum import auto
from sklearn.svm import LinearSVC
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import classification_report
from sklearn import svm
from sklearn.linear_model import LogisticRegression
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import math
import seaborn as sns
sheet_id = '1CfnVwuqysTYNPKLVhgjJ44Af8VDcdN1l'
dados = pd.read_excel(f'https://docs.google.com/spreadsheets/export?id={sheet_id}&format=xlsx')
dados.head()
# Dados para realizar o aprendizado e ver quanto vai prever corretamente
x = dados[['train_1','train_2','train_3','train_4']]
# Gabarito ou resultados ja corretos
y = dados[['result_cor']]
# Efetuo a separação dos treinos de x e y e testes de x e y
treino_x, teste_x, treino_y, teste_y = train_test_split(x,y,test_size=0.33)
# Tipo de modelo
modelo = DecisionTreeClassifier()
# Efetuo o treinamento
modelo.fit(x,np.ravel(y,order="c"))
# Predicion new valor
model_predict = [0,1,0,1]
treino_x[:1] = model_predict
model_predict = treino_x[:1]
result_cor = [1]
treino_y[:1] = result_cor
result_cor = treino_y[:1]
# predicion the new model
previsoes = modelo.predict(model_predict)
# Check acuracy
accuracy = accuracy_score(result_cor,previsoes) * 100
print(f'A acuracia é: {round(accuracy,2)}')
but result is always 100.0 % or 0.0. I need to know the percent of times my result_cor appears in model_predict of my model trained model
please help