吳裕雄 python深度學習與實踐(4)
import numpy,math def softmax(inMatrix): m,n = numpy.shape(inMatrix) outMatrix = numpy.mat(numpy.zeros((m,n))) soft_sum = 0 for idx in range(0,n): outMatrix[0,idx] = math.exp(inMatrix[0,idx]) soft_sum += outMatrix[0,idx] for idx in range(0,n): outMatrix[0,idx]= outMatrix[0,idx] / soft_sum return outMatrix aa = numpy.matrix([1,2,3,4,5,4,3,9,8]) outMatrix = softmax(aa) print(outMatrix)
吳裕雄 python深度學習與實踐(4)
相關推薦
吳裕雄 python深度學習與實踐(4)
shape math ret sof clas bsp pre 深度學習 sha import numpy,math def softmax(inMatrix): m,n = numpy.shape(inMatrix) outMatrix = numpy
吳裕雄 python深度學習與實踐(1)
span 實踐 __init__ class col tar pri png self #coding = utf8 import threading,time count = 0 class MyThread(threading.Thread): def
吳裕雄 python深度學習與實踐(2)
global 技術 imp 深度學習 src dom utf sta elf #coding = utf8 import threading,time,random count = 0 class MyThread (threading.Thread): de
吳裕雄 python深度學習與實踐(3)
strftime print sleep .com 實踐 info str def col import threading, time def doWaiting(): print(‘start waiting:‘, time.strftime(‘%S‘))
吳裕雄 python深度學習與實踐(5)
sci import array pat size ipy csv ima sta import numpy as np data = np.mat([[1,200,105,3,False], [2,165,80,2,False],
吳裕雄 python深度學習與實踐(6)
pandas print sum and ylabel mar num mon pytho from pylab import * import pandas as pd import matplotlib.pyplot as plot import numpy as n
吳裕雄 python深度學習與實踐(9)
oba esc print eight on() http ict src oat import numpy as np import tensorflow as tf inputX = np.random.rand(100) inputY = np.multiply(
吳裕雄 python深度學習與實踐(10)
nbsp inpu mage all 網絡 mat mean info top import tensorflow as tf input1 = tf.constant(1) print(input1) input2 = tf.Variable(2,tf.int32
吳裕雄 python深度學習與實踐(11)
shape color puts axis plot img pac hid font import numpy as np from matplotlib import pyplot as plt A = np.array([[5],[4]]) C = np.arr
吳裕雄 python深度學習與實踐(16)
otl const and interact red 不同 .com rec 深度學習 import struct import numpy as np import matplotlib.pyplot as plt dateMat = np.ones((7
吳裕雄 python 機器學習-KNN演算法(1)
import numpy as np import operator as op from os import listdir def classify0(inX, dataSet, labels, k): dataSetSize = dataSet.shape[0] diffMat
吳裕雄 python 機器學習——人工神經網絡與原始感知機模型
res true 組成 param 個數 its import sample gen import numpy as np from matplotlib import pyplot as plt from mpl_toolkits.mplot3d impor
吳裕雄 python 機器學習-KNN算法(1)
files action ets %s set digits size ret src import numpy as np import operator as op from os import listdir def classify0(inX, dataSet,
吳裕雄 python 機器學習-DMT(2)
nod clas png split rom {} items port info import matplotlib.pyplot as plt decisionNode = dict(boxstyle="sawtooth", fc="0.8") leafNode =
吳裕雄 python 機器學習-DMT(1)
import numpy as np import operator as op from math import log def createDataSet(): dataSet = [[1, 1, 'yes'], [1, 1, 'yes'],
吳裕雄 python 機器學習——KNN回歸KNeighborsRegressor模型
sklearn sco endpoint matplot data create urn sting 學習 import numpy as np import matplotlib.pyplot as plt from sklearn import neighb
吳裕雄 python 機器學習——密度聚類DBSCAN模型
ted itl 機器學習 blob pri plt matplot space ase import numpy as np import matplotlib.pyplot as plt from sklearn import cluster from s
吳裕雄 python 機器學習——層次聚類AgglomerativeClustering模型
figure div fig ted app 中心 import pan clas import numpy as np import matplotlib.pyplot as plt from sklearn import cluster from skl
吳裕雄 python 機器學習——人工神經網絡感知機學習算法
感知 matplot subplot dom 評價 mark arange data turn import numpy as np from matplotlib import pyplot as plt from sklearn.neural_networ
吳裕雄 python 機器學習——人工神經網絡感知機學習算法的應用
sgd 加載 pyplot 樣本 rand 列表 mes gen port import numpy as np from matplotlib import pyplot as plt from sklearn import neighbors, datas