I am using the Google Prediction API in PHP.
The authorization is done successfully using OAuth 2.0. I have my data in csv files on the cloud. I gave its location using setDataLocation method in Training class. But I got the following error while training/inserting data:
Fatal error: Uncaught exception 'apiException' with message 'Unknown function: ->->insert()' in C:\xampp\htdocs\google-api-php-client\src\service\apiServiceResource.php:81 Stack trace: #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): TrainedmodelsServiceResource->insert(Object(apiPredictionService), Array) #2 {main} thrown in C:\xampp\htdocs\google-api-php-client\src\service\apiServiceResource.php on line 81
This is my code snippet:
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());
}
I am unable to proceed further. I plan to train and then call predict function.