Download the PHP package divineomega/eloquent-attribute-value-prediction without Composer

On this page you can find all versions of the php package divineomega/eloquent-attribute-value-prediction. 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 eloquent-attribute-value-prediction


🖥️🧠💪 Eloquent Attribute Value Prediction

❤️ Machine Learning For Laravel Developers! ❤️


With this package you'll be able to predict attribute values for your Laravel Eloquent models using the power of machine learning! 🌟

With an intuitive syntax you can predict the values of both categorical (string) and continuous (numeric) attributes. Take a look at the examples below.

Installation

To install just run the following Composer command.

After installation, you need to set up your model for attribute prediction.

Setup

Let's say you have an IrisFlowers table that contains data about each of three species of the Iris flower. In this example, we want to be able to predict the flower's species given the sepal length and width, and petal length and width.

First, we need to set up out IrisFlower model for attribut prediction.

This is done by adding the HasPredictableAttributes interface and PredictsAttributes trait to our model as shown below.

We then need to tell our model which attributes we wish to predict. We do this by adding the registerPredictableAttributes() function.

In this example, we want to use predict the species attribute based on the sepal_length, sepal_width, petal_length, and petal_width attributes. This can be done by returning an array in the following format.

You also need to add the attributes you are using to the $casts array. It is important that the machine learning algorithm knows the type of data stored in each attribute, and that it is consistent.

For our IrisFlower example, the following format is appropriate.

Training

Before you can make attribute value predictions, you must train a machine learning model on your data. As a general rule, the more data you provide your model, the better it will perform, and the more accurate it will be.

You can train your model(s) using the eavp:train Artisan command, as shown in the example below.

One model will be trained for each of the attributes you wish to predict. When they are trained, they will be saved into the storage/eavp/model/ directory for future use.

Be aware that the training process can take some time to complete depending on the amount of data you are using, and the complexity of your machine learning model. Training progress will be output to the console where possible.

You can re-run this command (manually, or on a schedule) to re-train your machine learning model(s). Previously trained models will be replaced automatically.

Prediction

Once you have set up your Eloquent model, and trained your machine learning model(s), you can begin predicting attributes.

For example, to predict the species of an Iris flower, you can create a new IrisFlower object and populate a few of its known attributes, then call the predict method.

The predict method should be passed the attribute name you wish to predict. It will then returns the prediction as a string or numeric type.

In our example, this should be the 'setosa' species, based on Iris flower data set.

Advanced

Prediction confidence

If you wish, you can also retrieve the machine learning model's confidence that a prediction is correct. This is done with the getPredictions method.

In this example, you can see that the machine learning model is ~70% confident the flower is a Setosa, ~30 confident the flower is a Versicolor, and 0% confident the flower is a Virginica.

Note that you can only use the getPredictions method if the attribute you are attempting to predict the value of is non-numeric.

Changing attribute estimators

By default, attribute values are predicted using K-d Neighbors. This is a more efficient form of a standard K Nearest Neighbors algorithm.

The machine learning algorithm that is used to predict your attribute values is known as an 'estimator'. If you wish, you can modify the estimator which is used for each attribute.

To do this, you need to add a registerEstimators method to your model.

In the example above, we are changing the estimator for the species attribute to a multilayer perceptron classifier (neural network) with two densely connected hidden layers.

Under the hood, this package uses the Rubix ML library. This means you can use any estimator is supports.

See the Choosing an Estimator page for a list of all available estimators you can use for attribute prediction.


All versions of eloquent-attribute-value-prediction with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
laravel/framework Version ^5.1||^6.0||^7.0||^8.0
rubix/ml Version 0.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 divineomega/eloquent-attribute-value-prediction contains the following files

Loading the files please wait ....