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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started