按照**的說法,landmarking
方法因為過於耗時所以不算在元特徵中
exclude_meta_features_classification
out[5]
:exclude_meta_features_regression
out[6]
:
回歸任務因為沒有離散標籤,所以與class相關的元特徵也排除了
'classentropy'
,'classoccurences'
,'classprobabilitymax'
,'classprobabilitymean'
,'classprobabilitymin'
,'classprobabilitystd'
,
calculate.update(npy_metafeatures)
calculate_all_metafeatures_with_labels
中,在npy_metafeatures
的基礎上更新不用的元特徵。
只有npy_metafeatures
需要用datapreprocessor
做transform
landmarkrandomnodelearner
,
a sk
laskl
askl
計算資料集元特徵的方法其實就放在smbo.py裡面,一共有兩個函式,乙個函式用在計算x,y
x,yx,
y的時候不需要做encode
,只獲取general的元特徵。另乙個需要做encode
。
# metalearning helpers
def_calculate_metafeatures
(data_feat_type, data_info_task, basename,
x_train, y_train, watcher, logger)
:# == calculate metafeatures
task_name =
'calculatemetafeatures'
watcher.start_task(task_name)
categorical =
[true
if feat_type.lower()in
['categorical'
]else
false
for feat_type in data_feat_type]
exclude_meta_features = exclude_meta_features_classification \
if data_info_task in classification_tasks else exclude_meta_features_regression
if data_info_task in
[multiclass_classification, binary_classification,
multilabel_classification, regression,
multioutput_regression]
: logger.info(
'start calculating metafeatures for %s'
, basename)
result = calculate_all_metafeatures_with_labels(
x_train, y_train, categorical=categorical,
dataset_name=basename,
dont_calculate=exclude_meta_features,
)for key in
list
(result.metafeature_values.keys())
:if result.metafeature_values[key]
.type_ !=
'metafeature'
:del result.metafeature_values[key]
else
: result =
none
logger.info(
'metafeatures not calculated'
) watcher.stop_task(task_name)
logger.info(
'calculating metafeatures (categorical attributes) took %5.2f'
, watcher.wall_elapsed(task_name)
)return result
def_calculate_metafeatures_encoded
(basename, x_train, y_train, watcher,
task, logger)
: exclude_meta_features = exclude_meta_features_classification \
if task in classification_tasks else exclude_meta_features_regression
task_name =
'calculatemetafeaturesencoded'
watcher.start_task(task_name)
result = calculate_all_metafeatures_encoded_labels(
x_train, y_train, categorical=
[false
]* x_train.shape[1]
, dataset_name=basename, dont_calculate=exclude_meta_features)
for key in
list
(result.metafeature_values.keys())
:if result.metafeature_values[key]
.type_ !=
'metafeature'
:del result.metafeature_values[key]
watcher.stop_task(task_name)
logger.info(
'calculating metafeatures (encoded attributes) took %5.2fsec'
, watcher.wall_elapsed(task_name)
)return result
學習筆記 nginx再探
上篇nginx初識說了nginx配置http反向 本篇先說https的反向 以及利用nginx搭建檔案伺服器。https使用了ssl通訊標準,需要引入安全證書,且其埠號與http也不相同。其他基本一樣。server autoindex on 顯示目錄 autoindex exact size on ...
再探函式引數
c函式的所有引數均以 傳值呼叫 方式進行傳遞。這意味著函式將獲得引數值的乙份拷貝,這樣函式可以放心修改這個拷貝值,而不必擔心會修改呼叫程式實際傳遞給它的引數。普通資料型別主要包括 如下面 所示 include void swap int x int y int main 我們原本是希望編寫乙個函式,...
再探迭代器
除了為每個容器定義的迭代器以外,標準庫在標頭檔案iterator中還定義了額外4種迭代器 插入迭代器 流迭代器 反向迭代器 移動迭代器 插入器是一種迭代器介面卡,接受乙個容器,生成乙個插入迭代器 vector vi auto it back inserter vi back inserter是插入器...