Question: I have to create a loop that makes predictons. if the value is less than the threshold value the prediciton should be 0. If the

I have to create a loop that makes predictons. if the value is less than the threshold value the prediciton should be 0. If the threshold value is greater than the prediction should be 1. this is what i have but it isnt coming out right.

The predictions are = 0.886,0.375,0.174,0.817,0.574,0.319,0.812,0.314,0.098,0.741,0.847,0.202,0.31,0.073,0.179,0.917,0.64,0.388,0.116,0.72

threshold = 0.5

def predict(): probs = input("Input list of prediction probabilities: ") thresh = input("Input threshold value: ") list1 = probs.split(",") list2 = [] answer = [] for i in list1: if i < thresh: answer == 0 elif i > thresh: answer == 1 preds = list2.append(answer) print("Model Predictions: ", preds)

this is what i have but it is not working

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!