2022年7月31日 星期日

2022年7月30日 星期六

Feature Encoding

 Feature Encoding

2022/7/30

-----


https://pixabay.com/zh/photos/parkour-performance-movement-jump-643694/

-----

References


[1] Feature Encoding Techniques - Machine Learning - GeeksforGeeks

https://www.geeksforgeeks.org/feature-encoding-techniques-machine-learning/


[2] ML | Label Encoding of datasets in Python - GeeksforGeeks

https://www.geeksforgeeks.org/ml-label-encoding-of-datasets-in-python/?ref=lbp


[3] ML | One Hot Encoding to treat Categorical data parameters - GeeksforGeeks

https://www.geeksforgeeks.org/ml-one-hot-encoding-of-datasets-in-python/?ref=lbp


[4] Label Encoding 與 One Hot Encoding 大不同 - 利用 Python 實現 | 資料科學家的工作日常

https://blog.v123582.tw/2020/05/29/Label-Encoding-%E8%88%87-One-Hot-Encoding-%E5%A4%A7%E4%B8%8D%E5%90%8C-%E5%88%A9%E7%94%A8-Python-%E5%AF%A6%E7%8F%BE/


[5] Categorical encoding using Label-Encoding and One-Hot-Encoder | by Dinesh Yadav | Towards Data Science

https://towardsdatascience.com/categorical-encoding-using-label-encoding-and-one-hot-encoder-911ef77fb5bd


[6] Choosing the right Encoding method-Label vs OneHot Encoder | by Rahil Shaikh | Towards Data Science

https://towardsdatascience.com/choosing-the-right-encoding-method-label-vs-onehot-encoder-a4434493149b

-----

scikit-learn(目錄)

https://mandhistory.blogspot.com/2022/07/scikit-learn.html

-----

Python Machine Learning(目錄)

https://mandhistory.blogspot.com/2022/05/python.html

-----

merge

 merge

2022/07/30

-----


https://pixabay.com/zh/illustrations/people-silhouettes-lots-collection-943873/

-----

References


[1] Merge, join, concatenate and compare — pandas 1.4.3 documentation

https://pandas.pydata.org/docs/user_guide/merging.html


Pandas merge, concat, append, join dataframe - Examples | GoLinuxCloud

https://www.golinuxcloud.com/pandas-merge-concat-append-join-dataframe/


Combining Data in Pandas With merge(), .join(), and concat() – Real Python

https://realpython.com/pandas-merge-join-and-concat/


Combine datasets using Pandas merge(), join(), concat() and append() – Towards AI

https://towardsai.net/p/data-science/combine-datasets-using-pandas-merge-join-concat-and-append


Combine Data in Pandas with merge, join, and concat • datagy

https://datagy.io/pandas-merge-concat/


Python | Merge, Join and Concatenate DataFrames using Panda - GeeksforGeeks

https://www.geeksforgeeks.org/python-merge-join-and-concatenate-dataframes-using-panda/


Combining Datasets: Concat and Append | Python Data Science Handbook

https://jakevdp.github.io/PythonDataScienceHandbook/03.06-concat-and-append.html

-----

Pandas(目錄)

https://mandhistory.blogspot.com/2022/05/pandas.html

-----

Python Machine Learning(目錄)

https://mandhistory.blogspot.com/2022/05/python.html

-----

2022年7月29日 星期五

dict

 dict

2022/07/29

-----


https://pixabay.com/zh/photos/snake-python-serpent-scales-543243/

-----

References


[1] Differences and Applications of List, Tuple, Set and Dictionary in Python - GeeksforGeeks

https://www.geeksforgeeks.org/differences-and-applications-of-list-tuple-set-and-dictionary-in-python/


Python dict() Function

https://www.w3schools.com/python/ref_func_dict.asp


Python dict() Function - GeeksforGeeks

https://www.geeksforgeeks.org/python-dict-function/


Python dict()

https://www.programiz.com/python-programming/methods/built-in/dict


Python Dictionary Methods

https://www.w3schools.com/python/python_ref_dictionary.asp

-----

Python Machine Learning(目錄)

https://mandhistory.blogspot.com/2022/05/python.html

-----

datasets

datasets

2022/07/22

-----


https://pixabay.com/zh/photos/parkour-performance-movement-jump-643694/

-----

一、人工智慧 Python 基礎課 [1]。

1.1. Titanic

1.2. Boston

1.3. Iris


二、機器學習資料集 [2]。

2.1. The Digit Dataset

https://scikit-learn.org/stable/auto_examples/datasets/plot_digits_last_image.html

2.2. Plot randomly generated classification dataset

https://scikit-learn.org/stable/auto_examples/datasets/plot_random_dataset.html

2.3. The Iris Dataset(與 1.3 同)

https://scikit-learn.org/stable/auto_examples/datasets/plot_iris_dataset.html

2.4. Plot randomly generated multilabel dataset

https://scikit-learn.org/stable/auto_examples/datasets/plot_random_multilabel_dataset.html


三、10 Datasets from Kaggle [3]。

3.1. Titanic Dataset (Beginner)(與 1.1 同)

https://www.kaggle.com/c/titanic

3.2. Iris Dataset (Beginner)(與 1.3 同)

https://www.kaggle.com/datasets/uciml/iris

3.3. Train Dataset (Beginner)

https://www.kaggle.com/c/train-occupancy-prediction/data

3.4. Boston Housing Dataset (Beginner)(與 1.2 同)

https://www.kaggle.com/c/boston-housing

3.5. Alcohol and Drug Relation (Intermediate)

https://www.kaggle.com/datasets/jessicali9530/kuc-hackathon-winter-2018

3.6. Breast Cancer Wisconsin (Intermediate)

https://www.kaggle.com/datasets/uciml/breast-cancer-wisconsin-data

3.7. Pima Indians Diabetes (Intermediate)

https://www.kaggle.com/datasets/uciml/pima-indians-diabetes-database

3.8. Amazon Reviews (Intermediate)

https://www.kaggle.com/datasets/bittlingmayer/amazonreviews

3.9. MNIST Handwritten Digits (Advanced)

https://www.kaggle.com/c/digit-recognizer

3.10. CIFAR-100 (Advanced)

https://www.kaggle.com/datasets/fedesoriano/cifar100

-----

References


[1] 人工智慧 Python 基礎課

https://books.google.com.tw/books?id=2ij-DwAAQBAJ&pg=PR6&dq=%E4%BA%BA%E5%B7%A5%E6%99%BA%E6%85%A7+Python+%E5%9F%BA%E7%A4%8E+%E9%99%B3%E6%9C%83%E5%AE%89&hl=zh-TW&sa=X&ved=2ahUKEwiv_4e_vP74AhWDOnAKHWykBWAQ6AF6BAgHEAI#v=onepage&q=%E4%BA%BA%E5%B7%A5%E6%99%BA%E6%85%A7%20Python%20%E5%9F%BA%E7%A4%8E%20%E9%99%B3%E6%9C%83%E5%AE%89&f=false


[2] 機器學習資料集 Datasets - machine-learning

https://machine-learning-python.kspax.io/datasets


[3] 10 Datasets from Kaggle You Should Practice On to Improve Your Data Science Skills | by Chris Zita | Towards Data Science

https://towardsdatascience.com/10-datasets-from-kaggle-you-should-practice-on-to-improve-your-data-science-skills-6d671996177


[4] All the Datasets You Need to Practice Data Science Skills and Make a Great Portfolio | by Rashida Nasrin Sucky | Towards Data Science

https://towardsdatascience.com/all-the-datasets-you-need-to-practice-data-science-skills-and-make-a-great-portfolio-74f2eb53b38a

-----

scikit-learn(目錄)

https://mandhistory.blogspot.com/2022/07/scikit-learn.html

-----

Python Machine Learning(目錄)

https://mandhistory.blogspot.com/2022/05/python.html

-----

2022年7月28日 星期四

Built-in Types

 Built-in Types

2022/07/28

-----


https://pixabay.com/zh/photos/snake-python-serpent-scales-543243/

-----

「Built-in Types


Numeric Types — int, float, complex

Iterator Types

Sequence Types — list, tuple, range

Text Sequence Type — str

Binary Sequence Types — bytes, bytearray, memoryview

Set Types — set, frozenset

Mapping Types — dict

Context Manager Types

Type Annotation Types — Generic Alias, Union」[1]。

-----

References


# 官方說法

[1] The Python Standard Library — Python 3.9.2 documentation

https://docs.python.org/3/library/


# 簡單的分類

[2] Python Data Types

https://www.w3schools.com/python/python_datatypes.asp


# 中等的分類

[3] Basics of Python – Built-in Types - BTech Geeks

https://btechgeeks.com/basics-of-python-built-in-types/


# 複雜的分類

[4] Type Hierarchy in Python | Python in Plain English

https://python.plainenglish.io/python-type-hierarchy-378a049f2f81


# 完整的列表

[5] Built-in Types | Types and Objects in Python | InformIT

https://www.informit.com/articles/article.aspx?p=453682&seqNum=5

-----

Python Machine Learning(目錄)

https://mandhistory.blogspot.com/2022/05/python.html

-----

missing data

 missing data

2022/07/28

-----


https://pixabay.com/zh/illustrations/people-silhouettes-lots-collection-943873/

-----

「In Pandas missing data is represented by two value:

None: None is a Python singleton object that is often used for missing data in Python code.

NaN : NaN (an acronym for Not a Number), is a special floating-point value recognized by all systems that use the standard IEEE floating-point representation.」[2]。

「在 Pandas 中,缺失資料由兩種值表示:

None:None 是一個 Python 單例物件,通常用於 Python 代碼中的缺失資料。

NaN:NaN(Not a Number 的首字母縮寫詞),是所有使用標準 IEEE 浮點表示的系統都可以識別的特殊浮點值。」

-----

References


[1] Working with missing data — pandas 1.4.3 documentation

https://pandas.pydata.org/docs/user_guide/missing_data.html


[2] Working with Missing Data in Pandas - GeeksforGeeks

https://www.geeksforgeeks.org/working-with-missing-data-in-pandas/


[3] Missing values in pandas (nan, None, pd.NA) | note.nkmk.me

https://note.nkmk.me/en/python-pandas-nan-none-na/


[4] Handling Missing Data | Python Data Science Handbook

https://jakevdp.github.io/PythonDataScienceHandbook/03.04-missing-values.html

-----

Pandas(目錄)

https://mandhistory.blogspot.com/2022/05/pandas.html

-----

Python Machine Learning(目錄)

https://mandhistory.blogspot.com/2022/05/python.html

-----

三、Pandas(目錄)

 Pandas (目錄)

2022/05/28

-----


https://pixabay.com/zh/illustrations/people-silhouettes-lots-collection-943873/

-----

1. dataframe

1.1. dtype

1.2. object

1.3. non-null


2. data cleansing

2.1. outliers

2.2. missing data


3. merge

-----

Appendix


Pandas資料分析實戰 : 使用Python進行高效能資料處理及分析 /

作者:Michael Heydt著 ; 陳建宏譯

典藏地:總館條碼號:SRRC10460422索書號:SRRC B 312.32P97 3264特藏:圖書

借閱日期:2022-08-19應還日期 : 2022-09-16

續借次數:0預約人數:1

流通狀態:有人預約

-----

References


# pandas

[1] pandas documentation — pandas 1.2.3 documentation

https://pandas.pydata.org/docs/index.html


# Tutorial

[2] Pandas Tutorial

https://www.w3schools.com/python/pandas/default.asp


# Examples 

[3] 30 Examples to Master Pandas. A comprehensive practical guide for… | by Soner Yıldırım | Towards Data Science

https://towardsdatascience.com/30-examples-to-master-pandas-f8a2da751fa4

-----

Pandas(目錄)

https://mandhistory.blogspot.com/2022/05/pandas.html

-----

Python Machine Learning(目錄)

https://mandhistory.blogspot.com/2022/05/python.html

-----

outliers

 outliers

2022/07/28

-----


https://pixabay.com/zh/illustrations/people-silhouettes-lots-collection-943873/

-----

References


[1] Detect and Remove the Outliers using Python - GeeksforGeeks

https://www.geeksforgeeks.org/detect-and-remove-the-outliers-using-python/

-----

Pandas(目錄)

https://mandhistory.blogspot.com/2022/05/pandas.html

-----

Python Machine Learning(目錄)

https://mandhistory.blogspot.com/2022/05/python.html

-----

data cleansing

 data cleansing

2022/07/28

-----


https://pixabay.com/zh/illustrations/people-silhouettes-lots-collection-943873/

-----

一、五大步驟


「5 Steps in Data Cleaning

1. Identify data that needs to be cleaned and remove 

2. Fix structural mistakes

3. Set data cleansing techniques

4. Filter outliers and fix missing data

5. Implement processes」[1]。

「資料清洗的 5 個步驟

1. 識別需要清理和刪除的資料

2.修復結構錯誤

3.設置資料清洗技術

4.過濾異常值並修復缺失資料

5. 實施流程」

-----

二、outliers 與 missing data

「Filter outliers and fix missing data」[1]。

-----

References


[1] What Is Data Cleaning and The Growing Importance Of Data Cleaning

https://www.expressanalytics.com/blog/growing-importance-of-data-cleaning/


[2] What is Data Cleansing (Data Cleaning, Data Scrubbing)?

https://www.techtarget.com/searchdatamanagement/definition/data-scrubbing

-----

Pandas(目錄)

https://mandhistory.blogspot.com/2022/05/pandas.html

-----

Python Machine Learning(目錄)

https://mandhistory.blogspot.com/2022/05/python.html

-----

titanic_0010:非空值(non-null)

 titanic_0010:非空值(non-null)

2022/07/18

-----

https://pixabay.com/zh/photos/umbrella-only-sad-depression-2603980/

-----


Fig. 1. Non-null.

-----

non-null

「notnull is a pandas function that will examine one or multiple values to validate that they are not null. In Python, null values are reflected as NaN (not a number) or None to signify no data present. . notnull will return False if either NaN or None is detected. If these values are not present, it will return True.」[1]。

「notnull 是一個 pandas 函數,它將檢查一個或多個值以驗證它們不為空。 在 Python 中,空值反映為 NaN(不是數字)或 None 表示沒有資料。 . 如果檢測到 NaN 或 None,notnull 將返回 False。 如果這些值不存在,它將返回 True。」

-----

data cleansing

「Use the pandas .notnull method to power data cleansing and improve data quality.」[1]。

「使用 pandas .notnull 方法強化資料清洗清理並提升資料品質。」

-----

References


[1] The Pandas .notnull Method: The Definitive Guide [+ Examples]

https://blog.hubspot.com/website/pandas-is-not-null


[2] NaN, None and Experimental NA. Illustrated missing values conventions | by Deepak Tunuguntla | Jun, 2021 | Towards Data Science | Towards Data Science

https://towardsdatascience.com/nan-none-and-experimental-na-d1f799308dd5


# non-null

Python None Keyword

https://www.w3schools.com/python/ref_keyword_none.asp


Python None

https://www.pythontutorial.net/advanced-python/python-none/

-----

Pandas(目錄)

https://mandhistory.blogspot.com/2022/05/pandas.html

-----

鐵達尼號 Python 實作(目錄)

https://mandhistory.blogspot.com/2022/06/titanic.html

-----

titanic_0009:物件(object)

 titanic_0009:物件(object)

2022/07/14

說明:


-----

https://pixabay.com/zh/photos/umbrella-only-sad-depression-2603980/

-----


Fig. 1. Object [1].

-----

「Pandas dtype Python type NumPy type Usage

object str or mixed string_, unicode_, mixed types Text or mixed numeric and non-numeric values」[1]。

-----

「The dtype object comes from NumPy, it describes the type of element in a ndarray. Every element in an ndarray must have the same size in bytes. For int64 and float64, they are 8 bytes. But for strings, the length of the string is not fixed. So instead of saving the bytes of strings in the ndarray directly, Pandas uses an object ndarray, which saves pointers to objects; because of this the dtype of this kind ndarray is object.」[2]。

「dtype 物件來自 NumPy,它描述了 ndarray 中元素的類型。 ndarray 中的每個元素必須具有相同的位元組大小。 對於 int64 和 float64,它們是 8 個位元組。 但是對於字串來說,字串的長度是不固定的。 因此,Pandas 沒有直接將字串的位元組保存在 ndarray 中,而是使用了一個物件 ndarray,它保存了指向物件的指標; 因此,這種 ndarray 的 dtype 是物件。」

-----

# Structured Array

「At the very basic level, Pandas objects can be thought of as enhanced versions of NumPy structured arrays in which the rows and columns are identified with labels rather than simple integer indices.」[3]。

「在最基本的層面上,Pandas 物件可以被認為是 NumPy 結構化陣列的增強版本,其中列和行用標籤而不是簡單的整數索引來標識。」

-----

# Tensor to Numpy

「In general, if an object can be converted to a tensor with tf.convert_to_tensor it can be passed anywhere you can pass a tf.Tensor.」[4]。

「一般來說,如果一個物件可以使用 tf.convert_to_tensor 轉換為張量,則它可以在任何可以傳遞 tf.Tensor 的地方傳遞。」

-----

References


# dtype

[1] Overview of Pandas Data Types - Practical Business Python

https://pbpython.com/pandas_dtypes.html


# string

[2] python - Strings in a DataFrame, but dtype is object - Stack Overflow

https://stackoverflow.com/questions/21018654/strings-in-a-dataframe-but-dtype-is-object


# Series、DataFrame、Index

[3] 03.01-Introducing-Pandas-Objects.ipynb - Colaboratory

https://colab.research.google.com/github/jakevdp/PythonDataScienceHandbook/blob/master/notebooks/03.01-Introducing-Pandas-Objects.ipynb


# DataFrame

[4] Load a pandas DataFrame  |  TensorFlow Core

https://www.tensorflow.org/tutorials/load_data/pandas_dataframe


# Series、DataFrame、Index

[5] Introducing Pandas Objects | Python Data Science Handbook

https://jakevdp.github.io/PythonDataScienceHandbook/03.01-introducing-pandas-objects.html


# Series、DataFrame

[6] Python Pandas Objects - Pandas Series and Pandas Dataframe-SaralGyaan

https://saralgyaan.com/posts/pandas-objects-series-and-dataframe/


# dtype

[7] 在 Pandas 中把物件轉換為浮點型 | D棧 - Delft Stack

https://www.delftstack.com/zh-tw/howto/python-pandas/pandas-convert-object-to-float/


# dtype

[8] 如何在 Pandas 中更改列的資料型別 | D棧 - Delft Stack

https://www.delftstack.com/zh-tw/howto/python-pandas/how-to-change-data-type-of-columns-in-pandas/


# mixed

[9] Pandas: Clean object column with mixed data of a given DataFrame using regular expression - w3resource

https://www.w3resource.com/python-exercises/pandas/python-pandas-data-frame-exercise-76.php


# mixed

[10] python - Mixed types of elements in DataFrame's column - Stack Overflow

https://stackoverflow.com/questions/27362234/mixed-types-of-elements-in-dataframes-column

-----

Pandas(目錄)

https://mandhistory.blogspot.com/2022/05/pandas.html

-----

鐵達尼號 Python 實作(目錄)

https://mandhistory.blogspot.com/2022/06/titanic.html

-----

titanic_0008:資料型別(dtype)

 titanic_0008:資料型別(dtype)

2022/07/18

-----

https://pixabay.com/zh/photos/umbrella-only-sad-depression-2603980/

-----


Fig. 1. Dtype.

-----


Fig. 2. Dtype [1].

-----

References


# Python、NumPy、Pandas

[1] Overview of Pandas Data Types - Practical Business Python

https://pbpython.com/pandas_dtypes.html


# Python

Python Data Types

https://www.w3schools.com/python/python_datatypes.asp


# NumPy

Data type objects (dtype) — NumPy v1.23 Manual

https://numpy.org/doc/stable/reference/arrays.dtypes.html


# NumPy

NumPy 資料型別和轉換 | D棧 - Delft Stack

https://www.delftstack.com/zh-tw/tutorial/python-numpy/numpy-datatype-and-conversion/


# NumPy、Pandas 

Difference between Pandas VS NumPy - GeeksforGeeks

https://www.geeksforgeeks.org/difference-between-pandas-vs-numpy/

-----

Pandas(目錄)

https://mandhistory.blogspot.com/2022/05/pandas.html

-----

鐵達尼號 Python 實作(目錄)

https://mandhistory.blogspot.com/2022/06/titanic.html

-----

titanic_0007:繪製表格

titanic_0007:繪製表格

2022/07/18

說明:

將 Pandas 的 dtype 表格 [1] 輸出到螢幕 [2], [3] 以及輸出到圖檔 [4] - [10]。

-----

https://pixabay.com/zh/photos/umbrella-only-sad-depression-2603980/

-----

Q1:如何將 Pandas 的 dataframe 以表格型式輸出到螢幕?

A1:參考代碼一 [2]。


代碼一

# 代碼一
# 將 dataframe 以表格輸出到螢幕

import pandas as pd

# read dtype.csv
f_p = '/content/drive/My Drive/colab/data/titanic/' # file path
df = pd.read_csv(f_p+'dtype.csv')

# display the DataFrame
df.style.set_properties(**{'border': '1.5px solid blue', 'color': 'red'})

-----


Fig. 1. Dtype [1] - [3].


圖一是 pandas 的 dtype 表格 [1]。這用 Excel 來做很容易,不過本篇可以作為練習,將 dataframe 的內容輸出到表格再轉存圖檔。

先從 [2] 裡面的範例找出比較美觀的,然後將 dtype 的表格從 [1] 複製到 Excel,稍作修改後,轉存 csv 檔,以 pandas 讀取後用 style 的方式呈現 [3],最後進行螢幕截圖。

-----

Q2:如何將 Pandas 的 dataframe 以表格型式輸出到圖檔?

A2:參考代碼二。


代碼二

# 代碼二
# 將 dataframe 轉成 matplotlib 的 table

import matplotlib.pyplot as plt
import pandas as pd

# read dtype.csv
f_p = '/content/drive/My Drive/colab/data/titanic/' # file path
df = pd.read_csv(f_p+'dtype.csv')

fig, ax = plt.subplots(figsize=(32, 8))

ax.axis('off')
dtype_table = ax.table(cellText=df.values,
                       colLabels=df.columns, # 共有四個 col
                       colWidths=[0.11, 0.41, 0.1, 0.34], # 總和不用為 1
                       colColours=['yellow'] * 4, # 共有四個 col
                       loc='center')

dtype_table.auto_set_font_size(False)
dtype_table.set_fontsize(28) # 設定字型大小

for key, cell in dtype_table.get_celld().items():
    cell.set_height(0.18) # 設定 row 高,預設值為 0.045

plt.savefig(f_p+'t0007_2.png') # 存檔

-----


Fig. 2. Dtype [1].


圖二可以說是從 [4] 開始,最後調整到接近圖一的程度,重點在圖二不是螢幕截圖,而是直接輸出到圖檔。

[4] 是一個簡單的範例,先找到 [5] 有存圖的功能,但 [5] 從 pandas 直接繪圖,現階段的程度較難調整參數。[6] 有一些方法,但較難整合。[7] 則是仔細的參數調整,這在後面有使用到。[8] 調整參數的方法讀完後有更清楚些。[9] 後來沒用到。最後,以 [10] 為模本,[7] 為細節,完成代碼二與圖二。

-----

Appendix. A. NA and nan

「Missing values caused by reading files, etc.

nan (not a number) is considered a missing value

None is also considered a missing value

String is not considered a missing value

Infinity inf is not considered a missing value by default

pd.NA is the experimental value (as of 1.4.0)」[11]。

「讀取文件等導致的缺失值

nan(不是數字)被認為是缺失值

None 也被認為是缺失值

字符串不被視為缺失值

Infinity inf 默認不被視為缺失值

pd.NA 是實驗值(截至 1.4.0)」

-----

Appendix. B.


NA [12]。

-----

References


# dtype

[1] Overview of Pandas Data Types - Practical Business Python

https://pbpython.com/pandas_dtypes.html


# table

[2] Pandas 以表格樣式顯示 DataFrame | D棧 - Delft Stack

https://www.delftstack.com/zh-tw/howto/python-pandas/pandas-display-dataframe-in-a-table-style/


# style

[3] Table Visualization — pandas 1.4.3 documentation

https://pandas.pydata.org/docs/user_guide/style.html


# ax.table,基本的表格呈現

[4] 如何在 Matplotlib 中繪製一個表格 | D棧 - Delft Stack

https://www.delftstack.com/zh-tw/howto/matplotlib/plot-table-using-matplotlib/


# table png,生成 dataframe 後,放到 axes 上。pandas 繪圖修改參數較不容易

[5] [Python] 將Pandas table轉成圖檔 - iT 邦幫忙::一起幫忙解決難題,拯救 IT 人的一天

https://ithelp.ithome.com.tw/articles/10231378


# table png,一些方法

[6] python - How to save a pandas DataFrame table as a png - Stack Overflow

https://stackoverflow.com/questions/35634238/how-to-save-a-pandas-dataframe-table-as-a-png


# colWidths,仔細的表格呈現與參數設定

[7] 小狐狸事務所: Python 學習筆記 : Matplotlib 資料視覺化 (四) 表格篇

https://yhhuang1966.blogspot.com/2022/07/python-matplotlib.html


# fontsize,較精簡的參數設定

[8] python - How to change the tables' fontsize with matplotlib.pyplot - Stack Overflow

https://stackoverflow.com/questions/15514005/how-to-change-the-tables-fontsize-with-matplotlib-pyplot


# rect = [left, bottom, width, height],table 在 axes 上的位置

[9] matplotlib.pyplot.axes — Matplotlib 3.5.2 documentation

https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.axes.html


# 簡明有用的範例樣本

[10] How to change a table's fontsize with matplotlib.pyplot?

https://www.tutorialspoint.com/how-to-change-a-table-s-fontsize-with-matplotlib-pyplot


# nan

[11] Missing values in pandas (nan, None, pd.NA) | note.nkmk.me

https://note.nkmk.me/en/python-pandas-nan-none-na/


[12] NaN, None and Experimental NA. Illustrated missing values conventions | by Deepak Tunuguntla | Jun, 2021 | Towards Data Science | Towards Data Science

https://towardsdatascience.com/nan-none-and-experimental-na-d1f799308dd5

-----

鐵達尼號 Python 實作(目錄)

https://mandhistory.blogspot.com/2022/06/titanic.html

-----

2022年7月27日 星期三

statsmodels(目錄)

 statsmodels(目錄)

2022/07/27

-----


https://pixabay.com/zh/illustrations/mathematics-formula-physics-school-1233876/

-----

1. OLS

-----

References


# statsmodels

[1] Introduction — statsmodels

https://www.statsmodels.org/stable/index.html


# OLS

[2] Ordinary Least Squares (OLS) using statsmodels - GeeksforGeeks

https://www.geeksforgeeks.org/ordinary-least-squares-ols-using-statsmodels/

-----

statsmodels(目錄)

https://mandhistory.blogspot.com/2022/07/statsmodels.html

-----

dataframe

 dataframe

2022/07/27

-----


https://pixabay.com/zh/illustrations/people-silhouettes-lots-collection-943873/

-----

一、Series and Dataframe

「DataFrame 既有行索引也有列索引,它可以被看做由 Series 組成的字典(共同用一個索引)。」[1]。

-----

二、values and columns


「可以透過下列方法查看目前資料的資訊


.shape

.describe()

.head()

.tail()

.columns

.index

.info()」[2]。

-----

References


[1] Pandas 数据结构 – DataFrame | 菜鸟教程

https://www.runoob.com/pandas/pandas-dataframe.html


[2] [Python] Pandas 基礎教學

https://oranwind.org/python-pandas-ji-chu-jiao-xue/


# Series、DataFrame

[3] [Pandas教學]資料分析必懂的Pandas Series處理單維度資料方法

https://www.learncodewithmike.com/2020/10/python-pandas-series-tutorial.html


# Series、DataFrame

[4] [Pandas教學]資料分析必懂的Pandas DataFrame處理雙維度資料方法

https://www.learncodewithmike.com/2020/11/python-pandas-dataframe-tutorial.html

-----

Pandas(目錄)

https://mandhistory.blogspot.com/2022/05/pandas.html

-----

Python Machine Learning(目錄)

https://mandhistory.blogspot.com/2022/05/python.html

-----

2022年7月26日 星期二

Figure and Axes

Figure and Axes

2022/07/19

-----


https://pixabay.com/zh/photos/business-colleagues-communication-3605367/

-----

一、plt fig ax


「如果有一些其他的細節調整,在搜索的時候,盡量選擇不用 plt 的答案。原則上來說,plt 和 ax 畫圖兩者是可以互相轉換的,然而轉換過程讓你的代碼更複雜,有時還會產生難以理解的 bug。因此畫圖的時候,請堅持使用一種格式。」[1]。


Figure:一張圖只有一個 figure,所有的子圖都包含在這個 figure 裡面。最基本的是只有一個子圖。

Axes:子圖(每個子圖都有 x axis 與 y axis)。

Axis:子圖的軸。

-----

二、fig, ax = plt.subplots()


「fig, ax = plt.subplots()

is more concise than this:


fig = plt.figure()

ax = fig.add_subplot(111)」[2]。


在這邊,figure.add_subplot() 與 pyplot.subplot() 是一樣的,不過這兩個其實有區別,可以參考 [4]。

-----

三、figure.add_subplot() 與 pyplot.subplot() 


範例 [3]。

-----

四、figure.add_subplot() 與 pyplot.subplot() 有何不同?


figure.add_subplot() 基本上是讓圖重疊覆蓋上去。pyplot.subplot() 會讓有重疊到的原先的圖整個被刪除。可以參考圖例 [4]。

-----

pyplot、figure、axes


3.1. matplotlib.figure

3.2. matplotlib.axes

3.3. matplotlib.pyplot

3.3.1. matplotlib.pyplot.figure

3.3.2. matplotlib.pyplot.axes

-----

References


# fig ax plt

[1] matplotlib:先搞明白plt. /ax./ fig再畫- 知乎

https://zhuanlan.zhihu.com/p/93423829


# figure.add_subplot()

[2] Why do many examples use `fig, ax = plt.subplots()` in Matplotlib/pyplot/python - Stack Overflow

https://stackoverflow.com/questions/34162443/why-do-many-examples-use-fig-ax-plt-subplots-in-matplotlib-pyplot-python


# figure.add_subplot()

[3] 在 Matplotlib 中新增子圖 | D棧 - Delft Stack

https://www.delftstack.com/zh-tw/howto/matplotlib/add-subplot-to-a-figure-matplotlib/


# figure.add_subplot()

[4] python - figure.add_subplot() vs pyplot.subplot() - Stack Overflow

https://stackoverflow.com/questions/34442283/figure-add-subplot-vs-pyplot-subplot


# figure.add_subplot()

[5] python - In Matplotlib, what does the argument mean in fig.add_subplot(111)? - Stack Overflow

https://stackoverflow.com/questions/3584805/in-matplotlib-what-does-the-argument-mean-in-fig-add-subplot111


# pyplot、figure、axes

[6] Appendix: Figure Code | Python Data Science Handbook

https://jakevdp.github.io/PythonDataScienceHandbook/06.00-figure-code.html

-----

Matplotlib(目錄)

https://mandhistory.blogspot.com/2022/02/matplotlib.html

-----

2022年7月24日 星期日

Picture Library

 Picture Library



Fig. BERT(圖片來源)。

-----



Fig. YOLOv3(圖片來源)。

-----


Fig. YOLOv1(圖片來源)。

-----



Fig. GoogLeNet(圖片來源)。

-----

-----



Fig. GPU(圖片來源)。

-----



Fig. Maximum Entropy(圖片來源)。

-----


Fig. Normed Vector Space(圖片來源)。

-----



Fig. Euclidean Space(圖片來源)。

-----


Fig. RKHS(圖片來源)。

-----


Fig. Metric Space(圖片來源)。

-----


Fig. ℝ³(圖片來源)。

-----


Fig. Topological Space(圖片來源)。

-----


Fig. Mathematics(圖片來源)。

-----



Fig. Banach Space(圖片來源)。

-----


Fig. Lagrange Multipliers(圖片來源)。

-----



Fig. Mathematics(圖片來源)。

-----


-----


https://pixabay.com/zh/photos/bank-note-dollar-usd-us-dollar-941246/

-----


Fig. Test(圖片來源)。

-----


Fig. ConvNet(圖片來源)。

-----


Fig. Convolution(圖片來源)。

-----



Fig. Lab(圖片來源)。

-----


Fig. GPT-2(圖片來源)。

-----




Fig. Transformer XL(圖片來源)。

-----


Fig. Universal Transformer(圖片來源)。

-----



Fig. Skip-thought(圖片來源)。

-----


Fig. ULMFiT(圖片來源)。

-----


Fig. AWD-LSTM(圖片來源)。

-----


Fig. Bag-of-Words(圖片來源)。

-----


Fig. fastText(圖片來源)。

-----


Fig. GloVe(圖片來源)。

-----


Fig. Tree(圖片來源)。

-----



https://pixabay.com/zh/photos/toilet-paper-toilet-paper-loo-4974461/

-----


-----



Fig. 1. 南港展覽館。

-----



-----


-----


Fig. Q(圖片來源:Pixabay)。

-----


Fig. Slack(圖片來源:Pixabay)。

-----


Fig. AI Startups(圖片來源)。

-----


-----

-----

-----

-----




Fig. VGG Astrology(圖片來源)。

-----


-----



https://www.icysedgwick.com/aesculapius/

-----



https://pixabay.com/zh/photos/blonde-sitting-wall-buildings-city-1867768/

-----


https://pixabay.com/zh/photos/woman-old-senior-female-elderly-1031000/

-----


https://pixabay.com/zh/photos/girl-model-photo-photoshoot-makeup-2580013/

-----


https://pixabay.com/zh/photos/ad-announce-announcement-bathroom-1238807/

-----


https://pixabay.com/zh/photos/monument-x-ray-monument-casting-5273316/

-----


https://pixabay.com/zh/photos/people-three-portrait-black-3104635/

-----


https://pixabay.com/zh/photos/decollete-dekoltee-ipad-pad-tablet-1688448/

-----


https://pixabay.com/zh/photos/girl-flowers-wreath-eyes-looking-1403458/

-----

-----



-----


-----


Fig. Computational Graph(圖片來源)。

-----


-----


https://pixabay.com/zh/%E9%9B%B2-%E8%8D%89%E5%8E%9F-%E5%A4%A7%E8%87%AA%E7%84%B6-%E9%99%BD%E5%85%89-%E5%B0%8F%E8%8D%89-2712799/

-----


https://pixabay.com/zh/photos/tori-japanese-shrine-torii-1976609/

-----

-----

-----

-----



-----

[2] GitHub - janishar_mit-deep-learning-book-pdf  MIT Deep Learning Book in PDF format (complete and parts) by Ian Goodfellow, Yoshua Bengio and Aaron Courville
https://github.com/janishar/mit-deep-learning-book-pdf

-----


Fig. 7. 理科論文寫作 [7]。

-----



Fig. Residual(圖片來源)。

-----


Fig. 1. English(圖片來源)。

-----



Fig. Self-driving Car(圖片來源)。

-----


Fig. Keras(圖片來源)。




Fig. 1. Chain。圖片來源

-----


Fig. 1. Torch(圖片來源)。

-----


Fig. 1. Torch(圖片來源)。

-----


Fig. 1. Torch(圖片來源)。

-----


-----



-----


-----

-----




Fig. 1. 高雄中學,弘毅樓。

-----



Fig. 1. Torch(圖片來源)。

-----


-----



老闆並無特別反應。

-----



-----



Fig. Scala(圖片來源)。

-----


https://pixabay.com/zh/photos/sheep-agriculture-animals-17482/

Fig. Group Normalization。

-----


https://pixabay.com/zh/photos/hvetebakst-sweet-hvetebakst-spinning-1128042/

-----



https://pixabay.com/zh/photos/dogs-home-innocent-cute-2980024/

-----


https://pixabay.com/zh/photos/parachute-dropout-1079351/

-----


https://pixabay.com/zh/photos/hohenzollern-hohenzollern-castle-200446/

-----


https://pixabay.com/zh/photos/berlin-alexanderplatz-tv-tower-alex-113836/

-----


https://pixabay.com/zh/photos/dance-balinese-traditional-women-4271941/

-----


Fig. From Tensor To TensorFlow(圖片來源)。

-----


Fig. Deep Learning(圖片來源)。

-----


Fig. Metric Space(圖片來源)。

-----


Fig. Lab(圖片來源)。

-----


Fig. Stone(圖片來源)。

-----



Fig. 1.  北科大校園地圖。

-----


-----


Fig. MultiBox(圖片來源:Pixabay)。

-----


Fig. Highlight(圖片來源:Pixabay)。

-----



Fig. Eighteen Months(圖片來源:Pixabay)。

-----