A simple question: how to get the most common matrix value?
The matrix is a specialized two-dimensional array that preserves its two-dimensional nature through operations.
This is a snippet of my whole implementation, so I decided to show you only the important parts related to my main question:
import numpy as np
...
from src.labelHandler import LabelHandler
from collections import Counter
def viewData(filePathList, labelHandler=None):
...
c = Counter(a)
print(c)
b = np.argmax(c)
print(b)
...
The conclusion will be:
{0.3: [(0, 0, 0), (0, 10, 0), (0, 11, 0), ...], 0.2: [(0, 18, 0), ...]}
Counter({0.3: 7435, 0.2: 6633, ...})
0
This is also a snippet from all of my output.
The important line is the last one with 0. The problem is that this is line (3).
b = np.argmax(c)
It just prints out the position of my highest value, which is at index 0. But I would like to return a float instead of an index.
How to solve this problem?
Thanks in advance!