Scipy warning with Pandas

I am working with Python 2.7 to test the following example:

# importando pandas, numpy y matplotlib
import matplotlib as matplotlib
import scipy as scipy
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

# importando los datasets de sklearn
from sklearn import datasets

boston = datasets.load_boston()
boston_df = pd.DataFrame(boston.data, columns=boston.feature_names)
boston_df['TARGET'] = boston.target
boston_df.head() # estructura de nuestro dataset.

from sklearn.linear_model import LinearRegression

rl = LinearRegression() # Creando el modelo.
rl.fit(boston.data, boston.target) # ajustando el modelo
list(zip(boston.feature_names, rl.coef_))

# haciendo las predicciones
predicciones = rl.predict(boston.data)
predicciones_df = pd.DataFrame(predicciones, columns=['Pred'])
predicciones_df.head() # predicciones de las primeras 5 lineas


np.mean(boston.target - predicciones)

      

But the answer is:

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/linalg/basic.py:1018: RuntimeWarning: gelsd driver lwork internal query failed, iwork required dimension is not returned. This is likely the result of LAPACK bug 0038, fixed in LAPACK 3.2.2 (released July 21, 2010). Return to "gels". warnings.warn (mesg, RuntimeWarning)

I used Brew and PIP to install Scipy.

How can I fix this?

+3


source to share


2 answers


This is safe and can be ignored.



The reason for the warning is because it says: the default lapack that comes on macOS is a bit old and scipy works around the bug it has.

+6


source


Try the below code to fix the problem:



import warnings

warnings.filterwarnings(action="ignore", module="scipy", message="^internal gelsd")

      

0


source







All Articles