对我的检查空值代码的结果感到困惑 [英] Confuse about the result of my check null value code

查看:69
本文介绍了对我的检查空值代码的结果感到困惑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图这样做来检查行是否为空.

I tried this to check whether a row is null or not.

package org.apache.spark.h2o.utils

import water.fvec.{NewChunk, Frame, Chunk}
import water._

class Miss extends MRTask {
  override def map(c: Chunk, nc: NewChunk): Unit = {
    for (row <- 0 until c.len()) {
      if(c.atd(row) == 0){  
       nc.addNum(0)
      }
      else
       nc.addNum(1)
    }
  }
}

在这里我不明白我的代码的结果

And I can not understand the result of my code here

           A    B    C    D            E   check
    min                                     0
   mean                                     0
 stddev                                     0
    max                                     1
missing                                     0
      0  5.1  3.5  1.4  0.2  Iris-setosa    1
      1  4.9    3  1.4  0.2  Iris-setosa    1
      2  4.7  3.2  1.3  0.2  Iris-setosa    1
      3  4.6  3.1  1.5  0.2  Iris-setosa    1
      4    5  3.6  1.4  0.2  Iris-setosa    1
      5  5.4  3.9  1.7  0.4  Iris-setosa    1
      6  4.6  3.4  1.4  0.3  Iris-setosa    1
      7    5  3.4  1.5  0.2  Iris-setosa    1
      8  4.4  2.9  1.4  0.2  Iris-setosa    1
      9  4.9  3.1  1.5  0.1  Iris-setos...

在代码生成检查列中,为什么我的最大行是1?我是h2oFrame的新手,有人可以帮助我理解这一点吗?我的代码有问题吗?谢谢

In the code generate check column, Why my max row is 1? I'm new to h2oFrame, can anyone help me understand this? IS there something wrong with my code? Thx

推荐答案

您要追加一个仅包含0,1值的新列. 因此,存储在该列中的最小值是0.存储在该列中的最大值是1.在这种情况下,mean == 0是可疑的,这可能是一个错误.

you are appending a new column which includes only 0,1 values. Hence minimum value stored in the column is 0. Maximum value stored in the column is 1. In this case, mean==0 is suspicious, that's probably a bug.

这篇关于对我的检查空值代码的结果感到困惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆