Estou usando as versões das bibliotecas como pedido
Usando pandas 1.0.3
Usando seaborn 0.10.1
Usando scipy 1.4.1
Usando yellowbrick 0.9
Usando numpy 1.18.4
Mas os códigos que usam yellowbrick estão todos dando problema Exemplo 1:
from yellowbrick.regressor import PredictionError
def visualiza_erros(train_x,train_y,test_x,test_y):
visualizer = PredictionError(LinearRegression())
visualizer.fit(train_x, train_y)
visualizer.score(test_x, test_y)
visualizer.poof()
visualiza_erros(train_x,train_y,test_x,test_y)
Erro :
YellowbrickValueError Traceback (most recent call last)
<ipython-input-27-79500de02aa1> in <module>
9 visualizer.poof()
10
---> 11 visualiza_erros(train_x,train_y,test_x,test_y)
12
13 # Comentei o código por causa de erro na biblioteca, não soube resolver.
<ipython-input-27-79500de02aa1> in visualiza_erros(train_x, train_y, test_x, test_y)
6 visualizer = PredictionError(LinearRegression())
7 visualizer.fit(train_x, train_y)
----> 8 visualizer.score(test_x, test_y)
9 visualizer.poof()
10
c:\users\ramon\anaconda3\envs\alura\lib\site-packages\yellowbrick\regressor\residuals.py in score(self, X, y, **kwargs)
157
158 y_pred = self.predict(X)
--> 159 self.draw(y, y_pred)
160
161 return self.score_
c:\users\ramon\anaconda3\envs\alura\lib\site-packages\yellowbrick\regressor\residuals.py in draw(self, y, y_pred)
188 draw_best_fit(
189 y, y_pred, self.ax, 'linear', ls='--', lw=2,
--> 190 c=self.colors['line'], label='best fit'
191 )
192
c:\users\ramon\anaconda3\envs\alura\lib\site-packages\yellowbrick\bestfit.py in draw_best_fit(X, y, ax, estimator, **kwargs)
138 if y.ndim > 1:
139 raise YellowbrickValueError(
--> 140 "y must be a (1,) dimensional array not {}".format(y.shape)
141 )
142
YellowbrickValueError: y must be a (1,) dimensional array not (11067, 1)
As variáveis estão sendo passadas como esperado, não consegui entender porque esse erro está estourando, imagino que tenha algo errado com a própria biblioteca, estou prosseguindo com o projeto comentando todos os códigos que usam a biblioteca yellowbrick.