Bom dia! Estou obtendo valores divergentes na acurácia. Segue o código:
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
from sklearn.svm import LinearSVC
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
uri = "https://gist.githubusercontent.com/guilhermesilveira/1b7d5475863c15f484ac495bd70975cf/raw/16aff7a0aee67e7c100a2a48b676a2d2d142f646/projects.csv"
data = pd.read_csv(uri)
to_rename = {
"expected_hours": "tempo_esperado",
"price": "preco",
"unfinished": "nao_finalizados"
}
data = data.rename(columns=to_rename)
exchange = {
0: 1,
1: 0
}
SEED = 5
np.random.seed(SEED)
x = data[["tempo_esperado", "preco"]]
y = data["finalizados"]
train_x, test_x, train_y, test_y = train_test_split(x, y,
test_size=0.25,
stratify=y)
print(
f"Treinaremos com {len(train_x)} elementos e testaremos com {len(test_x)} elementos.")
model = SVC()
model.fit(train_x, train_y)
previews = model.predict(test_x)
accuracy = accuracy_score(test_y, previews) * 100
my_previews = np.ones(540)
accuracy = accuracy_score(test_y, my_previews) * 100
print(f"A acurácia foi de {round(accuracy, 2)}%")