php-fann | PHP wrapper for FANN ( Fast Artificial Neural Network Library | Artificial Intelligence library

 by   bukka C Version: 1.2.0RC2 License: Non-SPDX

kandi X-RAY | php-fann Summary

kandi X-RAY | php-fann Summary

php-fann is a C library typically used in Artificial Intelligence applications. php-fann has no bugs, it has no vulnerabilities and it has low support. However php-fann has a Non-SPDX License. You can download it from GitHub.

This is a PHP wrapper for FANN (Fast Artificial Neural Network) library.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              php-fann has a low active ecosystem.
              It has 204 star(s) with 34 fork(s). There are 25 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 10 open issues and 25 have been closed. On average issues are closed in 221 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of php-fann is 1.2.0RC2

            kandi-Quality Quality

              php-fann has 0 bugs and 0 code smells.

            kandi-Security Security

              php-fann has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              php-fann code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              php-fann has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              php-fann releases are not available. You will need to build from source code and install.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of php-fann
            Get all kandi verified functions for this library.

            php-fann Key Features

            No Key Features are available at this moment for php-fann.

            php-fann Examples and Code Snippets

            No Code Snippets are available at this moment for php-fann.

            Community Discussions

            QUESTION

            I created and trainend a PHP-FANN but i dont get the desired results or accuraccy
            Asked 2021-Feb-04 at 08:16

            I created a FANN in PHP with the help of some examples and tutorial from geekgirljoy and based it on the ocr example from the php-fann-repo

            I'm trying to create a system which tells me, based on an order number, which type of order this is.

            I have crated the training data, trained and tested it, but can't get the result that I expect. I'm now at the point where random changing of parameters isn't helping anymore, and I'm not sure if my assumptions are correct in the beginning.

            A little of the training data: I got 60k lines of spaced splitted binary order numbers

            ...

            ANSWER

            Answered 2021-Feb-04 at 08:16

            Long story short, your dataset is likely too complex for such a small and simple network.

            When I wrote the OCR example, and I was kind of showing off a little by "compressing" all 94 chars into a single output neuron. It's not typically done this way and certainly not with complex datasets.

            Usually, you would want to dedicate an output neuron for each "class" that the network needs to identify.

            Put simply, its harder for the network to learn to properly increment or decrement the output value by 0.01 on a single neuron (as is the case of my OCR ANN) than to learn to associate a dedicated output neuron / pattern with a specific class.

            You can find a better example of a more typical classifier implementation in the MNIST subfolder in my repo for the OCR "family" of neural networks: https://github.com/geekgirljoy/OCR_Neural_Network

            My suggestion is to redesign your ANN.

            Based on your code your network looks like this:

            L0: IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII

            L1: HHHHHHHHHHHHHHHH

            L2: O


            Whereas it would probably operate (classify) your data better if you redesigned it like this:

            First, determine the number of distinct classes types, in the example you gave I saw 0.07 listed so I will assume there are seven different classes of order types.

            So, the ANN should look like this:

            L0: IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII

            L1: A sufficient number of "hidden" neurons

            L2: OOOOOOO

            Where O1 represents class 1, O2 class 2 etc...

            Which means that your training data would change to something like this:


            60000 32 7
            0 0 0 0 0 1 1 0 0 1 1 0 1 1 0 0 1 1 1 0 1 1 1 0 0 0 1 1 0 0 1 0
            1 0 0 0 0 0 0
            0 0 0 0 0 1 1 0 0 1 1 0 1 1 0 0 1 1 1 0 1 1 1 0 0 0 1 1 0 1 0 0
            1 0 0 0 0 0 0
            0 0 0 0 0 1 1 0 0 1 1 0 1 1 0 0 1 1 1 0 1 1 1 0 0 0 1 1 0 1 1 0
            1 0 0 0 0 0 0
            0 0 0 0 0 1 1 0 0 1 1 0 1 1 0 0 1 1 1 0 1 1 1 0 0 0 1 1 1 0 0 0
            1 0 0 0 0 0 0
            0 0 0 1 1 1 0 1 1 1 1 0 0 1 0 0 0 1 0 0 1 1 1 0 0 1 0 0 1 0 1 0
            0 0 0 0 0 0 1
            0 0 0 1 1 1 0 1 1 1 1 0 0 1 0 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 0 0
            0 0 0 0 0 0 1
            0 0 0 1 1 1 0 1 1 1 1 0 0 1 0 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0
            0 0 0 0 0 0 1
            0 0 0 1 1 1 0 1 1 1 1 0 0 1 0 0 0 1 0 0 1 1 1 0 0 1 0 1 0 0 0 0
            0 0 0 0 0 0 1

            Class Output Examples:

            Class 1: 1 0 0 0 0 0 0
            Class 2: 0 1 0 0 0 0 0
            Class 3: 0 0 1 0 0 0 0
            Class 4: 0 0 0 1 0 0 0
            Class 5: 0 0 0 0 1 0 0
            Class 6: 0 0 0 0 0 1 0
            Class 7: 0 0 0 0 0 0 1


            Also, depending on your methodology, you MAY get better results using a harder negative value like -1 instead of 0, like this:

            60000 32 7
            -1 -1 -1 -1 -1 1 1 -1 -1 1 1 -1 1 1 -1 -1 1 1 1 -1 1 1 1 -1 -1 -1 1 1 -1 -1 1 -1
            1 -1 -1 -1 -1 -1 -1
            -1 -1 -1 -1 -1 1 1 -1 -1 1 1 -1 1 1 -1 -1 1 1 1 -1 1 1 1 -1 -1 -1 1 1 -1 1 -1 -1
            1 -1 -1 -1 -1 -1 -1
            -1 -1 -1 -1 -1 1 1 -1 -1 1 1 -1 1 1 -1 -1 1 1 1 -1 1 1 1 -1 -1 -1 1 1 -1 1 1 -1
            1 -1 -1 -1 -1 -1 -1
            -1 -1 -1 -1 -1 1 1 -1 -1 1 1 -1 1 1 -1 -1 1 1 1 -1 1 1 1 -1 -1 -1 1 1 1 -1 -1 -1
            1 -1 -1 -1 -1 -1 -1
            -1 -1 -1 1 1 1 -1 1 1 1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 1 1 -1 -1 1 -1 -1 1 -1 1 -1
            -1 -1 -1 -1 -1 -1 1
            -1 -1 -1 1 1 1 -1 1 1 1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 1 1 -1 -1 1 -1 -1 1 1 -1 -1
            -1 -1 -1 -1 -1 -1 1
            -1 -1 -1 1 1 1 -1 1 1 1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 1 1 -1 -1 1 -1 -1 1 1 1 -1
            -1 -1 -1 -1 -1 -1 1
            -1 -1 -1 1 1 1 -1 1 1 1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 1 1 -1 -1 1 -1 1 -1 -1 -1 -1
            -1 -1 -1 -1 -1 -1 1


            This is because you are using a "symmetric" hidden/output function like FANN_SIGMOID_SYMMETRIC which is a sigmoid and so the relationship between -1 to 0 and from 0 to 1 isn't linear so you should get better/harder distinctions between classifications and potentially faster training / fewer training epochs by more strongly contrasting the inputs/outputs like this.

            Anyway, once you have trained the network and run your tests, you simply take the max() output neuron as your answer.

            Example:

            // ANN calc inputs and store outputs in the result array
            $result = fann_run($ann, $input);

            // Lets say the ANN responds like this:
            // [-0.9,0.1,-0.2,0.4,0.1,0.5,0.6,0.99,-0.6,0.4]

            // Let's also say there are 10 outputs representing that many classes
            // 0 - 9
            // [0,1,2,3,4,5,6,7,8,9]
            //
            // Find which output contains the highest value (the prediction/classification)
            $highest = max($result); // $highest now contains the value 0.99

            // So to convert the highest value to a class we find the key/position in the $result array
            $class = array_search($highest, $result);

            var_dump($class);
            // int(7)

            Why? Because the 7th key (7th / 8th (depending on how you look at it) is the high value):

            array(0=>0.9,
            1=>0.1,
            2=>-0.2,
            3=>0.4,
            4=>0.1,
            5=>0.5,
            6=>0.6,
            7=>0.99,
            8=>-0.6,
            0=>0.4
            );

            In the case of multiple class types being possible at the same time, you "softmax" instead.

            Hope this helps! :-)

            Source https://stackoverflow.com/questions/66022985

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install php-fann

            The extension can be installed on Linux and Windows.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/bukka/php-fann.git

          • CLI

            gh repo clone bukka/php-fann

          • sshUrl

            git@github.com:bukka/php-fann.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Artificial Intelligence Libraries

            Try Top Libraries by bukka

            php-jsond

            by bukkaC

            php-crypto

            by bukkaC

            phpc

            by bukkaC

            fpmi

            by bukkaC

            bmin

            by bukkaC++