# Buggy code
def __init__(
    self,
    hidden_layer_sizes=(100,),
    activation="relu",
    solver="adam",
    alpha=0.0001,
    batch_size="auto",
    learning_rate="constant",
    learning_rate_init=0.001,
    power_t=0.5,
    max_iter=200,
    shuffle=True,
    random_state=None,
    tol=1e-4,
    verbose=False,
    warm_start=False,
    momentum=0.9,
    nesterovs_momentum=True,
    early_stopping=False,
    validation_fraction=0.1,
    beta_1=0.9,
    beta_2=0.999,
    epsilon=1e-8,
):
    sup = super(MLPClassifier, self)
    sup.__init__(
        hidden_layer_sizes=hidden_layer_sizes,
        activation=activation,
        solver=solver,
        alpha=alpha,
        batch_size=batch_size,
        learning_rate=learning_rate,
        learning_rate_init=learning_rate_init,
        power_t=power_t,
        max_iter=max_iter,
        loss="log_loss",
        shuffle=shuffle,
        random_state=random_state,
        tol=tol,
        verbose=verbose,
        warm_start=warm_start,
        momentum=momentum,
        nesterovs_momentum=nesterovs_momentum,
        early_stopping=early_stopping,
        validation_fraction=validation_fraction,
        beta_1=beta_1,
        beta_2=beta_2,
        epsilon=epsilon,
    )

    self.label_binarizer_ = LabelBinarizer()


# Traceback (ValueError)
Traceback (most recent call last):
File "fail.py", line 7, in <module>
clf.partial_fit([[4]],["d"])
File "/usr/local/lib/python3.4/dist-packages/sklearn/neural_network/multilayer_perceptron.py", line 989, in _partial_fit
super(MLPClassifier, self)._partial_fit(X, y)
File "/usr/local/lib/python3.4/dist-packages/sklearn/neural_network/multilayer_perceptron.py", line 640, in _partial_fit
return self._fit(X, y, incremental=True)
File "/usr/local/lib/python3.4/dist-packages/sklearn/neural_network/multilayer_perceptron.py", line 375, in _fit
intercept_grads, layer_units, incremental)
File "/usr/local/lib/python3.4/dist-packages/sklearn/neural_network/multilayer_perceptron.py", line 512, in _fit_stochastic
coef_grads, intercept_grads)
File "/usr/local/lib/python3.4/dist-packages/sklearn/neural_network/multilayer_perceptron.py", line 225, in _backprop
loss = LOSS_FUNCTIONS[self.loss](y, activations[-1])
File "/usr/local/lib/python3.4/dist-packages/sklearn/neural_network/_base.py", line 208, in log_loss
return -np.sum(y_true * np.log(y_prob)) / y_prob.shape[0]
ValueError: operands could not be broadcast together with shapes (1,2) (1,3)

# Fixed code
def __init__(
    self,
    hidden_layer_sizes=(100,),
    activation="relu",
    solver="adam",
    alpha=0.0001,
    batch_size="auto",
    learning_rate="constant",
    learning_rate_init=0.001,
    power_t=0.5,
    max_iter=200,
    shuffle=True,
    random_state=None,
    tol=1e-4,
    verbose=False,
    warm_start=False,
    momentum=0.9,
    nesterovs_momentum=True,
    early_stopping=False,
    validation_fraction=0.1,
    beta_1=0.9,
    beta_2=0.999,
    epsilon=1e-8,
):
    sup = super(MLPClassifier, self)
    sup.__init__(
        hidden_layer_sizes=hidden_layer_sizes,
        activation=activation,
        solver=solver,
        alpha=alpha,
        batch_size=batch_size,
        learning_rate=learning_rate,
        learning_rate_init=learning_rate_init,
        power_t=power_t,
        max_iter=max_iter,
        loss="log_loss",
        shuffle=shuffle,
        random_state=random_state,
        tol=tol,
        verbose=verbose,
        warm_start=warm_start,
        momentum=momentum,
        nesterovs_momentum=nesterovs_momentum,
        early_stopping=early_stopping,
        validation_fraction=validation_fraction,
        beta_1=beta_1,
        beta_2=beta_2,
        epsilon=epsilon,
    )