Questions tagged [php-ml]

PHP-ML is a a fresh approach to Machine Learning in PHP. Algorithms, Cross Validation, Neural Network, Preprocessing, Feature Extraction and much more in one library.

31 questions
1
vote
2 answers

Using samples() with php-ml

I am using php-ml and taking in a .csv file with 6 columns and thousands of lines, i want every 5th element (column) of each array to be saved in $samples. I have tried the following which gives me the first element of each array. $dataset = new…
johnfish92
  • 157
  • 2
  • 12
0
votes
0 answers

How to use php-ai/php-ml and K-means clustering to sort sentences into similar groups?

I'm trying to sort an array of sentences into groups depending on how similar the words are in each sentence. I want the user to specify how strict or loose the grouping should be so the K-means clustering algorithm looks like a good fit as you can…
Mr J
  • 2,655
  • 4
  • 37
  • 58
0
votes
0 answers

prediction price A non-numeric value encountered on LeastSquares

I have an error appears when I execute my classe : PHP Warning: A non-numeric value encountered in /php-ai/php-ml/src/Regression/LeastSquares.php What I tried to do it's to scrap some price for a product and use a regression approach to make a…
Mark
  • 1
  • 1
0
votes
0 answers

How to identitify which title is comes under book and non book category using PHP-ML

I'm trying to write code using NLP (I used PHP-ML Library), This is the code I tried to write but when I try check Non Book title for example phone (Tecno POP 7 Pro (Uyuni Blue, 2GB RAM,64GB Storage) | Type C Port | 12MP Dual Camera | Up to 4GB RAM…
Emanuela
  • 11
  • 3
0
votes
1 answer

I am facing problem in using PHP-ML Persistency feature. The model is not working as expected

I am building a model to analyze sentences whether positive or negative. After the model is successfully trained, I am trying to save the model using PHP-ML Persistency. The model is being saved successfully as well. But the problem is when I…
user21208635
0
votes
1 answer

Can PHP ML have multiple label values?

According to the example given here: https://php-ml.readthedocs.io/en/latest/machine-learning/datasets/array-dataset/ One dataset can have one label. I am brand new to ML and am trying to classify articles that have multiple categories per article…
Antony
  • 3,875
  • 30
  • 32
0
votes
0 answers

Text file not written on the server

I try to write a file on my server, but I don't understand what's happening : it's always empty (blank page). There is no error thrown. When I insert inside the loop a var_dump($lines), I see the data but at the moment an error appear With the code…
Arthur
  • 11
  • 1
0
votes
1 answer

How add new samples to the same label using Naive Bayes on php-ml?

I am newbie on Text Classification and I am trying to create some proof-of-concepts to understand better the concepts of ML using PHP. So I got this example, and I've tried to add a new small text to "reinforce" one of my labels (categories), in…
celsowm
  • 846
  • 9
  • 34
  • 59
0
votes
1 answer

PHP-ML machine learning script predict winning team

I am using this script https://php-ml.readthedocs.io/en/latest/ to predict the result of a particular game. The training dataset looks like this: team1, team2, H team3, team4, A team6, team12, D team1, team4, ? H, A, D being the results (Home,…
0
votes
0 answers

"Division by zero"/ NULL values TF-IDF

I'm trying to test tf-idf package from PHP-ML, I tried using their documentation code but it keeps giving me "Division by zero" when I try to use different samples(strings). use Phpml\FeatureExtraction\TfIdfTransformer; $samples = [ ["Tareq",…
Tghosh
  • 180
  • 3
  • 14
0
votes
3 answers

How to populate sample in php machine learning library

$samples = [[0], [5], [10], [20], [25], [18], [30]]; $labels = ['fail', 'fail', 'pass', 'pass']; $classifier = new NaiveBayes(); $classifier->train($samples, $labels); echo $classifier->predict([14]); The above code is from php machine library…
Husnain
  • 137
  • 1
  • 9
0
votes
1 answer

How to exclude attributes from clustering in PHP-ML?

I have students data and I want to cluster them according to there attributes. The problem is that the student_id shouldn't be used in the clustering process, because it has nothing to do with the clustering, and I cannot just remove the student_id,…
user3379482
  • 557
  • 1
  • 10
  • 21
0
votes
3 answers

Convert array to another character [php]

I have data in the form: $data = Array ( [0] => 1 [1] => 4 [2] => 3 [3] => 3 ) I want to convert it to: $x = [[1], [2], [3], [4]]; I do not know how to do this? I'm using the library PHP-ML (…
Wojtek
  • 51
  • 1
  • 2
  • 8
0
votes
0 answers

PHP namespaces not being recognized

I'm a bit new to PHP and I'm still learning about namespaces. Right now I'm trying to impliment "PHP-ML" a machine learning project from github http://php-ml.readthedocs.io/en/v0.1.0/ It has an example included right in the index file itself, but…
-1
votes
1 answer

why can't using variable in php-ml least square?

where in php-ml looping variable is always error array_unshift like this: Fatal error: Uncaught TypeError: array_unshift() expects parameter 1 to be array, string given in C:\xampp\htdocs\prediksi\assets\main…