The XOR Wall by Grid Search

~12 mincode completion

Implement min_perceptron_errors(X, y, grid) returning the smallest error count, as a float, over all drawn from grid.

Where this shows up

~12 min

8 employers weight this skill

4 frontier labs, 2 big tech firms, 1 autonomy company, 1 enterprise vendor. Top match scores 93.

Python
import numpy as np


def min_perceptron_errors(X, y, grid):
    """
    Fewest mistakes a single perceptron makes over a grid of weights.

    Args:
        X:    inputs, shape (n, 2)
        y:    labels in {0, 1}, shape (n,)
        grid: candidate values for w1, w2 and b

    Returns:
        float: the minimum number of misclassified points
    """
    # YOUR CODE HERE
    pass
Loading docs…

The AI Mentor needs an account

It reads your code and the failing tests and nudges you toward the fix without handing you the answer. Free accounts get it on every problem you're working on today.