Intel® Distribution for Python*
Support and discussions for achieving faster Python* applications and core computational packages.
383 Discussions

daalpy_fit RuntimeError: Failed to solve the system of normal equations

sandev__peter
Beginner
354 Views

Hi,

Hi,
I am running a list of regression models and I am getting the following:
Traceback (most recent call last):
File "/home/XXXXXX/iowa_housing_functions1.py", line 293, in
col_num=columns_num, col_cat=columns_cat, data=df_train,run_from_cache=False)
File "/home/XXXXX/iowa_housing_functions1.py", line 217, in run_regression
regressor.fit(X_preprocessed_train, y_train)
File "/home/XXX/miniconda3/envs/idp3/lib/python3.6/site-packages/sklearn/linear_model/ransac.py", line 366, in fit
base_estimator.fit(X_subset, y_subset)
File "/home/XXX/miniconda3/envs/idp3/lib/python3.6/site-packages/sklearn/daal4sklearn/linear.py", line 81, in fit
_daal4py_fit(self, X, y)
File "/home/XXX/miniconda3/envs/idp3/lib/python3.6/site-packages/sklearn/daal4sklearn/linear.py", line 20, in _daal4py_fit
lr_res = lr_algorithm.compute(X, y)
File "build/daal4py_cy.pyx", line 7445, in _daal4py.linear_regression_training.compute
RuntimeError: Failed to solve the system of normal equations

It does not happen when I run it from another virtual environment with non-intel python and sklearn

Thanks a lot.

0 Kudos
1 Reply
Oleksandr_P_Intel
354 Views
Thank you for reporting the problem, and apologies for the inconvenience. scikit-learn in Intel (R) Distribution for Python* is monkey-patched to use Intel Data Analytics Acceleration Library (DAAL) as the underlying solver for a subset of algorithms, including linear and Ridge regressions. DAAL provides two algorithms to solver linear regression, forming and solvign normal equation directly, or using QR decomposition of the design matrix to do it. See https://software.intel.com/en-us/daal-programming-guide-batch-processing-38 The default, faster method forms and solves normal equations directly. It is less numerically stable, than the slower QR method. I would suggest to regularized the normal equation using sklearn.linear_model.Ridge estimator. We will see about exposing QR method to linear regression as well.
Reply