pyqt_data_analysis/libdataanalysis/8-Kmeans代码实现/utils/hypothesis/sigmoid_gradient.py

10 lines
218 B
Python
Raw Normal View History

2024-06-08 19:26:36 +08:00
"""Sigmoid gradient function"""
from .sigmoid import sigmoid
def sigmoid_gradient(matrix):
"""Computes the gradient of the sigmoid function evaluated at z."""
return sigmoid(matrix) * (1 - sigmoid(matrix))