Olá meu povo!
Aqui estão o código e dataset utilizados no video:
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 9 18:32:09 2021 @author: rafaeldontalgoncalez """ ###################################### # Importando as bibliotecas ###################################### import numpy as np import matplotlib.pyplot as plt import pandas as pd from sklearn.tree import DecisionTreeRegressor ###################################### # Importa o dataset ###################################### dataset = pd.read_csv('efetividade_vacina.csv') X = dataset.iloc[:, 0].values.reshape(-1,1) y = dataset.iloc[:, -1].values.reshape(-1,1) ###################################### # Treinando o modelo para regressao de arvore de decisao ###################################### regressor = DecisionTreeRegressor(min_samples_split=10) regressor.fit(X,y) ###################################### # Imprime a regressao de arvore de decisao ###################################### plt.scatter(X, y, color = 'red') plt.plot(X, regressor.predict(X), color = 'blue') plt.title('Regressao de Arvore de Decisao') plt.xlabel('Idade') plt.ylabel('Efetividade da Vacina (%)') plt.show() ###################################### # Prevendo resultados para regressao de arvore de decisao ###################################### print('5 anos =', regressor.predict([[5]])) print('6 anos =', regressor.predict([[6]])) print('8 anos =', regressor.predict([[8]])) print('11 anos =', regressor.predict([[11]])) print('12 anos =', regressor.predict([[12]])) print('20 anos =', regressor.predict([[20]])) print('27 anos =', regressor.predict([[27]])) print('28 anos =', regressor.predict([[28]])) print('31 anos =', regressor.predict([[31]])) print('33 anos =', regressor.predict([[33]])) print('37 anos =', regressor.predict([[37]])) print('43 anos =', regressor.predict([[43]])) print('47 anos =', regressor.predict([[47]])) print('48 anos =', regressor.predict([[48]])) print('78 anos =', regressor.predict([[78]]))