同步操作将从 编程语言算法集/Python 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
"""This script demonstrates the implementation of the Sigmoid function.The function takes a vector of K real numbers as input and then 1 / (1 + exp(-x)).After through Sigmoid, the element of the vector mostly 0 between 1. or 1 between -1.Script inspired from its corresponding Wikipedia articlehttps://en.wikipedia.org/wiki/Sigmoid_function"""import numpy as npdef sigmoid(vector: np.array) -> np.array:"""Implements the sigmoid functionParameters:vector (np.array): A numpy array of shape (1,n)consisting of real valuesReturns:sigmoid_vec (np.array): The input numpy array, after applyingsigmoid.Examples:>>> sigmoid(np.array([-1.0, 1.0, 2.0]))array([0.26894142, 0.73105858, 0.88079708])>>> sigmoid(np.array([0.0]))array([0.5])"""return 1 / (1 + np.exp(-vector))if __name__ == "__main__":import doctestdoctest.testmod()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。