Incorrect calculation of Precision and Recall score from

### Describe the bug

The values calculated for the precision and recall seems to be in opposite of each other. 

### Steps/Code to Reproduce

```
from sklearn.metrics import accuracy_score # Accuracy = (TP + TN) / (TP + TN + FP + FN)
from sklearn.metrics import precision_score # Precision = TP / (TP + FN)
from sklearn.metrics import recall_score # Recall = TP / (TP + FP)

acc = accuracy_score(y_test, y_pred)
prec = precision_score(y_test, y_pred)
recall = recall_score(y_test, y_pred)

print(f"Accuracy: {acc}")
print(f"Precision: {prec}")
print(f"Recall: {recall}")
```
```
y_test	0	1
y_pred		
0	80	18
1	14	31
```

Accuracy: 0.7762237762237763
Precision: 0.6326530612244898
Recall: 0.6888888888888889


### Expected Results

The values for Precision and Recall scores are incorrect. The commands from the library returns the values that are opposite of each other.

### Actual Results

```
pred_results_cross_tab = pd.crosstab(pred_results.y_pred, pred_results.y_test)
display(pred_results_cross_tab) # Confusion matrix
TP = pred_results_cross_tab[1][1]
TN = pred_results_cross_tab[0][0]
FP = pred_results_cross_tab[1][0]
FN = pred_results_cross_tab[0][1]

accuracy = (TP + TN) / (TP + TN + FP + FN)
precision = TP / (TP + FP)
recall = TP / (TP + FN)

print(f"Accuracy: {accuracy}")
print(f"Precision: {precision}")
print(f"Recall: {recall}")
```

Accuracy: 0.7762237762237763
Precision: 0.6888888888888889
Recall: 0.6326530612244898

### Versions

```shell
System:
    python: 3.12.5 (tags/v3.12.5:ff3bc82, Aug  6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)]
executable: c:\Users\Ming Xian\AppData\Local\Programs\Python\Python312\python.exe
   machine: Windows-11-10.0.22631-SP0

Python dependencies:
      sklearn: 1.4.1.post1
          pip: 24.2
   setuptools: 69.2.0
        numpy: 1.26.4
        scipy: 1.12.0
       Cython: 3.0.11
       pandas: 2.2.1
   matplotlib: 3.9.1.post1
       joblib: 1.3.2
threadpoolctl: 3.4.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
    num_threads: 16
         prefix: vcomp
       filepath: C:\Users\Ming Xian\AppData\Local\Programs\Python\Python312\Lib\site-packages\sklearn\.libs\vcomp140.dll
        version: None

       user_api: blas
   internal_api: openblas
    num_threads: 16
         prefix: libopenblas
       filepath: C:\Users\Ming Xian\AppData\Local\Programs\Python\Python312\Lib\site-packages\numpy.libs\libopenblas64__v0.3.23-293-gc2f4bdbb-gcc_10_3_0-2bde3a66a51006b2b53eb373ff767a3f.dll
        version: 0.3.23.dev
threading_layer: pthreads
   architecture: Zen

       user_api: blas
   internal_api: openblas
    num_threads: 16
         prefix: libopenblas
       filepath: C:\Users\Ming Xian\AppData\Local\Programs\Python\Python312\Lib\site-packages\scipy.libs\libopenblas_v0.3.20-571-g3dec11c6-gcc_10_3_0-c2315440d6b6cef5037bad648efc8c59.dll
        version: 0.3.21.dev
threading_layer: pthreads
   architecture: Zen
```

COMMENT:
I hand-crafted an example to show that there is no mistake in scikit-learn:

```python
from sklearn.metrics import precision_score, recall_score, ConfusionMatrixDisplay

y_true = [0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1]
y_test = [0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0]

disp = ConfusionMatrixDisplay.from_predictions(y_true, y_test)


def manual_precision_recall(confusion_matrix):
    # precision => TP / (TP + FP)
    precision = confusion_matrix[1, 1] / (confusion_matrix[1, 1] + confusion_matrix[0, 1])
    # recall => TP / (TP + FN)
    recall = confusion_matrix[1, 1] / (confusion_matrix[1, 1] + confusion_matrix[1, 0])
    return precision, recall
    

print(
    f"Manual precision-recall: "
    f"{manual_precision_recall(disp.confusion_matrix)}"
)
print(
    f"Scikit-learn precision-recall: "
    f"{(precision_score(y_true, y_test), recall_score(y_true, y_test))}"
)
```

<img width="510" alt="image" src="https://github.com/user-attachments/assets/fa75477d-6170-4ad0-8924-b892d71704d7">

```
Manual precision-recall: (0.3333333333333333, 0.16666666666666666)
Scikit-learn precision-recall: (0.3333333333333333, 0.16666666666666666)
```

From the code that you show, it seems that you error is when you build the confusion matrix:

```
pred_results_cross_tab = pd.crosstab(pred_results.y_pred, pred_results.y_test)
```

You inverted `y_pred`, `y_test` and thus inverted the FP, FN.

Labels: Bug, Needs Triage