Skip to content

Instantly share code, notes, and snippets.

@Eligijus112
Created May 31, 2022 04:44
Show Gist options
  • Save Eligijus112/2bba9ac7ff607b01b957684a5d066514 to your computer and use it in GitHub Desktop.
Save Eligijus112/2bba9ac7ff607b01b957684a5d066514 to your computer and use it in GitHub Desktop.
California dataset loading
# 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