LinkedInLearning / artificial-intelligence-foundations-machine-learning-3067770

This is a repo for the LinkedIn Learning course Artificial Intelligence Foundations: Machine Learning
Other
105 stars 153 forks source link

Issue with correlation matrices #1

Open DrHavoc21 opened 1 year ago

DrHavoc21 commented 1 year ago

Issue Overview

In the home prediction jupyterbook, there is an issue with the correlation functions on my python environment. ## Describe your environment VScode python .venv (python 3.10.4) ## Steps to Reproduce
  1. Executing the code in LiL-homepredictions.ipynb returns an error when the housing_df.corr() function calls are made

Expected Behavior

We expect a correlation matrix to be produced ## Current Behavior Instead an error appears saying that it cannot convert the ocean proximity values to a float. ## Possible Solution It appears that columns with objects are not ignored by this function call. To solve this problem I simply selected only the columns that had no objects in: corr = housing_df[columns_list].corr() And in the second correlation matrix after feature engineering: no_obj = [col for col in housing_df.columns if housing_df[col].dtype != 'object'] corr = housing_df[no_obj].corr() ## Screenshots / Video N/A ## Related Issues N/A
alvincrespo commented 4 months ago

@DrHavoc21 Thanks for this! Definitely fixed the issue for me as well.

image