python繪制高斯曲線
本文實(shí)例為大家分享了python繪制高斯曲線的具體代碼,供大家參考,具體內(nèi)容如下
源碼:
import numpy as npimport matplotlib.pyplot as pltimport mathimport mpl_toolkits.mplot3dimport tensorflow.compat.v1 as tftf.disable_v2_behavior()#import tensorflow as tffrom sklearn import datasetssess = tf.InteractiveSession()gamma = tf.constant(-1.0)x, y = np.mgrid[-2:2:0.01, -2:2:0.01]x_data = tf.placeholder(shape=[400, 400], dtype=tf.float32)y_data = tf.placeholder(shape=[400, 400], dtype=tf.float32)Kernel = tf.exp(tf.multiply(gamma, tf.add((x_data*x_data),(y_data*y_data))))Kernel = sess.run(Kernel, feed_dict={x_data: x,y_data: y})ax = plt.subplot(111, projection=’3d’)ax.plot_surface(x, y, Kernel, rstride=1, cstride=1, cmap=’rainbow’, alpha=0.9)#繪面ax.set_xlabel(’x’)ax.set_ylabel(’y’)ax.set_zlabel(’Kernel’)plt.show()
效果圖:

以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. JavaScript實(shí)現(xiàn)簡單的彈窗效果2. Java commons-httpclient如果實(shí)現(xiàn)get及post請(qǐng)求3. javascript實(shí)現(xiàn)貪吃蛇小練習(xí)4. 我所理解的JavaScript中的this指向5. Vue 實(shí)現(xiàn)對(duì)quill-editor組件中的工具欄添加title6. PHP驗(yàn)證碼工具-Securimage7. PHP單件模式和命令鏈模式的基礎(chǔ)知識(shí)8. 一文帶你徹底理解Java序列化和反序列化9. PHP利用curl發(fā)送HTTP請(qǐng)求的實(shí)例代碼10. js實(shí)現(xiàn)碰撞檢測

網(wǎng)公網(wǎng)安備