小编Ahm*_*ssa的帖子

为什么门控激活函数(在 Wavenet 中使用)比 ReLU 效果更好?

我最近一直在阅读 Wavenet 和 PixelCNN 的论文,在这两篇论文中,他们都提到使用门控激活函数比 ReLU 效果更好。但在这两种情况下,他们都解释了为什么会这样。

我曾在其他平台(如 r/machinelearning)上问过,但到目前为止我还没有得到任何答复。可能是他们只是(偶然)尝试了这个替代品,结果却产生了良好的结果?

参考函数: y = tanh(Wk,f ? x) 。?(Wk,g ? x)

卷积的 sigmoid 和 tanh 之间的元素乘法。

machine-learning neural-network deep-learning activation-function

10
推荐指数
1
解决办法
1157
查看次数

在没有numpy polyfit的情况下在python中拟合二次函数

我正在尝试将二次函数拟合到某些数据,并且尝试不使用numpy的polyfit函数来执行此操作。

从数学上讲,我试图遵循此网站https://neutrium.net/mathematics/least-squares-fitting-of-a-polynomial/,但我不知为何我做对了。如果有人可以帮助我,那就太好了;或者,如果您可以建议另一种方法,那也很棒。

到目前为止,我已经尝试过:

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

ones = np.ones(3)
A = np.array( ((0,1),(1,1),(2,1)))
xfeature = A.T[0]
squaredfeature = A.T[0] ** 2
b = np.array( (1,2,0), ndmin=2 ).T
b = b.reshape(3)

features = np.concatenate((np.vstack(ones), np.vstack(xfeature), np.vstack(squaredfeature)), axis = 1)
featuresc = features.copy()
print(features)
m_det = np.linalg.det(features)
print(m_det)
determinants = []
for i in range(3):
    featuresc.T[i] = b
    print(featuresc)
    det = np.linalg.det(featuresc)
    determinants.append(det)
    print(det)
    featuresc = features.copy()

determinants = determinants / …
Run Code Online (Sandbox Code Playgroud)

python regression numpy curve-fitting

6
推荐指数
1
解决办法
456
查看次数

使现有的 conda 环境可供其他项目使用

我一直在 Conda 环境中使用 PyCharm 开发一个项目。现在我想开始一个新项目并使其使用相同的conda 环境。

当我第一次在 PyCharm 中创建初始环境时,我没有选中提到的复选框make available to all projects,因此它自然不会显示在 PyCharn 中的现有环境列表中。在谷歌搜索并筛选 PyCharm 解释器设置后,我找不到解决方案。

如何使现有的 conda 环境可供其他项目使用?抱歉,如果这是一个愚蠢的问题。

pycharm conda

6
推荐指数
2
解决办法
2710
查看次数

检测图像中的水平线

问题: 我正在处理一个包含许多看起来像这样的图像的数据集:

图像2 图像1

现在我需要将所有这些图像水平或垂直定向,以便调色板位于图像的底部或右侧。这可以通过简单地旋转图像来完成,但棘手的部分是弄清楚哪些图像应该旋转,哪些不应该旋转。

我尝试过的:

我认为最好的方法是检测将调色板与图像分开的白线。我决定旋转底部带有调色板的所有图像,使其位于右侧。

# yes I am mixing between PIL and opencv (I like the PIL resizing more)
# resize image to be 128 by 128 pixels
img = img.resize((128, 128), PIL.Image.BILINEAR)
img = np.array(img)

# perform edge detection, not sure if these are the best parameters for Canny
edges = cv2.Canny(img, 30, 50, 3, apertureSize=3)

has_line = 0

# take numpy slice of the area where the white line usually is 
# (not always exactly in the …
Run Code Online (Sandbox Code Playgroud)

python opencv image python-imaging-library

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