ai-100 day7 記錄

Ngchiwa Ng
2 min readMar 21, 2020

--

特徵類型

常⾒特徵類型 : 數值型特徵 / 類別型特徵

數值型特徵:有不同的轉换方式,函數/條件式都可以

- ex: 坪數(每坪50點), 年齡(<29, +2 點。 30~59: 1點)

類別型特徵:通常一種類別對應一種分數

- ex:地區(台北市100點,其他0點)

其他特徵:

二元特徵: true/false

排序型特徵:ex 名次(如果當作類別特徵就㑹失去排序資訊)

時間型特徵: 有週期性, 如果只用秒數看, 㑹看不㑹週期

延伸閱讀

k-fold cross validation: https://zhuanlan.zhihu.com/p/24825503

hw

import pandas as pddf = pd.read_csv('xxx.csv')df['column1'].mean()df['column1'].max()df['column1'].nunique()

other usage

dtype_df = df.dtypes #㑹以header 為當作
#print(dtype_df)
#Pclass int64
#Name object
#Sex object
#Age float64
#SibSp int64
#Parch int64
#Ticket object
#Fare float64
#Cabin object
#Embarked object
#dtype: object

dtype_df = df.dtypes.reset_index()

#print(dtype_df)
#
# index 0
#0 Pclass int64
#1 Name object
#2 Sex object
#3 Age float64
#4 SibSp int64
#5 Parch int64
#6 Ticket object
#7 Fare float64
#8 Cabin object
#9 Embarked object
#
dtype_df.columns = ["Count", "Column Type"]

dtype_df = dtype_df.groupby("Column Type").aggregate('count').reset_index()

dtype_df

detail: https://github.com/cwnga2/ai100-4/blob/master/day7/Day_007_HW.ipynb

--

--

Ngchiwa Ng
Ngchiwa Ng

Written by Ngchiwa Ng

Backend/iOS Engineer, rock the world

No responses yet