matsammut commited on
Commit
4662aaf
·
verified ·
1 Parent(s): 4a6e928

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -3
app.py CHANGED
@@ -11,7 +11,7 @@ from sklearn.decomposition import PCA
11
 
12
  # # Define the prediction function
13
  def predict(age, workclass, education, marital_status, occupation, relationship, race, gender, capital_gain, capital_loss, hours_per_week, native_country):
14
- features = [age, workclass, education, marital_status, occupation, relationship, race, gender, capital_gain, capital_loss, hours_per_week, native_country]
15
  fixed_features = cleaning_features(features)
16
  # prediction = model.predict(features)
17
  # prediction = 1
@@ -24,8 +24,6 @@ def cleaning_features(data):
24
  encoder = OneHotEncoder(sparse_output=False)
25
  numeric_cols = ['age', 'educational-num', 'hours-per-week']
26
  columns_to_encode = ['race','marital-status','relationship']
27
-
28
- data.replace({'?': np.nan, 99999: np.nan}, inplace=True)
29
 
30
  # 1. Scale numerical features
31
  data[numeric_cols] = scaler.fit_transform(data[numeric_cols])
 
11
 
12
  # # Define the prediction function
13
  def predict(age, workclass, education, marital_status, occupation, relationship, race, gender, capital_gain, capital_loss, hours_per_week, native_country):
14
+ features = np.array([age, workclass, education, marital_status, occupation, relationship, race, gender, capital_gain, capital_loss, hours_per_week, native_country])
15
  fixed_features = cleaning_features(features)
16
  # prediction = model.predict(features)
17
  # prediction = 1
 
24
  encoder = OneHotEncoder(sparse_output=False)
25
  numeric_cols = ['age', 'educational-num', 'hours-per-week']
26
  columns_to_encode = ['race','marital-status','relationship']
 
 
27
 
28
  # 1. Scale numerical features
29
  data[numeric_cols] = scaler.fit_transform(data[numeric_cols])