Created
May 31, 2022 04:44
-
-
Save Eligijus112/2bba9ac7ff607b01b957684a5d066514 to your computer and use it in GitHub Desktop.
California dataset loading
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Dataset loading | |
| from sklearn.datasets import fetch_california_housing | |
| # Loading the data | |
| _cali_data = fetch_california_housing(as_frame=True) | |
| # Features and target | |
| X, y = _cali_data.data, _cali_data.target | |
| # Droping the geo coordinate featuress | |
| X = X.drop(columns=['Latitude', 'Longitude']) | |
| # Droping the population feature; In real life modeling, this could be used as weight. | |
| # For educational and inference purposes, we drop it. | |
| X = X.drop(columns=['Population']) | |
| # Saving the feature names | |
| features = X.columns |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment