@@ -108,25 +108,20 @@ def add_predictors_to_aoh_df(aoh_df: pd.DataFrame) -> pd.DataFrame:
108108 aoh_df ['elevation_rangekm' ] = aoh_df ['elevation_range' ] / 1000.0
109109 aoh_df ['elevation_midkm' ] = aoh_df ['elevation_mid' ] / 1000.0
110110
111- # Standardize predictors across full dataset
112111 means = aoh_df .mean (axis = 0 , numeric_only = True )
113112 standard_devs = aoh_df .std (axis = 0 , numeric_only = True )
114113
115- aoh_df ['std_elevation_rangekm' ] = (
116- (aoh_df .elevation_rangekm - means .elevation_rangekm ) / standard_devs .elevation_rangekm
117- )
118- aoh_df ['std_elevation_midkm' ] = (
119- (aoh_df .elevation_midkm - means .elevation_midkm ) / standard_devs .elevation_midkm
120- )
121- aoh_df ['std_n_habitats' ] = (
122- (aoh_df .n_habitats - means .n_habitats ) / standard_devs .n_habitats
123- )
114+ aoh_df ['std_elevation_rangekm' ] = (aoh_df .elevation_rangekm - means .elevation_rangekm ) \
115+ / standard_devs .elevation_rangekm
116+ aoh_df ['std_elevation_midkm' ] = (aoh_df .elevation_midkm - means .elevation_midkm ) \
117+ / standard_devs .elevation_midkm
118+ aoh_df ['std_n_habitats' ] = (aoh_df .n_habitats - means .n_habitats ) \
119+ / standard_devs .n_habitats
124120
125121 return aoh_df
126122
127123
128124def model_validation (aoh_df : pd .DataFrame ) -> tuple [pd .DataFrame , pd .DataFrame , pd .DataFrame , pd .DataFrame ]:
129- """Run model validation across all taxonomic classes."""
130125 if pymer4 is None :
131126 raise ImportError ("pymer4 is required for model validation but not installed. "
132127 "This requires R to be installed on the system." )
0 commit comments