Quiz for section 10 unit 9 and section 10 unit 11

Hi,
Answer contradicts with section 10, unit 9?

Course Name: Python for Machine Learning in Finance, Section No: 10, Unit No: 11, Unit type: Quiz

Hi RR,

Precision is a metric used to measure how accurate a model’s “positive” predictions are. In trading terms, this usually means checking how often a model’s “Buy” signals were actually correct.


What is Precision?

Precision answers this question:

Out of all the times the model said “Buy”, how many times was it actually right?

It does not care about missed opportunities (when it should have said “Buy” but didn’t), only about the correctness of the predictions it did make.


How to Calculate Precision:

The formula for precision is:

Precision = True Positives / (True Positives + False Positives)

Where:

  • True Positives (TP): Model predicted “Buy”, and the price actually went up.
  • False Positives (FP): Model predicted “Buy”, but the price did not go up.

Example from Confusion Matrix:

From the table:

Predicted: Do Not Buy Predicted: Buy
Actual: Price did NOT go up 50 20
Actual: Price went up 30 100

In this case:

  • True Positives = 100
  • False Positives = 20

Using the formula:

Precision = 100 / (100 + 20) = 100 / 120 = 0.8333

So the precision is 83.33%

This means that when the model gave a “Buy” signal, it was correct about 83% of the time.


Which Definition Best Matches Precision?

Let’s look at the options:

  1. The number of times the algorithm gave the buy signal divided by the total number of predictions. :x:
  2. The number of times the algorithm gave the buy signal divided by the number of times it gave the sell signal. :x:
  3. The number of times the algorithm gave the buy signal correctly divided by the total number of buy signals given by the algorithm. :white_check_mark:
  4. The number of times the algorithm gave the buy signal correctly divided by the actual number of times the price went up. :x:

:white_check_mark: Correct Answer: Option 3

This matches the formula for precision:

Precision = Correct Buy Predictions / All Buy Predictions


Summary:

  • Precision helps evaluate how trustworthy your model’s “Buy” signals are.
  • High precision means that when the model says “Buy”, it’s often right.
  • It’s useful when false positives (bad buys) are costly.
  • Precision ignores how many correct “Buy” signals were missed — that’s what Recall measures.

This taken from which AI powered chatbot?

This is drafted message with AI formatting. You can use any free available chatbots to respond in markdown code. Try prompt markdown {text} .

Hi,
See the confusion matrix.

Actual \ Predicted 0 1
0 (Negative) True Negative False Positive
1 (Positive) False Negative True Positive

Precision measures how many of the predicted buy signals were actually correct.
Precision = True Positive / (True Positive + False Positive)

Now using the same idea,

Precision for Buy = Buy signals predicted correctly (True Positive)/ Total Number of Buy signals given by the algorithm (True Positive+ False Positive)

Recall measures how many of the actual buy opportunities were correctly identified.
Recall = True Positive / (True Positive + False Negative)

So for our case,
Recall for Buy = Buy signals predicted correctly (True Positive) / Total Number of actual Buy opportunities (True Positive + False Negative)

So, both the answers in unit 9 and 11 are correct.

Noted and thanks for the answer.