【问题标题】:h2o.deeplearning in R, data structure errorR中的h2o.deeplearning,数据结构错误
【发布时间】:2018-01-07 17:12:22
【问题描述】:

我想使用 h2o.deeplearning 函数执行 DNN。为此,我们使用as.h2o 函数加载了数据。

我输入了以下代码来验证数据输入是否正确,结果只有十个观察值。数据共有 1,000 个观测值。

但是,当我使用as.h2o 函数加载数据时,只输入了十个数据。哪一部分错了?

这是我的 R 代码。

h2o.init(nthreads = -1, max_mem_size = "5G")
credit<-read.csv("http://freakonometrics.free.fr/german_credit.csv", header=TRUE)
deep_credit<-as.h2o(credit,destination_frame = "deep_credit")

h2o.str(deep_credit)
Class 'H2OFrame' <environment: 0x0000000035bb4ad8> 
 - attr(*, "op")= chr "Parse"
 - attr(*, "id")= chr "deep_credit"
 - attr(*, "eval")= logi FALSE
 - attr(*, "nrow")= int 1000
 - attr(*, "ncol")= int 21
 - attr(*, "types")=List of 21
  ..$ : chr "int"
  ..$ : chr "int"
  ..$ : chr "int"
  ..$ : chr "int"
  ..$ : chr "int"
  ..$ : chr "int"
  ..$ : chr "int"
  ..$ : chr "int"
  ..$ : chr "int"
  ..$ : chr "int"
  ..$ : chr "int"
  ..$ : chr "int"
  ..$ : chr "int"
  ..$ : chr "int"
  ..$ : chr "int"
  ..$ : chr "int"
  ..$ : chr "int"
  ..$ : chr "int"
  ..$ : chr "int"
  ..$ : chr "int"
  ..$ : chr "int"
 - attr(*, "data")='data.frame':    10 obs. of  21 variables:
  ..$ Creditability                    : num  1 1 1 1 1 1 1 1 1 1
  ..$ Account.Balance                  : num  1 1 2 1 1 1 1 1 4 2
  ..$ Duration.of.Credit..month.       : num  18 9 12 12 12 10 8 6 18 24
  ..$ Payment.Status.of.Previous.Credit: num  4 4 2 4 4 4 4 4 4 2
  ..$ Purpose                          : num  2 0 9 0 0 0 0 0 3 3
  ..$ Credit.Amount                    : num  1049 2799 841 2122 2171 ...
  ..$ Value.Savings.Stocks             : num  1 1 2 1 1 1 1 1 1 3
  ..$ Length.of.current.employment     : num  2 3 4 3 3 2 4 2 1 1
  ..$ Instalment.per.cent              : num  4 2 2 3 4 1 1 2 4 1
  ..$ Sex...Marital.Status             : num  2 3 2 3 3 3 3 3 2 2
  ..$ Guarantors                       : num  1 1 1 1 1 1 1 1 1 1
  ..$ Duration.in.Current.address      : num  4 2 4 2 4 3 4 4 4 4
  ..$ Most.valuable.available.asset    : num  2 1 1 1 2 1 1 1 3 4
  ..$ Age..years.                      : num  21 36 23 39 38 48 39 40 65 23
  ..$ Concurrent.Credits               : num  3 3 3 3 1 3 3 3 3 3
  ..$ Type.of.apartment                : num  1 1 1 1 2 1 2 2 2 1
  ..$ No.of.Credits.at.this.Bank       : num  1 2 1 2 2 2 2 1 2 1
  ..$ Occupation                       : num  3 3 2 2 2 2 2 2 1 1
  ..$ No.of.dependents                 : num  1 2 1 2 1 2 1 2 1 1
  ..$ Telephone                        : num  1 1 1 1 1 1 1 1 1 1
  ..$ Foreign.Worker                   : num  1 1 1 2 2 2 2 2 1 1

【问题讨论】:

    标签: r deep-learning h2o


    【解决方案1】:

    这是在 H2OFrames 上打印出 str() 函数的错误(几天前报告了 here),而不是实际错误。它在打印输出的顶部显示正确的行数:

    - attr(*, "nrow")= int 1000
    

    如果你在你的框架上使用nrow(),你会看到实际的行数是1000:

    > nrow(deep_credit)
    [1] 1000
    

    【讨论】:

    • 那么,你的意思是没问题吧???它只是一个 as.h2o 函数错误吗?结果用h2o.deeplearning函数作为这个数据是不是没问题???
    • 没错。打印输出是错误的(即使超过 10 行,它也总是显示 10 行,这就是为什么我们提交了一个错误来修复它)。您可以通过运行nrow(deep_credit)dim(deep_credit) 自行验证数据大小。
    猜你喜欢
    • 2018-01-09
    • 2017-12-10
    • 1970-01-01
    • 2016-12-06
    • 1970-01-01
    • 2011-04-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多