PHP code example of bratao / prediction-io

1. Go to this page and download the library: Download bratao/prediction-io library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bratao / prediction-io example snippets


    'Bratao\PredictionIO\PredictionServiceProvider'

    'Prediction'      => 'Bratao\PredictionIO\Facade',

	'predictionio' => array(
		'api' => 'http://localhost:8000/',
		'key' => '0250b3f85ce33284f77c77f36b41010ef2c4fc5c',
	),



// populate with users, items and actions
Prediction::createUser($userId);
Prediction::createItem($itemId);
Prediction::recordAction($userId, $itemId, 'view');

//Get a User or a Item
$item = Prediction::getUser($userId);
$user = Prediction::getItem($itemId);

//Delete a user or a item
Prediction::deleteUser($userId);
Prediction::deleteItem($itemId);

// get recommendations and similar items
$recommendations = Prediction::getRecommendations($userId, $engine, $count);
$similarItems = Prediction::getSimilarItems($itemId, $engine, $count);