slickdata commited on
Commit
23adacd
·
1 Parent(s): 7641db4

update predict_page.py

Browse files
Files changed (1) hide show
  1. predict_page.py +0 -52
predict_page.py CHANGED
@@ -10,23 +10,6 @@ import joblib
10
 
11
 
12
 
13
- # Load the numerical imputer
14
- #num_imputer = joblib.load("numerical_imputer.joblib")
15
-
16
- # Load the categorical imputer
17
- #cat_imputer = joblib.load("categorical_imputer.joblib")
18
-
19
- # Load the scaler
20
- #scaler = joblib.load("scaler.joblib")
21
-
22
- # Load the label encoder for 'family' feature
23
- #le_family = joblib.load("le_family.joblib")
24
-
25
- # Load the label encoder for 'holiday_type' feature
26
- #le_holiday_type = joblib.load("le_holiday_type.joblib")
27
-
28
- # Load the label encoder for 'city' feature
29
- #le_city = joblib.load("le_city.joblib")
30
 
31
  # Load the final model
32
  regressor = joblib.load("Best_model.joblib")
@@ -66,41 +49,6 @@ def show_predict_page():
66
  # Convert the input data to a pandas DataFrame
67
  input_df = pd.DataFrame([input_data])
68
 
69
-
70
- # Selecting categorical and numerical columns separately
71
- # cat_columns = [col for col in input_df.columns if input_df[col].dtype == 'object']
72
- # num_columns = [col for col in input_df.columns if input_df[col].dtype != 'object']
73
-
74
-
75
- # Apply the imputers
76
- # input_df_imputed_cat = cat_imputer.transform(input_df[cat_columns])
77
- # input_df_imputed_num = num_imputer.transform(input_df[num_columns])
78
-
79
- # Convert the NumPy arrays to DataFrames
80
- # input_df_imputed_cat = pd.DataFrame(input_df_imputed_cat, columns=cat_columns)
81
- # input_df_imputed_num = pd.DataFrame(input_df_imputed_num, columns=num_columns)
82
-
83
-
84
- # Scale the numerical columns
85
- # input_df_scaled = scaler.transform(input_df_imputed_num)
86
- # input_scaled_df = pd.DataFrame(input_df_scaled , columns = num_columns)
87
-
88
- # input_df_imputed = pd.concat([input_df_imputed_cat, input_scaled_df], axis=1)
89
-
90
- # Encode the categorical columns
91
- # Encode the categorical columns
92
- # input_df_imputed['family'] = le_family.transform(input_df_imputed['family'])
93
- # input_df_imputed['holiday_type'] = le_holiday_type.transform(input_df_imputed['holiday_type'])
94
- # input_df_imputed['city'] = le_city.transform(input_df_imputed['city'])
95
-
96
-
97
- #input_encoded_df = pd.DataFrame(encoder.transform(input_df_imputed_cat))
98
- #input_encoded_df.columns = input_encoded_df.columns.astype(str)
99
-
100
-
101
- #joining the cat encoded and num scaled
102
- # final_df = input_df_imputed
103
-
104
  # Make a prediction
105
  prediction = round(regressor.predict(input_df)[0], 2)
106
 
 
10
 
11
 
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  # Load the final model
15
  regressor = joblib.load("Best_model.joblib")
 
49
  # Convert the input data to a pandas DataFrame
50
  input_df = pd.DataFrame([input_data])
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  # Make a prediction
53
  prediction = round(regressor.predict(input_df)[0], 2)
54