BigML PHP SDK for bigml.com api access
- Simple API access from php
- Cover data transfromation json => array , array=>json and error handling
- Implemntation resources: source, dataset, model, prediction, evaluation
- Add this to your composer.json:
"require": {
"necromant2005/bigml-php-sdk": "1.*",
}
- Now tell composer to download BigMl PHP SDK by running the command:
$ php composer.phar update
Creating source resource with API version "andromeda"
use BigMl\Client\BigMl;
$source = BigMl::factory('source', array(
'username' => 'alfred',
'api_key' => '79138a622755a2383660347f895444b1eb927730',
));
Creating source resource in develoment mode with specific api version
use BigMl\Client\BigMl;
$source = BigMl::factory('source', array(
'username' => 'alfred',
'api_key' => '79138a622755a2383660347f895444b1eb927730',
'access_point' => 'https://bigml.io/dev/',
'version' => 'andromeda',
));
Using custom prediction Access Point for dedidated BigML AWS prediction instance
use BigMl\Client\BigMl;
$source = BigMl::factory('source', array(
'username' => 'alfred',
'api_key' => '79138a622755a2383660347f895444b1eb927730',
'access_point' => 'https://bigml.io/dev/',
'access_point_prediction' => 'https://prediction.dev.bigml.io/',
'version' => 'andromeda',
));
Creating resource through factory
use BigMl\Client\BigMl;
BigMl::factory('source', array( ... )); // source
BigMl::factory('dataset', array( ... )); // dataset
BigMl::factory('model', array( ... )); // model
BigMl::factory('prediction', array( ... )); // prediction
BigMl::factory('evaluation', array( ... )); // evaluation
Create source data
use BigMl\Client\BigMl;
$source = BigMl::factory('source', array( ... ));
$source->create(array('data' => array(
'a', 'b', 'c',
1, 2, 3,
4, 5, 7
)));
Create source remote
use BigMl\Client\BigMl;
$source = BigMl::factory('source', array( ... ));
$source->create(array('remote' => 's3://bigml-public/csv/iris.csv'));
Get info about source
use BigMl\Client\BigMl;
$source = BigMl::factory('source', array( ... ));
$source->retrieve('source/4f510d2003ce895676000069');
Get info with waiting til the process is finished and checking status every 10 seconds
use BigMl\Client\BigMl;
$source = BigMl::factory('source', array( ... ));
$source->wait('source/4f510d2003ce895676000069', 10);
Find source with name 'iris'
use BigMl\Client\BigMl;
$source = BigMl::factory('source', array( ... ));
$source->retrieve('source', array(
'name' => 'iris'
));
Rename source
use BigMl\Client\BigMl;
$source = BigMl::factory('source', array( ... ));
$source->update('source/4f510d2003ce895676000069', array(
'name' => 'iris-new'
));
Remove sorce
use BigMl\Client\BigMl;
$source = BigMl::factory('source', array( ... ));
$source->delete('source/4f510d2003ce895676000069');
Make prediction
use BigMl\Client\BigMl;
$service = BigMl::factory('prediction', array( ... ));
$service->create(array(
'model' => 'model/57510d2003ce895676000069',
'input_data' => array(
'000000' => 'value1',
'000001' => 'valu2',
),
'name' => 'my-prediction',
));