Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python
Python
  1. วิธีสร้าง Histogram ด้วย Matplotlib และ Python

    Matplotlib เป็นแพ็กเกจ Python ยอดนิยมสำหรับ Data Visualization ช่วยเข้าใจข้อมูลโดยไม่ต้องมองตัวเลขหรือคำนวณซับซ้อน และสื่อสารข้อมูลเชิงปริมาณได้อย่างมีประสิทธิภาพ สร้างกราฟ 2 มิติ ด้วย Object-oriented API รองรับ IPython, Jupyter, Spyder ฯลฯ เขียนด้วย Python บน NumPy การติดตั้งและ Dependencies pip i

  2. วิธีใช้ Keras ดึงและนำโหนดในกราฟเลเยอร์ไปใช้ซ้ำด้วย Python

    Keras พัฒนาขึ้นภายใต้โครงการ ONEIROS (Open-ended Neuro-Electronic Intelligent Robot Operating System) เป็น Deep Learning API ระดับสูง เขียนด้วย Python ให้อินเทอร์เฟซที่ใช้งานได้ผลลัพธ์รวดเร็ว รันบน TensorFlow รองรับการขยายสเกล (Scalable) และ Cross-platform (รันบน TPU, GPU clusters, เว็บเบราว์เซอร์,

  3. วิธีพล็อตกราฟหลายกราฟใน Figure เดียวกันด้วย Matplotlib และ Python

    Matplotlib เป็นแพ็กเกจ Python ยอดนิยมที่ใช้สำหรับการแสดงข้อมูล (Data Visualization) การแสดงข้อมูลเป็นขั้นตอนสำคัญ เนื่องจากช่วยให้เข้าใจลักษณะข้อมูลได้โดยไม่ต้องมองตัวเลขหรือคำนวณซับซ้อน และช่วยสื่อสารข้อมูลเชิงปริมาณให้ผู้ชมเข้าใจได้อย่างมีประสิทธิภาพ ภาพรวมของ Matplotlib Matplotlib ใช้สร้างกราฟ 2

  4. ตัวอย่างการใช้ tf.keras.layers.Dense แบบพื้นฐานใน Python

    บทนำtf.keras.layers.Dense คือ Fully Connected Layer พื้นฐานของ Neural Network สร้างได้จาก Custom Layer ด้วยการ Override build, callการติดตั้งpip install tensorflowตัวอย่างโค้ด (Custom Dense Layer)from tensorflow import keras from tensorflow.keras import layers import tensorflow as tf class CustomDe

  5. วิธีใช้ Subplot สร้าง 2 กราฟใน Figure เดียวด้วย Matplotlib ใน Python

    บทนำฟังก์ชัน subplot (pyplot interface) สร้าง Grid ของ Subplots อย่างรวดเร็ว รูปแบบ subplot(nrows, ncols, index)การติดตั้งpip install matplotlibDependencies=3.4, NumPy, Setuptools, Pyparsing, Libpng, Pytz, FreeType, Six, Cycler, Dateutilตัวอย่างโค้ดimport numpy as np import matplotlib.pyplot as plt

  6. วิธีแสดง Bivariate Distribution ด้วย imshow ใน Matplotlib Python

    บทนำBivariate Distribution แสดงความน่าจะเป็นร่วมของตัวแปรสุ่มอิสระ 2 ตัว ใช้ imshow แสดงเป็น Heatmap/Intensity Plotการติดตั้งpip install matplotlibDependencies=3.4, NumPy, Setuptools, Pyparsing, Libpng, Pytz, FreeType, Six, Cycler, Dateutilตัวอย่างโค้ดimport numpy as np import matplotlib.cm as cm im

  7. วิธีใช้ TensorFlow/Keras ดึง Constructor Arguments ของ Layer Instance ใน Python

    บทนำKeras Functional API ช่วยสร้างโมเดลที่ยืดหยุ่น (Non-linear topology, Shared layers, Multi I/O) ใช้ get_config() เพื่อ Serialize Layer Configurationการติดตั้งpip install tensorflowตัวอย่างโค้ดfrom tensorflow import keras from tensorflow.keras import layers import tensorflow as tf class CustomDen

  8. วิธีแสดง Pie Chart ด้วย Matplotlib ใน Python

    บทนำPie Chart แสดงสัดส่วนข้อมูลเป็นเปอร์เซ็นต์ในวงกลม ใช้ ax.pie()การติดตั้งpip install matplotlibDependencies=3.4, NumPy, Setuptools, Pyparsing, Libpng, Pytz, FreeType, Six, Cycler, Dateutilตัวอย่างโค้ดimport matplotlib.pyplot as plt labels = Label_1, Label_2, Label_3 sizes = [10, 34, 56] explode

  9. วิธีใช้ Keras ดาวน์โหลดและสำรวจ Dataset StackOverflow สำหรับ Tag Prediction (ฉบับสมบูรณ์)

    บทนำKeras High-level API รันบน TensorFlow รองรับ Cross-platform (TPU, GPU, Mobile, Web) มี Dataset Built-in และ Utilities ดาวน์โหลดการติดตั้งpip install tensorflow pip install tensorflow-textตัวอย่างโค้ดimport collections, pathlib, re, string import tensorflow as tf from tensorflow.keras import laye

  10. วิธีแสดง Stacked Bar Chart ด้วย Matplotlib ใน Python

    บทนำStacked Bar Chart แสดงส่วนประกอบสะสมของหลายหมวดหมู่ในแท่งเดียว ใช้ bottom พารามิเตอร์ซ้อนแท่งการติดตั้งpip install matplotlibDependencies=3.4, NumPy, Setuptools, Pyparsing, Libpng, Pytz, FreeType, Six, Cycler, Dateutilตัวอย่างโค้ดimport matplotlib.pyplot as plt labels = [A1, A2, A3, A4] val_1 =

  11. วิธีใช้ Keras ดาวน์โหลดและสำรวจชุดข้อมูล StackOverflow สำหรับ Tag Prediction ใน Python

    บทนำKeras (ใน TensorFlow) ให้ Utility ดาวน์โหลด Dataset ยอดนิยม รวมถึง StackOverflow 16k สำหรับงาน Tag Predictionการติดตั้งpip install tensorflow pip install tensorflow-textตัวอย่างโค้ดimport pathlib import tensorflow as tf from tensorflow.keras import utils data_url = https://storage.googleapis.co

  12. วิธีสร้าง Multiple Plots แบบ Iterative ด้วย Matplotlib ใน Python

    บทนำMatplotlib รองรับการสร้าง Subplots หลายแผนภูมิใน Figure เดียว ใช้ add_subplot หรือ add_axes สำหรับตำแหน่งกำหนดเองการติดตั้งpip install matplotlibDependencies=3.4, NumPy, Setuptools, Pyparsing, Libpng, Pytz, FreeType, Six, Cycler, Dateutilตัวอย่างโค้ดimport numpy as np import matplotlib.pyplot as

  13. วิธีสร้าง 3D Line Plot ด้วย Matplotlib ใน Python

    บทนำ3D Line Plot แสดงเส้นโค้งในพื้นที่ 3 มิติ ใช้ plot3D แทน plotการติดตั้งpip install matplotlibDependencies=3.4, NumPy, Setuptools, Pyparsing, Libpng, Pytz, FreeType, Six, Cycler, Dateutilตัวอย่างโค้ดfrom mpl_toolkits import mplot3d import numpy as np import matplotlib.pyplot as plt fig = plt.fig

  14. วิธีตรวจสอบว่า Absolute Difference ระหว่าง Node ติดกันใน Linked List เท่ากับ 1 ใน Python

    ปัญหาSingly Linked List เก็บจำนวนเต็ม ตรวจสอบว่า |ค่าปัจจุบัน - ค่าถัดไป| == 1 สำหรับทุกคู่ที่ติดกันตัวอย่าง: 5→6→7→8→7→6→5→4 → Trueแนวทางแก้ปัญหาเดินผ่าน List ด้วย Pointer tempตรวจสอบ abs(temp.val - temp.next.val) == 1หากมีคู่ไหนไม่ผ่าน คืน False ทันทีตัวอย่างโค้ดimport math class link_node: d

  15. วิธีใช้ TensorFlow โหลดชุดข้อมูล StackOverflow Questions ใน Python

    บทนำTensorFlow ให้ Utility text_dataset_from_directory โหลดข้อความจากโครงสร้างโฟลเดอร์ สร้าง Label ตามชื่อโฟลเดอร์การติดตั้งpip install tensorflowตัวอย่างโค้ดbatch_size = 32 seed = 42 raw_train_ds = preprocessing.text_dataset_from_directory( train_dir, batch_size=batch_size, validation_

  16. วิธีตรวจสอบว่า Tree 2 ต้นมีทุกระดับเป็น Anagrams กันใน Python

    ปัญหากำหนด Binary Tree 2 ต้น ตรวจสอบว่าแต่ละ Level (ระดับ) ของ Tree 1 เป็น Anagram ของ Level เดียวกันใน Tree 2 หรือไม่แนวทางแก้ปัญหา (BFS Level-order)ใช้ Queue 2 อัน สำหรับ Tree 1 และ 2ประมวลผลทีละ Level: ดึง Node ทั้ง Level, เก็บค่า, Push ลูกเข้า QueueSort ค่าทั้งสอง Level แล้วเปรียบเทียบตัวอย่างโค

  17. วิธีตรวจสอบว่าแถวทั้งหมดของ Matrix เป็น Circular Rotations ของกันใน Python

    ปัญหากำหนด Matrix n×n ตรวจสอบว่าแถวทุกแถวเป็น Circular Rotation ของแถวก่อนหน้า (แถวแรกเป็น Rotation ของแถวสุดท้าย)ตัวอย่าง 4×4: B A D C / C B A D / D C B A / A D C B → Trueแนวทางแก้ปัญหาสร้าง String concat จากแถวแรก (คั่นด้วย -)Duplicate: concat = concat + concatตรวจสอบว่า String ของแต่ละแถวถัดไป เป

  18. การนำ Mean Shift Algorithm ไปใช้ใน Python ด้วย scikit-learn

    บทนำMean Shift เป็น Clustering Algorithm แบบ Unsupervised Learning ไม่ต้องกำหนดจำนวน Cluster ล่วงหน้า (ต่างจาก K-Means) ทำงานโดยย้าย Data Points ไปยังจุดหนาแน่นที่สุด (Centroid) ซ้ำๆ จน收敛ขั้นตอน Mean Shiftกำหนดแต่ละ Data Point เป็น Cluster ของตัวเองหา Centroid ของแต่ละ Clusterอัปเดตตำแหน่ง Centroid

  19. วิธีใช้ TensorFlow Iterate ผ่าน Dataset และแสดงตัวอย่างข้อมูล StackOverflow ใน Python

    บทนำTensorFlow ใช้ text_dataset_from_directory โหลดข้อมูลข้อความจากโฟลเดอร์ สร้าง Label อัตโนมัติจากชื่อโฟลเดอร์ย่อยการติดตั้งpip install tensorflowตัวอย่างโค้ดbatch_size = 32 seed = 42 raw_train_ds = preprocessing.text_dataset_from_directory( train_dir, batch_size=batch_size, validatio

  20. วิธีสร้าง 3D Scatter Plot ด้วย Matplotlib ใน Python

    บทนำ3D Scatter Plot แสดงจุดข้อมูลในพื้นที่ 3 มิติ (x, y, z) ช่วยมองความสัมพันธ์ 3 ตัวแปรการติดตั้งpip install matplotlibDependencies=3.4, NumPy, Setuptools, Pyparsing, Libpng, Pytz, FreeType, Six, Cycler, Dateutilตัวอย่างโค้ดfrom mpl_toolkits import mplot3d import numpy as np import matplotlib.pyplo

Total 9001 -คอมพิวเตอร์  FirstPage PreviousPage NextPage LastPage CurrentPage:216/451  20-คอมพิวเตอร์/Page Goto:1 210 211 212 213 214 215 216 217 218 219 220 221 222