Bom dia, ao rodar o código, me apresenta essa mensagem de warning:
/usr/local/lib/python3.8/dist-packages/sklearn/svm/_base.py:1206: ConvergenceWarning: Liblinear failed to converge, increase the number of iterations.
warnings.warn(
O que isso significa? Abaixo segue meu código: PS:. Outra coisa que eu notei é que eu testo e treino com a mesma quantidade de elementos exibidos em aula, porém minha acurácia está em 47.41%. Qual o motivo de estar diferente do exibido em aula?
#Import tools
import pandas as pandas_tool
import seaborn as graph_sns_tool
from sklearn.svm import LinearSVC
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
#Constants
SEED = 32
#Load file from uri
uri = 'https://gist.githubusercontent.com/guilhermesilveira/1b7d5475863c15f484ac495bd70975cf/raw/16aff7a0aee67e7c100a2a48b676a2d2d142f646/projects.csv'
#Load data from uri loaded
data = pandas_tool.read_csv(uri)
#Creating map to set the column "finished"
swap_values = {
0:1,
1:0
}
#Creating the new column
data['finished'] = data.unfinished.map(swap_values)
data.head()
#Configuring the graph tool
graph_sns_tool.relplot(x = "expected_hours", y = "price", hue = "finished", col = "finished", data= data)
graph_sns_tool.scatterplot(x = "expected_hours", y = "price", hue = "finished", data= data)
#Spliting features and labels. X and Y
data_x = data[["expected_hours","price"]]
data_y = data["finished"]
#Collecting samples to train and test
train_x, test_x,train_y,test_y =train_test_split(data_x, data_y, test_size= 0.25, random_state= SEED, stratify = data_y)
#Logging...
print("Train of model will use %d elements and test of model will use %d elements." %( len(train_x), len(test_x)))
#Generating model
model = LinearSVC(random_state= SEED)
#Configuring model
model.fit(train_x,train_y)
#Logging...
print("Training...")
#Get predicitons feedback
predictions = model.predict(test_x)
#Logging...
print("Testing... Wait result.")
#Get accuracy of predictions
accuracy = accuracy_score(test_y,predictions)*100
#Logging...
print("The accuracy of test is %.2f%%." %accuracy)