Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Google
- def normalize_linear_scale(examples_dataframe):
- """Returns a version of the input `DataFrame` that has all its features normalized linearly."""
- processed_features = pd.DataFrame()
- processed_features["latitude"] = linear_scale(examples_dataframe["latitude"])
- processed_features["longitude"] = linear_scale(examples_dataframe["longitude"])
- processed_features["housing_median_age"] = linear_scale(examples_dataframe["housing_median_age"])
- processed_features["total_rooms"] = linear_scale(examples_dataframe["total_rooms"])
- processed_features["total_bedrooms"] = linear_scale(examples_dataframe["total_bedrooms"])
- processed_features["population"] = linear_scale(examples_dataframe["population"])
- processed_features["households"] = linear_scale(examples_dataframe["households"])
- processed_features["median_income"] = linear_scale(examples_dataframe["median_income"])
- processed_features["rooms_per_person"] = linear_scale(examples_dataframe["rooms_per_person"])
- return processed_features
- ## Sergio
- def normalize_linear_scale(examples_dataframe):
- """Returns a version of the input `DataFrame` that has all its features normalized linearly."""
- normalized_dataframe = pd.DataFrame()
- index = 0;
- for feature_name, series in examples_dataframe.items():
- normalized_series = linear_scale(series)
- normalized_dataframe.insert(index, feature_name, normalized_series)
- index += 1
- return normalized_dataframe
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement