GithubHelp home page GithubHelp logo

php-ml-examples's Introduction

PHP-ML - Machine Learning library for PHP - Examples

Examples of the use of PHP-ML library

Projects

Interesting demo/examples projects using php-ml:

Articles

Many of samples from this repository was used in my articles

Examples

To test example, select one of the following and run it from main folder (each category has its own folder).

php classification/languageDetection.php

Classification:

  • languageDetection.php - classifier build for language detection
  • minst.php - recognize handwritten digits from MNIST dataset (to download dataset use bin/download-mnist.sh)
  • spamFilter.php - simple spam filter with example dataset
  • bbc.php - example of text classification

Regression:

  • wineQuality.php - regression model to assess the quality of the wine

License

PHP-ML is released under the MIT Licence. See the bundled LICENSE file for details.

Author

Arkadiusz Kondas (@ArkadiuszKondas)

php-ml-examples's People

Contributors

akondas avatar gplanchat avatar sezekiel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-ml-examples's Issues

Mapping from clustering result to sample document

I am trying to cluster some text documents. I am using TfIdfTransformer and DBSCAN. I get the result in array format with some array groups with score numbers. What i like is to map this output with the actual samples, to find out which actual documents are clustered together, is there any easy way to map it ?

new FilesDataset('data/') returns empty

Hi,

I cannot get a result for $dataset. It keeps returning an empty array. Banging my head against the wall trying different solutions. The data is there in plain text, put there by file_put_contents. The data is in data/001.txt. I have tried different subfolder and filename.

Trying to follow the instructions for FilesDataset, and the BBC Text data classification.
Links:
https://php-ml.readthedocs.io/en/latest/machine-learning/datasets/files-dataset/
https://arkadiuszkondas.com/text-data-classification-with-bbc-news-article-dataset/

PHP code is as follows:

`

use Phpml\CrossValidation\StratifiedRandomSplit;
use Phpml\Dataset\FilesDataset;

$dataset = new FilesDataset('data/');

$split = new StratifiedRandomSplit($dataset, 0.2);
$samples = $split->getTrainSamples();

echo $samples[0]; // Mutant book wins Guardian prize ...
`
Any assistance would be great, I can't find any solution for this, and even looking at files and Classes in the app, just cannot figure out what is going wrong. Not getting any errors from PHP.

Question: Fraud Seller Prediction

I am checking a solution to prevent "fraudster" to create "store/ecommerces" to sell products as a fraud only.

Example:
Product: Stove brand Consul
Price: 100
Real price at normal shoppings: 500

Product: Washing machine Eletroclux
Price: 119
Real price at normal shoppings: 900

I am new in Machine Learning, so I would like a suggestion.

Tags recommendations?

I want to build a system, that recommends tags based on post text.
Can you help me with that?
It is similar to the language example, right? But one post can have more than 1 tag.
Can you help me a bit?

libsvm error

whenever i use the SVC in php-ml i got the next error always?
Fatal error: Uncaught Phpml\Exception\LibsvmCommandException: Failed running libsvm command: "C:\Users\aliam\Desktop\Web Project\We-Drive\View\vendor\php-ai\php-ml\bin\libsvm\svm-train.exe -s 0 -t 0 -c 1000 -n 0.500000 -d 3 -r 0 -p 0.100000 -m 100.000000 -e 0.001000 -h 1 -b 0 "C:\Users\aliam\Desktop\Web Project\We-Drive\View\vendor\php-ai\php-ml\var\phpml642e68b9e1e906.60547680" "C:\Users\aliam\Desktop\Web Project\We-Drive\View\vendor\php-ai\php-ml\var\phpml642e68b9e1e906.60547680-model"" with reason: "operable program or batch file." in C:\Users\aliam\Desktop\Web Project\We-Drive\View\vendor\php-ai\php-ml\src\SupportVectorMachine\SupportVectorMachine.php:163 Stack trace: #0 C:\Users\aliam\Desktop\Web Project\We-Drive\Controller\chatbot.php(33): Phpml\SupportVectorMachine\SupportVectorMachine->train(Array, Array) #1 {main} thrown in C:\Users\aliam\Desktop\Web Project\We-Drive\View\vendor\php-ai\php-ml\src\SupportVectorMachine\SupportVectorMachine.php on line 163

TokenCountVectorizer give null as result

tested via the documentation on latest php-ml

$vectorizer = new TokenCountVectorizer(new WhitespaceTokenizer());

$samples = [
  'Lorem ipsum dolor sit amet dolor',
  'Mauris placerat ipsum dolor',
  'Mauris diam eros fringilla diam',
];

// Build the dictionary.
$vectorizer->fit($samples);

// Transform the provided text samples into a vectorized list.
$test = $vectorizer->transform($samples);

var_dump($test); ===> null

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.