本文整理匯總了PHP中Fields::missing_counts方法的典型用法代碼示例。如果您正苦於以下問題:PHP Fields::missing_counts方法的具體用法?PHP Fields::missing_counts怎麽用?PHP Fields::missing_counts使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Fields
的用法示例。
在下文中一共展示了Fields::missing_counts方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: test_scenario1
public function test_scenario1()
{
$data = array(array('filename' => 'data/iris_missing.csv', 'params' => array("fields" => array("000000" => array("optype" => "numeric"))), 'missing_values' => array("000000" => 1)));
print "Successfully obtaining missing values counts\n";
foreach ($data as $item) {
print "I create a data source uploading a " . $item["filename"] . " file\n";
$source = self::$api->create_source($item["filename"], $options = array('name' => 'local_test_source'));
$this->assertEquals(BigMLRequest::HTTP_CREATED, $source->code);
$this->assertEquals(1, $source->object->status->code);
print "check local source is ready\n";
$resource = self::$api->_check_resource($source->resource, null, 20000, 30);
$this->assertEquals(BigMLRequest::FINISHED, $resource["status"]);
print "I update the source with params ";
$source = self::$api->update_source($source->resource, $item["params"]);
print "create dataset with local source\n";
$dataset = self::$api->create_dataset($source->resource);
$this->assertEquals(BigMLRequest::HTTP_CREATED, $dataset->code);
$this->assertEquals(BigMLRequest::QUEUED, $dataset->object->status->code);
print "check the dataset is ready " . $dataset->resource . " \n";
$resource = self::$api->_check_resource($dataset->resource, null, 20000, 30);
$this->assertEquals(BigMLRequest::FINISHED, $resource["status"]);
print "When I ask for the missing values counts in the fields\n";
$fields = new Fields($resource["resource"]->object->fields);
print "Then the missing values counts dict is " . json_encode($item["missing_values"]) . "\n";
$this->assertEquals($item["missing_values"], $fields->missing_counts());
}
}