当前位置:网站首页>激活函数之阶跃函数
激活函数之阶跃函数
2022-04-23 11:36:00 【小嘿黑15斤】
阶跃函数
阶跃函数以 0 为界,输出从 0 切换为 1(或者从 1 切换为 0)。它的值呈阶梯式变化,所以称为阶跃函数。
import matplotlib.pyplot as plt
import numpy as np
def step_function(x):
y = x>0
print(y.shape,y.dtype)
return y.astype(np.int32)
# def step_function(x):
# print(x>0)
# return np.array(x>0,dtype=np.int32)
if __name__ == '__main__':
x = np.arange(-5,5,0.1)
y = step_function(x)
plt.plot(x,y)
plt.ylim(-0.1,1.1)
plt.show()
执行结果:
(100,) bool
版权声明
本文为[小嘿黑15斤]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_45590490/article/details/124359764
边栏推荐
- 解析社交性机器人对基础科学的作用
- Mysql database transaction example tutorial
- The listing of saiweidian Technology Innovation Board broke: a decrease of 26% and the market value of the company was 4.4 billion
- TclError: no display name and no $DISPLAY environment variable
- Docker MySQL master-slave backup
- 简易投票系统数据库设计
- Nacos Foundation (8): login management
- 解读机器人创造出来的艺术
- Share two practical shell scripts
- Learning go language 0x02: understanding slice
猜你喜欢
Design and practice of the smallest short website system in the whole network
Exploring the equipment and teaching of robot education
远程访问家里的树莓派(上)
Write console script by laravel
解读机器人创造出来的艺术
PDMS soft lithography process
PSCP 基本使用
Overall plan management mode in maker Education
Redis学习之五---高并发分布式锁实战
laravel编写Console脚本
随机推荐
一文详解头部位姿估计【收藏好文】
让中小学生在快乐中学习的创客教育
Database design of simple voting system
Tensorflow common functions
Analyze the rules for the use of robots with good performance
MySQL8. 0 upgraded stepping on the pit Adventure
Laravel绑定钉钉群警报(php)
QT 怎么把QWigdet变成QDialog
QT 64 bit static version display gif
AcWing 1874. Moo encryption (enumeration, hash)
Tensorflow uses keras to create neural networks
Redis optimization series (II) redis master-slave principle and master-slave common configuration
零钱兑换II——【LeetCode】
配电房远程综合监控系统在10kV预制舱项目中的应用
GPU, CUDA,cuDNN三者的关系总结
解读机器人编程课程的生物认知度
Applet payment
小程序 支付
MQ is easy to use in laravel
MySQL Router重装后重新连接集群进行引导出现的——此主机中之前已配置过的问题