Before trusting any classifier, you need to know what it has to beat. A model that reaches 92 percent accuracy sounds strong until you notice that 92 percent of the labels were the same class. The majority-class baseline predicts the most frequent training label for every example. Any real model should clear it.
Implement majority_class_baseline(y_train, n_samples), which returns an array of length n_samples filled with the most frequent label in y_train.
y_train must not be empty: raise ValueError.y_train.y_train.Open one at a time. Each gives away a little more than the last.
np.unique(y_train, return_counts=True) gives sorted labels and their counts.
np.argmax returns the first index of the maximum, which is the smallest tied label after sorting.
No results yet
Run your code to check it against the examples, or submit to run every test.