2016-09-26 65 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