Download the PHP package wellingtonbarbosa/knn without Composer

On this page you can find all versions of the php package wellingtonbarbosa/knn. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package knn

k-Nearest Neighbors in PHP

A package to calculate Euclidean distance in a simple way, in addition to comparing results for recommendation quickly and symptomatically, without ifs.


How does it work?

Imagine that you are building a movie application, such as Netflix.

You want to recommend a movie to the user when the movie ends, but it needs to be a movie that looks like the one he just watched.

Your films in the database must have a percentage of each category, for example: romance, action, adventure, fiction, etc.

For each film, you enter the percentage of each category

A silly example:

The algorithm will use these percentages to perform the calculation

To understand how the euclidian calculation does work, please visit this link

Getting Started

1 - Install on your project via composer

2 - Use the class in your php file

3 - Create some items to test
In our example, $defaultItem is the movie the user has just watched, and the $itemsToCompare are movies drawn from the database. Let's see which of these is more like what our user just watched? So let's go!

! Note that all items have 4 indexes. All items must have the same number of indexes, or it will not work

4 - Instantiate the class in a variable
The last parameter passed is the number of indexes that ALL items have.

5 - Performs Euclidean distance calculation for each item

6 - Finally, we will get index (or indexes) of the items to recommend to our user
Note that in addition to the calculated results, there is a second parameter in the recommendation method. This is because there may be equal results in the calculation. If you pass TRUE, the method will return the index all results repeated. If you pass FALSE, the first one found will be returned

7 - Now, just look for the item that we will recommend

You can view this complete file by clicking here

Contributing

You can contribute to this package by forking the repository and developing new features and increments and sending the pull request!

Author

Wellington Carneiro Barbosa Wellington Barbosa
Instagram
LinkedIn

Facebook

License

This package is under the MIT License.

Any issue, tell me on github! I will help you.


All versions of knn with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wellingtonbarbosa/knn contains the following files

Loading the files please wait ....