小编Tom*_*nar的帖子

使用多个隐藏层时神经网络的准确性非常差

我创建了以下神经网络:

def init_weights(m, n=1):
    """
    initialize a matrix/vector of weights with xavier initialization
    :param m: out dim
    :param n: in dim
    :return: matrix/vector of random weights
    """
    limit = (6 / (n * m)) ** 0.5
    weights = np.random.uniform(-limit, limit, size=(m, n))
    if n == 1:
        weights = weights.reshape((-1,))
    return weights


def softmax(v):
    exp = np.exp(v)
    return exp / np.tile(exp.sum(1), (v.shape[1], 1)).T


def relu(x):
    return np.maximum(x, 0)


def sign(x):
    return (x > 0).astype(int)


class Model:
    """
    A class for neural …
Run Code Online (Sandbox Code Playgroud)

python numpy backpropagation neural-network

5
推荐指数
1
解决办法
252
查看次数

标签 统计

backpropagation ×1

neural-network ×1

numpy ×1

python ×1