【发布时间】:2012-03-18 22:44:24
【问题描述】:
我在 PHP 中使用 Google 预测 API。
使用 OAuth 2.0 成功完成授权。我将数据保存在云端的 csv 文件中。我在 Training 类中使用 setDataLocation 方法给出了它的位置。但是在训练/插入数据时出现以下错误:
致命错误:未捕获的异常“apiException”,消息“未知” 函数:->->insert()' in C:\xampp\htdocs\google-api-php-client\src\service\apiServiceResource.php:81 堆栈跟踪:#0 C:\xampp\htdocs\google-api-php-client\src\contrib\apiPredictionService.php(60): apiServiceResource->__call('insert', Array) #1 C:\xampp\htdocs\google-api-php-client\examples\analytics\new2.php(51): 训练模型服务资源->插入(对象(apiPredictionService), Array) #2 {main} 投入 C:\xampp\htdocs\google-api-php-client\src\service\apiServiceResource.php 在第 81 行
这是我的代码 sn-p:
if ($client->getAccessToken()) {
$data = array();
$buzzy = new Training();
$predictionService = new apiPredictionService($client);
$trainedmodels = $predictionService->trainedmodels;
$buzzzy = new TrainedmodelsServiceResource();
$me = $buzzy->setStorageDataLocation('my_data.csv');
$mee = $buzzy->getStorageDataLocation();
// $ma = $buzzy->getTrainingStatus();
$setid_in = $buzzy->setId($buzzy->getStorageDataLocation());
$setid_out = $buzzy->getId();
echo $setid_out;
//print_r($predictionService);
//$insert_1 = $buzzzy->insert($buzzy,array());
// This is line 81 in my code:
$insert2=$trainedmodels->insert($predictionService,array());
}
我无法继续进行。我打算训练然后调用预测函数。
【问题讨论】:
标签: php google-prediction