Mpavan45 commited on
Commit
7358212
·
verified ·
1 Parent(s): 21d136e

Update pages/4_Model Creation and Evaluation.py

Browse files
pages/4_Model Creation and Evaluation.py CHANGED
@@ -12,7 +12,7 @@ import optuna
12
  st.markdown("<h1 style='text-align:center; color:purple;'>Model Creation and Evaluation</h1>", unsafe_allow_html=True)
13
 
14
  # # Background Styling
15
- background_image_url = "https://cdn-uploads.huggingface.co/production/uploads/675fab3a2d0851e23d23cad3/uuRffDOdqb_CQPlKm3_J5.jpeg"
16
  # # Apply custom CSS for the background image and overlay
17
  st.markdown(
18
  f"""
@@ -145,13 +145,19 @@ st.code(code_3, language='python')
145
  st.subheader("Step 4: Model Training with Best Parameters")
146
 
147
  # Code for Model Training
148
- code_4 = """
149
- # Model Training with Best Parameters
150
- # Use the hyperparameters obtained from Optuna
151
  solver = 'newton-cg'
152
  penalty = 'l2'
153
  C = 999.8628541436512
154
 
 
 
 
 
 
 
 
 
155
  # Initialize Logistic Regression model with the best hyperparameters
156
  model = LogisticRegression(C=C, solver=solver, penalty=penalty, multi_class="multinomial", max_iter=500)
157
 
@@ -165,6 +171,9 @@ st.code(code_4, language='python')
165
  model = LogisticRegression(C=C, solver=solver, penalty=penalty, max_iter=500)
166
  model.fit(x_train_std, y_train)
167
 
 
 
 
168
  st.write("Model has been trained successfully!")
169
 
170
  # Code and Output 5: Model Evaluation
 
12
  st.markdown("<h1 style='text-align:center; color:purple;'>Model Creation and Evaluation</h1>", unsafe_allow_html=True)
13
 
14
  # # Background Styling
15
+ background_image_url = "https://cdn-uploads.huggingface.co/production/uploads/675fab3a2d0851e23d23cad3/MaLU-6gHwU70lZ-t_P94p.jpeg"
16
  # # Apply custom CSS for the background image and overlay
17
  st.markdown(
18
  f"""
 
145
  st.subheader("Step 4: Model Training with Best Parameters")
146
 
147
  # Code for Model Training
148
+ # Define hyperparameters first
 
 
149
  solver = 'newton-cg'
150
  penalty = 'l2'
151
  C = 999.8628541436512
152
 
153
+ # Code for Model Training
154
+ code_4 = f"""
155
+ # Model Training with Best Parameters
156
+ # Use the hyperparameters obtained from Optuna
157
+ solver = '{solver}'
158
+ penalty = '{penalty}'
159
+ C = {C}
160
+
161
  # Initialize Logistic Regression model with the best hyperparameters
162
  model = LogisticRegression(C=C, solver=solver, penalty=penalty, multi_class="multinomial", max_iter=500)
163
 
 
171
  model = LogisticRegression(C=C, solver=solver, penalty=penalty, max_iter=500)
172
  model.fit(x_train_std, y_train)
173
 
174
+ st.write("Model has been trained successfully!")
175
+
176
+
177
  st.write("Model has been trained successfully!")
178
 
179
  # Code and Output 5: Model Evaluation