Creating an If function for the probabilities of the classes of images after using NetTrain

So I have 3 Classes the model can output after veiwing an image, at the moment it has a 70% accuracy, however this is not an issue as the plan is unless it's 85%+ sure on the Probability of the class it will be marked as unsure and we will go back to classify in manually

I think using an Ifor := would work well just not sure how to extract the probabilies using Net[*image*,"Probabilities"] To create this option

• Can you be more clear about what logic you're wanting? Like, what's the condition the "if" needs to evaluate and what is the result when "true" and what is the result when "false". Commented Nov 3, 2023 at 14:31
• so the net will classify the image into having 3 probabilities equalling how likely it is to be in each class. So for my example the classes are metal, plastic and other. Now most of the time it says 0.9->plasitc, 0.09->metal, and 0.01-> other. This shows the network is pretty sure it's plastic. however when it gets below a threshold that i want to set at 0.85. I want it to say the network is unsure and this is when i would check the image myself Commented Nov 3, 2023 at 15:23
• So the "If" function should be true when no probabilities from the classifier are more than 0.85 and it should produce a new class where these results go into a class called unsure. Commented Nov 3, 2023 at 15:26
• Okay, so are you sure you wanted a NetChain as opposed to a ClassifierFunction? Commented Nov 3, 2023 at 15:59
• Yes I’m not sure the classify function Is smart enough to classify images that are of particles only 40 micro meters in diameter, therefore I’m using quite a complex neural network to classify these particles Commented Nov 4, 2023 at 23:25

so i found an answer after coming back to my problem, After recieving the probabilities from probs=net[*listOfImages*,"Probabilities"].(net is a pre trained neural network using NetChain & NetTrain) You can create the thresholds you want with a simple list thresholds = {0.5, 0.75, 0.75}. Then use an If function to say if the these probabilties are less than these thresholds class them into their own class
predictedClasses = If[#[[1]] >= thresholds[[1]], "class1", If[#[[2]] >= thresholds[[2]], "class2", If[#[[3]] >= thresholds[[3]], "class3", "newClass"]]] & /@ probs