1. Go to this page and download the library: Download ankane/libmf 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/ */
use Libmf\Loss;
new Libmf\Model(
loss: Loss::RealL2, // loss function
factors: 8, // number of latent factors
threads: 12, // number of threads used
bins: 25, // number of bins
iterations: 20, // number of iterations
lambdaP1: 0, // coefficient of L1-norm regularization on P
lambdaP2: 0.1, // coefficient of L2-norm regularization on P
lambdaQ1: 0, // coefficient of L1-norm regularization on Q
lambdaQ2: 0.1, // coefficient of L2-norm regularization on Q
learningRate: 0.1, // learning rate
alpha: 1, // importance of negative entries
c: 0.0001, // desired value of negative entries
nmf: false, // perform non-negative MF (NMF)
quiet: false // no outputs to stdout
);