describe
説明
describe( は、Transformer)Transformer で生成された特徴量の説明を出力します。関数 gencfeatures または genrfeatures を使用して FeatureTransformer オブジェクト Transformer を作成します。
describe( は、Transformer,Index)Index で識別される特徴量の説明を出力します。
例
gencfeatures を使用して予測子データの table から特徴量を生成します。生成された特徴量をオブジェクト関数 describe を使用して調べます。
停電のデータをワークスペースに table として読み込みます。欠損値がある観測値を削除し、table の最初の数行を表示します。
outages = readtable("outages.csv");
Tbl = rmmissing(outages);
head(Tbl) Region OutageTime Loss Customers RestorationTime Cause
_____________ ________________ ______ __________ ________________ ___________________
{'SouthWest'} 2002-02-01 12:18 458.98 1.8202e+06 2002-02-07 16:50 {'winter storm' }
{'SouthEast'} 2003-02-07 21:15 289.4 1.4294e+05 2003-02-17 08:14 {'winter storm' }
{'West' } 2004-04-06 05:44 434.81 3.4037e+05 2004-04-06 06:10 {'equipment fault'}
{'MidWest' } 2002-03-16 06:18 186.44 2.1275e+05 2002-03-18 23:23 {'severe storm' }
{'West' } 2003-06-18 02:49 0 0 2003-06-18 10:54 {'attack' }
{'NorthEast'} 2003-07-16 16:23 239.93 49434 2003-07-17 01:12 {'fire' }
{'MidWest' } 2004-09-27 11:09 286.72 66104 2004-09-27 16:37 {'equipment fault'}
{'SouthEast'} 2004-09-05 17:48 73.387 36073 2004-09-05 20:46 {'equipment fault'}
変数の中には、OutageTime や RestorationTime など、分類器の fitcensemble のような学習関数でサポートされないデータ型の変数も含まれています。
Tbl 内の予測子から、バギング アンサンブルの学習に使用できる特徴量を 25 個生成します。table 変数 Region を応答として指定します。
Transformer = gencfeatures(Tbl,"Region",25,TargetLearner="bag")
Transformer =
FeatureTransformer with properties:
Type: 'classification'
TargetLearner: 'bag'
NumEngineeredFeatures: 22
NumOriginalFeatures: 3
TotalNumFeatures: 25
Transformer オブジェクトに、生成された特徴量とそれらの作成に使用された変換に関する情報が格納されます。
生成された特徴量について詳しく確認するには、オブジェクト関数 describe を使用します。
Info = describe(Transformer)
Info=25×4 table
Type IsOriginal InputVariables Transformations
___________ __________ ___________________________ _________________________________________________________________________________________________________________
Loss Numeric true Loss ""
Customers Numeric true Customers ""
c(Cause) Categorical true Cause "Variable of type categorical converted from a cell data type"
RestorationTime-OutageTime Numeric false OutageTime, RestorationTime "Elapsed time in seconds between OutageTime and RestorationTime"
sdn(OutageTime) Numeric false OutageTime "Serial date number from 01-Feb-2002 12:18:00"
woe3(c(Cause)) Numeric false Cause "Variable of type categorical converted from a cell data type -> Weight of Evidence (positive class = SouthEast)"
doy(OutageTime) Numeric false OutageTime "Day of the year"
year(OutageTime) Numeric false OutageTime "Year"
kmd1 Numeric false Loss, Customers "Euclidean distance to centroid 1 (kmeans clustering with k = 10)"
kmd5 Numeric false Loss, Customers "Euclidean distance to centroid 5 (kmeans clustering with k = 10)"
quarter(OutageTime) Numeric false OutageTime "Quarter of the year"
woe2(c(Cause)) Numeric false Cause "Variable of type categorical converted from a cell data type -> Weight of Evidence (positive class = NorthEast)"
year(RestorationTime) Numeric false RestorationTime "Year"
month(OutageTime) Numeric false OutageTime "Month of the year"
Loss.*Customers Numeric false Loss, Customers "Loss .* Customers"
tods(OutageTime) Numeric false OutageTime "Time of the day in seconds"
⋮
table Info から次のことがわかります。
生成された最初の 3 つの特徴量は
Tblが元になっています。このうち、c(Cause)は、元の変数Causeがカテゴリカル変数に変換されたものです。変数
OutageTimeとRestorationTimeはdatetime変数であり、バギング アンサンブル モデルの学習には使用できないため、生成された特徴量には含まれていません。ただし、生成された特徴量の中には、4 番目のRestorationTime-OutageTimeのように、それらの変数から派生した特徴量が多数含まれています。一部の生成された特徴量については複数の変換が組み合わされています。たとえば、6 番目の特徴量
woe3(c(Cause))は、変数Causeをカテゴリカル変数に変換してから、その変数の証拠の重みの値を計算して生成されたものです。
genrfeatures を使用して予測子データの table から特徴量を生成します。生成された特徴量をオブジェクト関数 describe を使用して調べます。
停電のデータをワークスペースに table として読み込みます。欠損値がある観測値を削除し、table の最初の数行を表示します。
outages = readtable("outages.csv");
Tbl = rmmissing(outages);
head(Tbl) Region OutageTime Loss Customers RestorationTime Cause
_____________ ________________ ______ __________ ________________ ___________________
{'SouthWest'} 2002-02-01 12:18 458.98 1.8202e+06 2002-02-07 16:50 {'winter storm' }
{'SouthEast'} 2003-02-07 21:15 289.4 1.4294e+05 2003-02-17 08:14 {'winter storm' }
{'West' } 2004-04-06 05:44 434.81 3.4037e+05 2004-04-06 06:10 {'equipment fault'}
{'MidWest' } 2002-03-16 06:18 186.44 2.1275e+05 2002-03-18 23:23 {'severe storm' }
{'West' } 2003-06-18 02:49 0 0 2003-06-18 10:54 {'attack' }
{'NorthEast'} 2003-07-16 16:23 239.93 49434 2003-07-17 01:12 {'fire' }
{'MidWest' } 2004-09-27 11:09 286.72 66104 2004-09-27 16:37 {'equipment fault'}
{'SouthEast'} 2004-09-05 17:48 73.387 36073 2004-09-05 20:46 {'equipment fault'}
変数の中には、OutageTime や RestorationTime など、fitrensemble のような回帰モデル学習関数でサポートされないデータ型の変数も含まれています。
Tbl 内の予測子から、バギング アンサンブルの学習に使用できる特徴量を 25 個生成します。table 変数 Loss を応答として指定します。
rng("default") % For reproducibility Transformer = genrfeatures(Tbl,"Loss",25,TargetLearner="bag")
Transformer =
FeatureTransformer with properties:
Type: 'regression'
TargetLearner: 'bag'
NumEngineeredFeatures: 22
NumOriginalFeatures: 3
TotalNumFeatures: 25
Transformer オブジェクトに、生成された特徴量とそれらの作成に使用された変換に関する情報が格納されます。
生成された特徴量について詳しく確認するには、オブジェクト関数 describe を使用します。
Info = describe(Transformer)
Info=25×4 table
Type IsOriginal InputVariables Transformations
___________ __________ ___________________________ ___________________________________________________________________
c(Region) Categorical true Region "Variable of type categorical converted from a cell data type"
Customers Numeric true Customers ""
c(Cause) Categorical true Cause "Variable of type categorical converted from a cell data type"
kmd2 Numeric false Customers "Euclidean distance to centroid 2 (kmeans clustering with k = 10)"
kmd1 Numeric false Customers "Euclidean distance to centroid 1 (kmeans clustering with k = 10)"
kmd4 Numeric false Customers "Euclidean distance to centroid 4 (kmeans clustering with k = 10)"
kmd5 Numeric false Customers "Euclidean distance to centroid 5 (kmeans clustering with k = 10)"
kmd9 Numeric false Customers "Euclidean distance to centroid 9 (kmeans clustering with k = 10)"
cos(Customers) Numeric false Customers "cos( )"
RestorationTime-OutageTime Numeric false OutageTime, RestorationTime "Elapsed time in seconds between OutageTime and RestorationTime"
kmd6 Numeric false Customers "Euclidean distance to centroid 6 (kmeans clustering with k = 10)"
kmi Categorical false Customers "Cluster index encoding (kmeans clustering with k = 10)"
kmd7 Numeric false Customers "Euclidean distance to centroid 7 (kmeans clustering with k = 10)"
kmd3 Numeric false Customers "Euclidean distance to centroid 3 (kmeans clustering with k = 10)"
kmd10 Numeric false Customers "Euclidean distance to centroid 10 (kmeans clustering with k = 10)"
hour(RestorationTime) Numeric false RestorationTime "Hour of the day"
⋮
生成された最初の 3 つの特徴量は Tbl が元になっています。このうち、変数 categorical は、元の変数 Region および Cause が変換されたものです。
Info(1:3,:) % describe(Transformer,1:3)ans=3×4 table
Type IsOriginal InputVariables Transformations
___________ __________ ______________ ______________________________________________________________
c(Region) Categorical true Region "Variable of type categorical converted from a cell data type"
Customers Numeric true Customers ""
c(Cause) Categorical true Cause "Variable of type categorical converted from a cell data type"
変数 OutageTime と RestorationTime は datetime 変数であり、バギング アンサンブル モデルの学習には使用できないため、生成された特徴量には含まれていません。ただし、生成された特徴量の中には、10 番目の特徴量 RestorationTime-OutageTime のように、それらの変数から派生した特徴量が一部含まれています。
Info(10,:) % describe(Transformer,10)ans=1×4 table
Type IsOriginal InputVariables Transformations
_______ __________ ___________________________ ________________________________________________________________
RestorationTime-OutageTime Numeric false OutageTime, RestorationTime "Elapsed time in seconds between OutageTime and RestorationTime"
一部の生成された特徴量については複数の変換が組み合わされています。たとえば、19 番目の特徴量 fenc(c(Cause)) は、変数 Cause を 10 のカテゴリでカテゴリカル変数に変換してから、そのカテゴリの頻度を計算して生成されたものです。
Info(19,:) % describe(Transformer,19)ans=1×4 table
Type IsOriginal InputVariables Transformations
_______ __________ ______________ ____________________________________________________________________________________________________________
fenc(c(Cause)) Numeric false Cause "Variable of type categorical converted from a cell data type -> Frequency encoding (number of levels = 10)"
入力引数
特徴量変換器。FeatureTransformer オブジェクトとして指定します。
説明対象の特徴量。特徴量の位置を示す数値ベクトルまたは logical ベクトルとして、あるいは、特徴量の名前を示す文字ベクトルの string 配列または cell 配列として指定します。
例: 1:12
データ型: single | double | logical | string | cell
出力引数
アルゴリズム
Info.Transformations に記述されるいくつかの複雑な特徴変換の説明について、次の表に追加情報を示します。
| 特徴量の名前の例 | Info に記述される変換の説明の例 | 追加情報 |
|---|---|---|
eb4(Variable) | Equal-width binning (number of bins = 4) | Variable の値が 4 個の同じ幅のビンに分割されます。結果の特徴量はカテゴリカル変数です。 |
fenc(Variable) | Frequency encoding (number of levels = 10) | Variable の 10 個のカテゴリ (または水準) の周波数が計算されます。結果の特徴量の各カテゴリカル値が対応するカテゴリの周波数に置き換えられ、数値変数が作成されます。 |
kmc1 | Centroid encoding (component #1) (kmeans clustering with k = 10) | k-means クラスタリングを使用して、各観測値が 10 個のクラスターのいずれかに割り当てられます。結果の特徴量の各行は観測値に対応し、その観測値に関連するクラスター重心の 1 番目の成分になります。結果の特徴量は数値変数です。 |
kmd4 | Euclidean distance to centroid 4 (kmeans clustering with k = 10) | k-means クラスタリングを使用して、各観測値が 10 個のクラスターのいずれかに割り当てられます。結果の特徴量の各行は、対応する観測値から 4 番目のクラスターの重心までのユークリッド距離になります。結果の特徴量は数値変数です。 |
kmi | Cluster index encoding (kmeans clustering with k = 10) | k-means クラスタリングを使用して、各観測値が 10 個のクラスターのいずれかに割り当てられます。結果の特徴量の各行は、対応する観測値のクラスター インデックスになります。結果の特徴量はカテゴリカル変数です。 |
q50(Variable) | Equiprobable binning (number of bins = 50) | Variable の値が 50 個の同じ確率のビンに分割されます。結果の特徴量はカテゴリカル変数です。 |
woe5(Variable) | Weight of Evidence (positive class = Class5) | この変換は分類問題にのみ使用できます。 次の手順を実行して結果の特徴量が作成されます。
|
バージョン履歴
R2021a で導入
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)