Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -13,9 +13,9 @@ from sklearn.decomposition import PCA
|
|
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 |
columns = [
|
16 |
-
"age", "workclass", "education", "marital_status", "occupation",
|
17 |
-
"relationship", "race", "gender", "
|
18 |
-
"
|
19 |
df = pd.DataFrame(index=features, columns=columns)
|
20 |
fixed_features = cleaning_features(df)
|
21 |
# prediction = model.predict(features)
|
@@ -36,7 +36,7 @@ def cleaning_features(data):
|
|
36 |
|
37 |
# 2. Label encode gender and income
|
38 |
data['gender'] = le.fit_transform(data['gender'])
|
39 |
-
data['education-num'] = le.fit_transform(data['education'])
|
40 |
|
41 |
# 3. One-hot encode race
|
42 |
for N in columns_to_encode:
|
|
|
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 |
columns = [
|
16 |
+
"age", "workclass", "education-num", "marital_status", "occupation",
|
17 |
+
"relationship", "race", "gender", "capital-gain", "capital-loss",
|
18 |
+
"hours-per-week", "native-country"]
|
19 |
df = pd.DataFrame(index=features, columns=columns)
|
20 |
fixed_features = cleaning_features(df)
|
21 |
# prediction = model.predict(features)
|
|
|
36 |
|
37 |
# 2. Label encode gender and income
|
38 |
data['gender'] = le.fit_transform(data['gender'])
|
39 |
+
data['education-num'] = le.fit_transform(data['education-num'])
|
40 |
|
41 |
# 3. One-hot encode race
|
42 |
for N in columns_to_encode:
|