Hemg commited on
Commit
fa04a9f
·
verified ·
1 Parent(s): f3d3244

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -57,13 +57,17 @@ def predict_performance(Location, Course, College, Faculty, Source, Event, Prese
57
  scaled_input = scaler.transform(df)
58
 
59
  # Make the prediction
60
- prediction = model.predict_proba(scaled_input)[0][1] # Get probability for positive class
61
 
62
- # Debug print 4: Show prediction details
63
- print("\nPrediction details:")
64
- print(f"Probability: {prediction}")
65
 
 
66
  prediction_percentage = prediction * 100
 
 
 
 
67
  print(f"Percentage: {prediction_percentage}")
68
 
69
  return f"Chance of Admission: {prediction_percentage:.1f}%"
 
57
  scaled_input = scaler.transform(df)
58
 
59
  # Make the prediction
60
+ prediction = model.predict(scaled_input)[0]
61
 
62
+ # Clip the prediction to be between 0 and 1
63
+ prediction = np.clip(prediction, 0, 1)
 
64
 
65
+ # Convert to percentage
66
  prediction_percentage = prediction * 100
67
+
68
+ # Debug print
69
+ print("\nPrediction details:")
70
+ print(f"Raw prediction: {prediction}")
71
  print(f"Percentage: {prediction_percentage}")
72
 
73
  return f"Chance of Admission: {prediction_percentage:.1f}%"