Skip to content

Commit f165536

Browse files
Update realnn-regression-example-ames-no-preproc.py
Move updates to fix data leakage to realnn-regression-example-ames-no-preproc.py (moot change on defunct file)
1 parent 3cffba5 commit f165536

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

realnn-regression-example-ames-no-preproc.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
###
1818

19+
LABEL_COLUMN = 'price'
20+
1921
## your data:
2022

2123

@@ -30,9 +32,11 @@
3032

3133
raw_data = pd.read_csv('ames.csv')
3234
needed_cols = [
33-
col for col in raw_data.columns if raw_data[col].dtype != 'object']
35+
col for col in raw_data.columns
36+
if raw_data[col].dtype != 'object'
37+
and col != LABEL_COLUMN]
3438
data_numeric = raw_data[needed_cols].fillna(0).astype(float)
35-
label = raw_data.pop('price')
39+
label = raw_data.pop(LABEL_COLUMN)
3640

3741
data_np = data_numeric.values
3842

0 commit comments

Comments
 (0)