2016-09-26 44 views
-1

我用h2o庫進行分類。我想知道它製作的每個節點的重量細節。假設我用model命名模型,如果我使用summary(model),它將只顯示每層的平均重量和平均偏差,我需要知道每個重量的細節。是否可以打印每個細節重量? 任何建議,將不勝感激。 很抱歉的可怕的英語R H2O - 詳細總結

train[1,] 
0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1 

train[2,] 
1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 2 

model = h2o.deeplearning(x = 1:100,y = 101 
         training_frame = train, 
         activation = "Tanh", 
         balance_classes = TRUE, 
         hidden = c(15,15), 
         momentum_stable = 0.99, 
         epochs = 50) 

Scoring History: 
      timestamp duration training_speed epochs iterations  samples training_rmse training_logloss 
1 2016-09-26 23:50:53 0.000 sec     0.00000   0 0.000000        
2 2016-09-26 23:50:53 0.494 sec 8783 rows/sec 5.00000   1 650.000000  0.81033   2.04045 
3 2016-09-26 23:50:53 1.053 sec 10586 rows/sec 50.00000   10 6500.000000  0.23170   0.22766 
    training_classification_error 
1        
2      0.63077 
3      0.00000 

這裏是我的模型的總結

layer units type dropout  l1  l2 mean_rate rate_rms momentum mean_weight weight_rms mean_bias bias_rms 
1  1 100 Input 0.00 %                       
2  2 15 Tanh 0.00 % 0.000000 0.000000 0.005683 0.001610 0.000000 0.004570 0.148204 -0.019728 0.061853 
3  3 15 Tanh 0.00 % 0.000000 0.000000 0.003509 0.000724 0.000000 0.003555 0.343449 0.007262 0.110244 
4  4 26 Softmax   0.000000 0.000000 0.010830 0.006383 0.000000 0.005078 0.907516 -0.186089 0.166363 
+1

您可以製作一個可重複使用的代碼示例嗎?像http://stackoverflow.com/questions/39597281/r-h2o-glm-issue-with-max-active-predictors有它嗎?所以我們都在同一頁面上。 – Spacedman

+0

由於人們不知道H2O是什麼,所以是「不清楚你所問的」的投票和關閉票嗎?!這是一個很明確的問題,具體的答案。 (即將回答...) –

回答

2

當你建立你的模型,設置標誌,以出口重量和偏見的某些部分。然後一旦建立模型,您可以使用h2o.weights()h2o.biases()

model = h2o.deeplearning(x = 1:100,y = 101 
        training_frame = train, 
        activation = "Tanh", 
        balance_classes = TRUE, 
        hidden = c(15,15), 
        momentum_stable = 0.99, 
        epochs = 50, 
        export_weights_and_biases = TRUE # <--- add this 
        ) 
firstLayerWeights = h2o.weights(model, 1) 
secondLayerWeights = h2o.weights(model, 2) 
+0

謝謝!有效。我錯過了文檔中的'export_weights_and_biases'。 – user6883698