Daniel ORTIZ
Daniel ORTIZ

Reputation: 2520

Warning using Scipy with Pandas

I'm 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 response is:

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

I used Brew and PIP to install Scipy.

How can I fix it?

Upvotes: 5

Views: 4456

Answers (2)

ev-br
ev-br

Reputation: 26110

This is harmless and can be ignored.

The reason for the warning is just what it says: the default LAPACK which comes on macOS is a little old and SciPy works around a bug it has.

Upvotes: 11

Thanooj Ks
Thanooj Ks

Reputation: 65

Try the code below to fix the issue:

import warnings

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

Upvotes: 6

Related Questions