0
我使用下面的代碼訓練我的數據:Postgres的-馬德利布預測花費的時間比訓練
start_time := clock_timestamp();
PERFORM madlib.create_nb_prepared_data_tables('nb_training',
'class',
'attributes',
'ARRAY[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57]',
57,
'categ_feature_probs',
'numeric_attr_params',
'class_priors'
);
training_time := 1000* (extract(epoch FROM clock_timestamp()) - extract(epoch FROM start_time));
而且我預測的代碼去如下:
start_time := clock_timestamp();
PERFORM madlib.create_nb_probs_view('categ_feature_probs',
'class_priors',
'nb_testing',
'id',
'attributes',
57,
'numeric_attr_params',
'probs_view');
select * from probs_view
prediction_time := 1000 * (extract(epoch FROM clock_timestamp()) - extract(epoch FROM start_time));
的訓練數據包含450000條記錄測試數據集包含50000條記錄。
但是,我的平均訓練時間大約爲17173毫秒,其中預測時間爲26481毫秒。根據我對樸素貝葉的理解,預測時間應該小於training_time。我在這裏做錯了什麼?