Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python
Python
  1. วิธีใช้ SciPy คำนวณ Inverse ของ Matrix ใน Python

    บางครั้งต้องคำนวณ inverse ของ matrix ใช้สำหรับการคำนวณต่อ ขั้นตอนหา inverse ด้วยมือ: 1) หา minors (determinant ของ submatrix) 2) หา cofactors (สลับเครื่องหมาย) 3) transpose 4) หารด้วย determinant ของ matrix ต้นฉบับ SciPy มีฟังก์ชัน inv ใน linalg ช่วยคำนวณง่ายขึ้น Syntax inv scipy.linalg.inv(matrix)

  2. วิธี fit ข้อมูลไม่เชิงเส้นให้เข้ากับโมเดลใน Python

    ใช้ Seaborn visualize ข้อมูล ต้องเช็ค multicollinearity สำหรับ regression ข้อมูลจริงมัก non-linear ต้อง fit โมเดล ใช้ Anscombes dataset lmplot ใช้กับ non-linear data ตัวอย่าง import pandas as pd import seaborn as sb from matplotlib import pyplot as plt my_df = sb.load_dataset(anscombe) sb.lmplot(x=x

  3. วิธีทำ L2 Normalization ด้วย scikit-learn ใน Python

    Normalization = แปลงช่วงค่าให้เป็นมาตรฐาน (-1 ถึง +1 หรือ 0 ถึง 1) ทำได้ด้วยการลบและหาร L2 Normalization = Least Squares ทำให้ sum of squares ของข้อมูลในแต่ละแถว = 1 ตัวอย่าง import numpy as np from sklearn import preprocessing input_data = np.array( [[34.78, 31.9, -65.5],[-16.5, 2.45, -83.5],[0

  4. วิธีแสดงข้อมูลภาพด้วย Seaborn Library ใน Python

    Machine learning สร้างโมเดลจากข้อมูล ข้อมูล input ควรเข้าใจง่าย Seaborn visualize ข้อมูล มี theme และ high-level interface ปรับแต่งรูปแบบและพฤติกรรมข้อมูล มี set_style() ตั้ง theme ของ plot ตัวอย่าง import numpy as np from matplotlib import pyplot as plt def sine_plot(flip=1): x = np.linspace(0,

  5. วิธีใช้ Seaborn แสดงข้อมูลโดยไม่มี background axis spines ใน Python

    Machine learning สร้างโมเดลจากข้อมูล ข้อมูล input ควรเข้าใจง่าย Visualizing ข้อมูลช่วยเข้าใจโดยไม่ต้องดูตัวเลขคำนวณซับซ้อน Seaborn มี interface ปรับแต่งรูปแบบข้อมูล ฟังก์ชัน despine ลบ background axis spines ออกจาก plot ตัวอย่าง import numpy as np from matplotlib import pyplot as plt def sin_plot(fl

  6. หลีกเลี่ยงจุดทับซ้อนใน Categorical Scatter Plot โดยไม่ใช้ jitter ใน Seaborn Python

    Seaborn visualize ข้อมูล stripplot: ตัวแปรอย่างน้อย 1 ตัวเป็น categorical ข้อมูลเรียงตามแกน แต่จุดอาจทับซ้อน ใช้ jitter parameter เพิ่ม noise ปรับตำแหน่ง แต่สามารถใช้ swarmplot แทนได้ Syntax swarmplot seaborn.swarmplot(x, y, data, ...) ตัวอย่าง import pandas as pd import seaborn as sb from matplotli

  7. วิธีใช้ Box และ Whisker Plot เปรียบเทียบข้อมูลใน Seaborn Python

    Seaborn visualize ข้อมูล Scatter plot ให้ข้อมูลจำกัด (แค่ distribution ใน category) ต้องการเปรียบเทียบข้าม categories ใช้ box plot เข้าใจการกระจายด้วย quartiles มี whiskers แสดงการกระจายนอก upper/lower quartiles เรียกว่า whisker plot outliers = จุดเดี่ยว Syntax boxplot seaborn.boxplot(x, y, data, ..

  8. สาธิตการทำงานของ Violin Plots ใน Python

    ต้องการเปรียบเทียบข้อมูลใน categories ใช้ box plot เข้าใจการกระจายด้วย quartiles มี whiskers (เส้นตั้ง) แสดงการกระจายนอก quartiles เรียกว่า whisker plot outliers แสดงเป็นจุดเดี่ยว Violin plot = box plot + KDE เข้าใจการกระจายง่ายกว่า ส่วนกว้าง = density สูง ส่วนแคบ = density ต่ำ IQR และ high density

  9. วิธีแยก Violin ทุกตัวใน Violin Plot ด้วย Seaborn Python

    Seaborn visualize ข้อมูล Violin plot = box plot + kernel density estimates (KDE) เข้าใจการกระจายข้อมูลง่าย ส่วนกว้าง = density สูง ส่วนแคบ = density ต่ำ Inter-quartile range ของ boxplot และ high density region อยู่ในบริเวณเดียวกัน Syntax violinplot seaborn.violinplot(x, y, hue, data, ...) ตัวอย่าง:

  10. วิธีใช้ Bar Plot ใน Seaborn Library Python

    Seaborn visualize ข้อมูล barplot: categorical vs continuous แสดงความสัมพันธ์ ข้อมูลเป็นแท่งสี่เหลี่ยม ความยาว = สัดส่วนข้อมูลใน category นั้น ตัวอย่าง import pandas as pd import seaborn as sb from matplotlib import pyplot as plt my_df = sb.load_dataset(titanic) sb.barplot(x=sex, y=survived, hue=clas

  11. วิธีใช้ Countplot visualize ข้อมูลใน Seaborn Python

    Seaborn visualize ข้อมูล barplot: categorical vs continuous countplot: กรณีพิเศษของ barplot แสดงจำนวน observations ในแต่ละ category แทนที่จะคำนวณค่าสถิติของตัวแปรที่สอง ตัวอย่าง import pandas as pd import seaborn as sb from matplotlib import pyplot as plt my_df = sb.load_dataset(titanic) sb.countplo

  12. วิธีใช้ Seaborn visualize Point Plots ใน Python

    Seaborn visualize ข้อมูล barplot: เข้าใจ central tendency ของการกระจายข้อมูล แสดงความสัมพันธ์ categorical vs continuous point plot: คล้าย bar plot แต่แสดงจุดประมาณค่าที่ความสูงเฉพาะแกน ตัวอย่าง import pandas as pd import seaborn as sb from matplotlib import pyplot as plt my_df = sb.load_dataset(tita

  13. วิธีใช้ factorplot ใน Seaborn visualize ข้อมูลใน Python

    Seaborn visualize ข้อมูล barplot: categorical vs continuous point plot: จุดแทนค่าประมาณ factorplot: high-level function วาด categorical plot บน FacetGrid ด้วย kind parameter (default: pointplot) ตัวอย่าง import pandas as pd import seaborn as sb from matplotlib import pyplot as plt my_df = sb.load_da

  14. วิธีใช้ Seaborn แสดง Hexbin Plot ใน Python

    Seaborn visualize ข้อมูล มี theme และ high-level interface ควบคุมรูปแบบข้อมูลและการกรอง Hexagonal binning ใช้วิเคราะห์ bivariate data เมื่อข้อมูล sparse (กระจายไม่สม่ำเสมอ) scatter plot ตรงไปตรงมาอาจจับจุดข้อมูลไม่ได้ ใช้ hexagonal binning แทน ตัวอย่าง import pandas as pd import seaborn as sb from m

  15. วิธีแปลง RGB Color Space เป็น Color Space อื่นใน Python

    การแปลง color space ใช้เพื่อให้ได้ input ที่ดีกว่าสำหรับ operation อื่นๆ RGB: hue และ luminosity เป็น linear combination ของ R,G,B HSV: H=Hue, V=Value RGB ถูกมองเป็น single channel ตัวอย่าง: RGB → HSV import matplotlib.pyplot as plt from skimage import data from skimage.color import rgb2hsv path = p

  16. วิธีใช้ scikit-learn แปลงภาพจาก RGB เป็น Grayscale ใน Python

    scikit-learn (sklearn) ไลบรารีสำหรับ Machine Learning การแปลง color space ใช้เพื่อให้ได้ input ที่ดีกว่าสำหรับ operation อื่นๆ เช่น แยก hue, luminosity, saturation RGB → Grayscale: ค่าพิกเซล = weighted sum ของ R, G, B Y = 0.2125 R + 0.7154 G + 0.0721 B น้ำหนักเหล่านี้มาจาก CRT phosphors ที่ตรงกับการ

  17. วิธี visualize ข้อมูลหลายตัวแปรด้วย Seaborn ใน Python

    Seaborn visualize ข้อมูล มี theme และ high-level interface ข้อมูลจริงมีหลายตัวแปร ต้องการวิเคราะห์ความสัมพันธ์ทุกคู่ bivariate distribution อาจซับซ้อน ใช้ pairplot สำหรับ multiple pairwise bivariate distribution ได้ univariate plots Syntax pairplot seaborn.pairplot(data, ...) ตัวอย่าง import pandas

  18. Series Data Structure ใน Pandas Library คืออะไรใน Python

    Series เป็นโครงสร้างข้อมูล 1 มิติ มี label (index) ใน Pandas library สามารถเก็บข้อมูลชนิดใดก็ได้: integer, float, string, python objects สร้างได้จาก array, dictionary, หรือค่าคงที่ ตัวอย่าง: สร้าง Series ว่าง import pandas as pd my_series = pd.Series() print(This is an empty series data structure) p

  19. วิธีใช้ Seaborn แสดง Categorical Scatter Plots ใน Python

    Seaborn visualize ข้อมูล มี theme และ high-level interface scatter plot, histogram ทั่วไปไม่เหมาะกับ categorical variables ต้องใช้ categorical scatterplots: stripplot, swarmplot stripplot ใช้เมื่อตัวแปรอย่างน้อยหนึ่งตัวเป็น categorical ข้อมูลเรียงตามแกนหนึ่ง Syntax stripplot seaborn.stripplot(x, y,

Total 9001 -คอมพิวเตอร์  FirstPage PreviousPage NextPage LastPage CurrentPage:199/451  20-คอมพิวเตอร์/Page Goto:1 193 194 195 196 197 198 199 200 201 202 203 204 205