博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
使用numpy.tanh()打印矢量/矩阵元素的双曲正切值 使用Python的线性代数
阅读量:2527 次
发布时间:2019-05-11

本文共 1574 字,大约阅读时间需要 5 分钟。

Prerequisite:

先决条件:

Numpy is the library of function that helps to construct or manipulate matrices and vectors. The function numpy.tanh(x) is a function used for generating a matrix / vector / variable with the Tangent Hyperbolic value of b x (as tanh(x)).

Numpy是一个功能库,可帮助构造或操纵矩阵和向量。 函数numpy.tanh(x)是用于生成正切双曲值为b x的矩阵/向量/变量(作为tanh(x) )的函数 。

Syntax:

句法:

numpy.tanh(x)

Input parameter(s):

输入参数:

  • x – could be a matrix or vector or a variable.

    x –可以是矩阵,向量或变量。

Return value:

返回值:

A Matrix or vector or a variable of the same dimensions as input x with tanh(x) values (between 0 and 1) at each entry.

与输入x尺寸相同的矩阵或向量或变量,每个条目处具有tanh(x)值(介于0和1之间)。

Applications:

应用范围:

  1. Machine Learning

    机器学习

  2. Neural Network

    神经网络

Python代码将向量/矩阵元素的双曲正切值 (Python code to hyperbolic tangent value of vector/matrix elements)

# Linear Algebra Learning Sequence# Printing hyperbolic tangent value of # vector/matrix elements using numpy.tanh()import numpy as np#Use of np.array() to define an VectorV = np.array([323,.623,823])print("The Vector A : ",V)VV = np.array([[3,63,.78],[.315,32,42]])print("\nThe Vector B : \n",VV)pro = V.dot(VV.T)print("\nProduct of two vectors : ", pro)    print("\ntanh(AB) : ", np.tanh(pro))print("\ntanh(A) : ", np.tanh(V))print("\ntanh(B) : \n", np.tanh(VV))

Output:

输出:

The Vector A :  [3.23e+02 6.23e-01 8.23e+02]The Vector B :  [[ 3.    63.     0.78 ] [ 0.315 32.    42.   ]]Product of two vectors :  [ 1650.189 34687.681]tanh(AB) :  [1. 1.]tanh(A) :  [1.         0.55321335 1.        ]tanh(B) :  [[0.99505475 1.         0.65270671] [0.30497892 1.         1.        ]]

翻译自:

转载地址:http://tyxzd.baihongyu.com/

你可能感兴趣的文章
js中“原生”map
查看>>
js中用字符串当变量名
查看>>
在IE中打开PDF
查看>>
Ext设置Radio选中,事件失效的问题
查看>>
mysql同表自我复制
查看>>
Ext4.2 grid(store)分页获取当前页,总页数,是否是最后一页
查看>>
js try catch finally语句 throw onerror
查看>>
java生成二维码QRCode Zxing SwetakeQRCode barcode4j
查看>>
Eclipse Maven 插件升级后classpath配置的变化
查看>>
js jquery.qrcode生成二维码 带logo 支持中文
查看>>
svn换ip地址重新定位TortoiseSVN,Eclipse
查看>>
eclipse生成boolean类型getter,setter,is开头的问题
查看>>
解决jquery ui dialog 标题为html显示样式问题
查看>>
jquery ui dialog 加载单独页面,不使用iframe
查看>>
jqGrid 取消选择事件onUnSelectRow ,取消全选事件onUnSelectAll
查看>>
jquery ui dialog 销毁删除html元素,清除缓存
查看>>
解决办法:java.net.SocketException: Address family not supported by protocol family:
查看>>
spring boot2 配置 log4j2
查看>>
springcloud eureka注册中心搭建
查看>>
springboot2 项目搭建
查看>>