Answers.Body: <p>You could maybe do something like this, it's a bit hackish
  <span class="math-container">\begin{equation}
  y = C_1\cdot 1 + C_2 \cdot 0.5 + C_3 \cdot 0
  \end{equation}</span>
  <span class="math-container">$y$</span> represents the output and its bounded <span class="math-container">$\in [0, 1]$</span>. <span class="math-container">$C_i$</span> is probability for class <span class="math-container">$i$</span>. This way when <span class="math-container">$C_1 \approx 1, C_2 \approx 0, C_3 \approx 0$</span> you have
  <span class="math-container">\begin{equation}
   y \approx 1\cdot 1 + 0.5 \cdot 0 + 0 \cdot 0 \approx 1
  \end{equation}</span>
  when <span class="math-container">$C_1 \approx 0, C_2 \approx 1, C_3 \approx 0 $</span> you have
  <span class="math-container">\begin{equation}
   y \approx 1\cdot 0 + 0.5 \cdot 1 + 0 \cdot 0 \approx 0.5
  \end{equation}</span>
  and when <span class="math-container">$C_1 \approx 0, C_2 \approx 0, C_3 \approx 1 $</span> you have
  <span class="math-container">\begin{equation}
   y \approx 1\cdot 0 + 0.5 \cdot 0 + 0 \cdot 1 \approx 0
  \end{equation}</span></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-23T15:34:02.647Z
Answers.Text: Thats what I thought to do and it would work in best scenario. If C1 = 0.5 and C3 = 0.5, then the y would be 0.5, which would be incorrect. Sorry, if I wasnt clear in the begining, the predicted probalitites for each class can be between 0 to 1, not just binary.
Answers.UserDisplayName: user1631306
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-23T15:35:56.867Z
Answers.Text: Right, the assumption is that model is well trained. If you have a model that gives you 50%-50% you might want to train a better model.
Answers.UserDisplayName: Brale
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-23T15:43:18.637Z
Answers.Text: @user1631306: What is the *correct* result for you if "If C1 = 0.5 and C3 = 0.5"? You say that a value of 0.5 would be incorrect. So what would you want the output to be, and why?
Answers.UserDisplayName: Neil Slater
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-23T16:06:08.603Z
Answers.Text: Alternatively, you could replace softmax with sigmoid and change labels for classes to 0, 0.5, 1. That's the only other solution I can think of because I'm not sure if there is practical way to make bijection  from $R^3 \rightarrow R$ without doing some more abstract mathematical constructions.
Answers.UserDisplayName: Brale
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-23T16:10:49.063Z
Answers.Text: @Brale_: I should be ready for the worse scenario. Model usually predicts with high probability. But these are cell assay images and they are bound to have nearly equal probabilites in two or more classes.
Answers.UserDisplayName: user1631306
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-23T16:13:24.107Z
Answers.Text: @NeilSlater I dont know either. but on second thought, that shouldnt even happen. It should be a tie between two adjacent classes not on extreme, in my model. The classes are progressive. So, either it there would be tie between C1 and C2 or C2 and C3.
Answers.UserDisplayName: user1631306
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-23T16:19:43.290Z
Answers.Text: @user1631306: Your objection to this answer does not stand then, and it should work for you. Or you need to state a clearer goal for some example cases that show what you want
Answers.UserDisplayName: Neil Slater
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-23T18:43:13.813Z
Answers.Text: @NeilSlater I agree with you
Answers.UserDisplayName: user1631306
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-23T15:25:02.097Z
Answers.LastActivityDate: 2019-12-23T15:25:02.097Z
Answers.UserDisplayName: Brale
Answers.Body: <p>In such cases, you can have just 1 final neuron and treat the problem as a regression problem where the output distance from all 3 classes is calculated and the class with least distance becomes the predicted class.</p>
  
  <p>If you want independent values for 3 classes (such as [0.8, 0.5, 0.3]) which don't add up to 1, (something like multilabel/multiclass classification), you can use sigmoid in such cases( you won't get the probability ).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-23T16:16:03.427Z
Answers.Text: I am not worried about predicted class, thats been taken care of. I was wondering if somehow I could normalize the probablity score. Seems like I might be on wrong track and I am not asking the question correctly.
Answers.UserDisplayName: user1631306
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-23T16:09:48.867Z
Answers.LastActivityDate: 2019-12-23T16:09:48.867Z
Answers.UserDisplayName: SajanGohil
Body: <p>I have trained a multi-class CNN model using <a href="https://www.fast.ai/" rel="nofollow noreferrer">fastai</a>. The model splits out probabilites for each of the three classes, which, of course, sum up to 1. The class with highest probability becomes the predicted class. </p>
  
  <p>Is there any way I can convert them into 0 to 1 scale, where near to 0 value would mean class 1, near to 0.5 would mean class 2 and near to 1 would mean class 3?</p>
  
Tags: <convolutional-neural-networks><probability>
Title: How can I convert the probability score between 0 to 1 to another format?
UserDisplayName: user1631306
ThreadText: # How can I convert the probability score between 0 to 1 to another format?
  
  (Asked by: username_0 on 2019-12-23)
  
  I have trained a multi-class CNN model using [fastai](https://www.fast.ai/). The model splits out probabilites for each of the three classes, which, of course, sum up to 1. The class with highest probability becomes the predicted class.
  
  Is there any way I can convert them into 0 to 1 scale, where near to 0 value would mean class 1, near to 0.5 would mean class 2 and near to 1 would mean class 3?
  
  **Tags:** convolutional-neural-networks, probability
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-12-23. Score: 1 | Accepted answer
  
  You could maybe do something like this, it's a bit hackish
  \begin{equation}
  y = C\_1\cdot 1 + C\_2 \cdot 0.5 + C\_3 \cdot 0
  \end{equation}
  $y$ represents the output and its bounded $\in [0, 1]$. $C\_i$ is probability for class $i$. This way when $C\_1 \approx 1, C\_2 \approx 0, C\_3 \approx 0$ you have
  \begin{equation}
  y \approx 1\cdot 1 + 0.5 \cdot 0 + 0 \cdot 0 \approx 1
  \end{equation}
  when $C\_1 \approx 0, C\_2 \approx 1, C\_3 \approx 0 $ you have
  \begin{equation}
  y \approx 1\cdot 0 + 0.5 \cdot 1 + 0 \cdot 0 \approx 0.5
  \end{equation}
  and when $C\_1 \approx 0, C\_2 \approx 0, C\_3 \approx 1 $ you have
  \begin{equation}
  y \approx 1\cdot 0 + 0.5 \cdot 0 + 0 \cdot 1 \approx 0
  \end{equation}
  
  > **Comments:**
  > **username_0**: Thats what I thought to do and it would work in best scenario. If C1 = 0.5 and C3 = 0.5, then the y would be 0.5, which would be incorrect. Sorry, if I wasnt clear in the begining, the predicted probalitites for each class can be between 0 to 1, not just binary.  
  > **username_1**: Right, the assumption is that model is well trained. If you have a model that gives you 50%-50% you might want to train a better model.  
  > **username_2**: @user1631306: What is the *correct* result for you if "If C1 = 0.5 and C3 = 0.5"? You say that a value of 0.5 would be incorrect. So what would you want the output to be, and why?  
  > **username_1**: Alternatively, you could replace softmax with sigmoid and change labels for classes to 0, 0.5, 1. That's the only other solution I can think of because I'm not sure if there is practical way to make bijection  from $R^3 \rightarrow R$ without doing some more abstract mathematical constructions.  
  > **username_0**: @Brale_: I should be ready for the worse scenario. Model usually predicts with high probability. But these are cell assay images and they are bound to have nearly equal probabilites in two or more classes.  
  > **username_0**: @NeilSlater I dont know either. but on second thought, that shouldnt even happen. It should be a tie between two adjacent classes not on extreme, in my model. The classes are progressive. So, either it there would be tie between C1 and C2 or C2 and C3.  
  > **username_2**: @user1631306: Your objection to this answer does not stand then, and it should work for you. Or you need to state a clearer goal for some example cases that show what you want  
  > **username_0**: @NeilSlater I agree with you  
  
  ---
  
  ### Answer by username_3 on 2019-12-23. Score: 0
  
  In such cases, you can have just 1 final neuron and treat the problem as a regression problem where the output distance from all 3 classes is calculated and the class with least distance becomes the predicted class.
  
  If you want independent values for 3 classes (such as [0.8, 0.5, 0.3]) which don't add up to 1, (something like multilabel/multiclass classification), you can use sigmoid in such cases( you won't get the probability ).
  
  > **Comments:**
  > **username_0**: I am not worried about predicted class, thats been taken care of. I was wondering if somehow I could normalize the probablity score. Seems like I might be on wrong track and I am not asking the question correctly.  
  
  ---
  
  