bukka / php-fann Goto Github PK
View Code? Open in Web Editor NEWPHP wrapper for FANN (Fast Artificial Neural Network Library)
License: Other
PHP wrapper for FANN (Fast Artificial Neural Network Library)
License: Other
First thanks for bring FANN to php. also we need more documentation in PHP based application.
Notice: -Werror=format-security is now included in the default build option in Fedora.
Hi!
I'm trying to use fann_set_callback based on your test:
https://github.com/bukka/php-fann/blob/master/tests/fann_set_callback_basic.phpt
When I run it, callback function is called only once. And if I try to save result to file in the end of the test I get error. So I added:
fann_save($ann, dirname( __FILE__ ) . "/fann_result.net");
and get:
PHP Warning: fann_save() expects parameter 1 to be resource, null given in fann_callback_test.php on line 40
Indeed, $ann is null. Without setting callback everything is fine. Any ideas?
Thanks, Alex.
Hi Bukka,
first of all: great job on the binder!
I'm sadly not familiar with PHP extensions so I can't fix this without much effort.
fann_set_callback() is working but the PHP function will cause a segmentation fault when it returns a positive integer.
However, it is required for the callback to return an integer, that's why your test is failing.
https://github.com/bukka/php-fann/blob/master/tests/fann_set_callback_basic.phpt
Your test example for fann_set_callback() is not returning an integer, this causes the training to be interrupted.
That's why you only get one callback and it stops, that's an error in your test script.
Look here please: http://libfann.github.io/fann/docs/files/fann_data-h.html#fann_callback_type
The callback function is supposed to be called during training (each epoch as configured).
With PHP however it's not working at all.
When you return 0 it will abort just like a -1 will abort.
when you return a positive number it will cause a segfault (apache process crashes or php cli crashes)
Now later looking at your implementation it's obvious you actually had the right behaviour in mind but forgot testing the second case.
PHP doc should say that return of false means an abort and return of true causes the training to continue.
You can test it in your own example, just "return 1" at the end of the callback and it will segfault.
Tested with libfann 2.2 and your latest extension
php-fann is not yet compatible with PHP 7
Hello. I'm encountered an error in fann_save function.
Layers:
2, 500, 500, 250, 125, 3
When I using this function for save model into file, it's export leads to data loss.
I'm using this model for saving picture (100x100) into network (with redundancy), but when I use fann_create_from_file, and then fann_run, my picture becomes completely different, and does not coincide with the previous result.
Is there another source for the windows DLLs ?
Running PHP on Windows 10 Pro.
PHP Version: PHP 8.2.12 Thread safe version
ph-_fan.dll version: Tried both 8.1 and 7.4
php_fann-1.2.0rc2-8.1-ts-vs16-x64
php_fann-1.1.1-7.4-ts-vc15-x64
PHP.ini entries:
extension_dir="C:\xampp\php\ext"
extension="C:\xampp\php\ext\php_fann.dll"
"doublefann.dll" placed in C:/xampp/php which is included in the system PATH variable.
Directory listing:
dir C:\xampp\php\ext\php_fann.dll
Volume in drive C is OS
Volume Serial Number is A88E-9D2F
Directory of C:\xampp\php\ext
01/19/2024** 11:37 AM 91,648 php_fann.dll
1 File(s) 91,648 bytes
0 Dir(s) 197,248,303,104 bytes free
Error when starting PHP:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_fann.dll' (tried: C:\xampp\php\ext\php_fann.dll (The
specified module could not be found), C:\xampp\php\ext\php_C:\xampp\php\ext\php_fann.dll.dll (The specified module could not be found)) in Unknown on line 0
Hi @bukka,
When trying to use the [FANN Windows DLLs] (https://pecl.php.net/package/fann) I have encountered the following errors:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_fann.dll' - %1 is not a valid Win32 application.
in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_fann.dll' - %1 is not a valid Win32 application.
in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\fanndouble.dll' - The specified module could not be found.
in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\fanndouble.dll' - The specified module could not be found.
in Unknown on line 0
Note that extension=php_fann.dll & extension=fanndouble.dll have been added to the PHP.ini file.
Development environment is:
Windows 10 build 14393 (Windows 10) i586
XAMPP Control Panel v3.2.2
Apache 2.4
PEAR Version: 1.10.1
PHP Version: 7.1.1
Zend Engine Version: 3.1.0
Is it possible to rebuild the dll files or advise how I might do so?
Thank you,
Joy
Hello,
I installed the php-fann on my mac and i tried several ways to load the lib but all reuslts to the same issue:
[18-Feb-2020 17:32:14 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/MAMP/htdocs/OCRNN/Basic/FANN/php-fann/modules/fann.so' (tried: /Applications/MAMP/htdocs/OCRNN/Basic/FANN/php-fann/modules/fann.so (dlopen(/Applications/MAMP/htdocs/OCRNN/Basic/FANN/php-fann/modules/fann.so, 9): Library not loaded: libfann.2.dylib
Referenced from: /Applications/MAMP/htdocs/OCRNN/Basic/FANN/php-fann/modules/fann.so
Reason: unsafe use of relative rpath libfann.2.dylib in /Applications/MAMP/htdocs/OCRNN/Basic/FANN/php-fann/modules/fann.so with restricted binary), /Applications/MAMP/bin/php/php7.3.8/lib/php/extensions/no-debug-non-zts-20180731///Applications/MAMP/htdocs/OCRNN/Basic/FANN/php-fann/modules/fann.so.so (dlopen(/Applications/MAMP/bin/php/php7.3.8/lib/php/extensions/no-debug-non-zts-20180731///Applications/MAMP/htdocs/OCRNN/Basic/FANN/php-fann/modules/fann.so.so, 9): image not found)) in Unknown on line 0
When i try "make test" it gives me all good
But i noticed the tests are made in a different php instance. I am trying it on the MAMP php. How do i do fix this on MAMP Application?
I've noticed that this project appears to be inactive. However, I'm hoping that someone will create a branch that works with HHVM. I haven't actually tried it with HHVM yet, though I've noticed that the docs say that FANN isn't supported in HHVM. If someone knows if it's incompatible or just that the team doesn't support FANN, I'd love to know.
At some point I'll try installing it on HHVM to play with, and I'll report my findings if I don't hear differently.
Any plan please to upgrade the wrapper for PHP 8.2 ? thanks
FANN does not work with PHP 8.1. (Ubuntu 20.04)
/tmp/pear/temp/fann/fann.c:1192:12: warning: passing argument 1 of ‘php_stat’ from incompatible pointer type [-Wincompatible-pointer-types]
1192 | php_stat(path, (php_stat_len) path_len, FS_IS_R, &retval TSRMLS_CC);
In file included from /tmp/pear/temp/fann/fann.c:28:
/usr/include/php/20210902/ext/standard/php_filestat.h:44:35: note: expected ‘zend_string *’ {aka ‘struct _zend_string *’} but argument is of type ‘char *’
44 | PHPAPI void php_stat(zend_string *filename, int type, zval *return_value);
etc.
ERROR: `make' failed
===
EDIT: git-clone and manual install works fine, but not PECL installation.
The following script will cause segfault on version 1.1.0:
<?php
$num_input = 2;
$num_output = 1;
$num_layers = 3;
$num_neurons_hidden = 3;
$ann = fann_create_standard($num_layers, $num_input, $num_neurons_hidden, $num_output);
// destroy is the key - there is no segfault without it
fann_destroy($ann);
$ann = fann_create_standard($num_layers, $num_input, $num_neurons_hidden, $num_output);
var_dump($ann);
// now any accesss will segfault
var_dump(fann_get_errno($ann));
Hi,
Can you please add the tests directory and files to the package.xml so they are included in the next release tarball.
As a package maintainer (RPM), I think it's usefull to run the regression test suite during build.
Thanks.
Can't setup the SARprop algorithm temperature. No LibFANN functions exported to extension?
php -r "fann_get_sarprop_temperature();"
PHP Fatal error: Uncaught Error: Call to undefined function fann_get_sarprop_temperature() in Command line code:1
php -r "fann_set_sarprop_temperature(0.02);"
PHP Fatal error: Uncaught Error: Call to undefined function fann_set_sarprop_temperature() in Command line code:1
All versions information:
lsb_release -a
Description: Debian GNU/Linux 8.11 (jessie)
uname -m
x86_64
php -v
PHP 7.3.7-2+0~20190725.42+debian8~1.gbp848ca5 (cli) (built: Jul 25 2019 12:55:45) ( NTS )
php --re fann | head -1
Extension [ <persistent> extension #22 fann version 1.1.1 ] {
php -r "echo FANN_VERSION;"
2.1
cascade_min_out_epochs
and cascade_min_cand_epochs
cause the net to be rejected with:
Warning: fann_create_from_file(): Invalid configuration file '/.../test.net'
Loads properly if these lines are manually removed.
Broken file - generated with a C program using the C libfann bindings
FANN_FLO_2.1
num_layers=2
learning_rate=0.700000
connection_rate=1.000000
network_type=1
learning_momentum=0.000000
training_algorithm=2
train_error_function=0
train_stop_function=1
cascade_output_change_fraction=0.010000
quickprop_decay=-0.000100
quickprop_mu=1.750000
rprop_increase_factor=1.200000
rprop_decrease_factor=0.500000
rprop_delta_min=0.000000
rprop_delta_max=50.000000
rprop_delta_zero=0.100000
cascade_output_stagnation_epochs=12
cascade_candidate_change_fraction=0.010000
cascade_candidate_stagnation_epochs=12
cascade_max_out_epochs=150
cascade_min_out_epochs=50
cascade_max_cand_epochs=150
cascade_min_cand_epochs=50
cascade_num_candidate_groups=8
bit_fail_limit=8.99999976158142089844e-01
cascade_candidate_limit=1.00000000000000000000e+03
cascade_weight_multiplier=4.00000005960464477539e-01
cascade_activation_functions_count=1
cascade_activation_functions=5
cascade_activation_steepnesses_count=1
cascade_activation_steepnesses=1.00000000000000000000e+00
layer_sizes=10 1
scale_included=0
neurons (num_inputs, activation_function, activation_steepness)=(0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (10, 0, 5.00000000000000000000e-01)
connections (connected_to_neuron, weight)=(0, -8.53989869356155395508e-02) (1, 9.92579981684684753418e-02) (2, 2.90860012173652648926e-02) (3, 4.82512935996055603027e-02) (4, -4.05620932579040527344e-02) (5, 7.28568211197853088379e-02) (6, -9.54733937978744506836e-02) (7, -2.13279575109481811523e-02) (8, -5.90266659855842590332e-02) (9, -6.11373335123062133789e-02)
Loading file, with the offending lines manually removed.
FANN_FLO_2.1
num_layers=2
learning_rate=0.700000
connection_rate=1.000000
network_type=1
learning_momentum=0.000000
training_algorithm=2
train_error_function=0
train_stop_function=1
cascade_output_change_fraction=0.010000
quickprop_decay=-0.000100
quickprop_mu=1.750000
rprop_increase_factor=1.200000
rprop_decrease_factor=0.500000
rprop_delta_min=0.000000
rprop_delta_max=50.000000
rprop_delta_zero=0.100000
cascade_output_stagnation_epochs=12
cascade_candidate_change_fraction=0.010000
cascade_candidate_stagnation_epochs=12
cascade_max_out_epochs=150
cascade_max_cand_epochs=150
cascade_num_candidate_groups=8
bit_fail_limit=8.99999976158142089844e-01
cascade_candidate_limit=1.00000000000000000000e+03
cascade_weight_multiplier=4.00000005960464477539e-01
cascade_activation_functions_count=1
cascade_activation_functions=5
cascade_activation_steepnesses_count=1
cascade_activation_steepnesses=1.00000000000000000000e+00
layer_sizes=10 1
scale_included=0
neurons (num_inputs, activation_function, activation_steepness)=(0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (10, 0, 5.00000000000000000000e-01)
connections (connected_to_neuron, weight)=(0, -8.53989869356155395508e-02) (1, 9.92579981684684753418e-02) (2, 2.90860012173652648926e-02) (3, 4.82512935996055603027e-02) (4, -4.05620932579040527344e-02) (5, 7.28568211197853088379e-02) (6, -9.54733937978744506836e-02) (7, -2.13279575109481811523e-02) (8, -5.90266659855842590332e-02) (9, -6.11373335123062133789e-02)
fann.h doesn't seem to exist so the ./configure script gives the error:
"configure: error: Cannot find libfann headers"
This is on OSX 10.9.5
I could install fann in ubunto 12.04 without problems.
I run the example: php simple_train.php and got an error
in both command line and in browser as http://localhost/simple_train.php
*in command line the fatal error related to a not identified neural function is reported.
*in browser does not return anything.
please advice thank you.
Saturn
ps: i installed xampp in windows too but the installation of library there seems much more complicated.
PHP fann extension not working
My enviroment
Operating system : Windows 10 x64
PHP version: 7.2.5
Apache version: 2.4.33
I used xampp server
my test.php file
<?php
$num_input = 2;
$num_output = 1;
$num_layers = 3;
$num_neurons_hidden = 3;
$desired_error = 0.001;
$max_epochs = 500000;
$epochs_between_reports = 1000;
$ann = fann_create_standard($num_layers, $num_input, $num_neurons_hidden, $num_output);
if ($ann) {
fann_set_activation_function_hidden($ann, FANN_SIGMOID_SYMMETRIC);
fann_set_activation_function_output($ann, FANN_SIGMOID_SYMMETRIC);
$filename = "xor.data";
if (fann_train_on_file($ann, $filename, $max_epochs, $epochs_between_reports, $desired_error))
fann_save($ann,"xor_float.net");
fann_destroy($ann);
}
This code not show any error and the file xor_float.net
not generated/created if i var_dump fann_save function
var_dump(fann_save($ann,"xor_float.net"));
its return bool(true) but file not created/generated
my xor.data file
4 2 1
-1 -1
-1
-1 1
1
1 -1
1
1 1
-1
I am not writing these files i got these file with php extension http://pecl.php.net/package/fann/1.1.1/windows
help me to fix this so i will start go-thru php fann
thank you so much
stackoverflow: => https://stackoverflow.com/questions/51552369/php-fann-extension-not-working
Libraries have been installed in:
/Applications/XAMPP/xamppfiles/etc/php-fann/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
i try to build it from pecl and source and getting this error while ./configure:
/root/tmp/pear/fann/configure: line 4895: syntax error near unexpected token fi' /root/tmp/pear/fann/configure: line 4895:
fi'
ERROR: `/root/tmp/pear/fann/configure' failed
full log:
/home/php5321/bin/pecl install fann
downloading fann-1.0.0.tgz ...
Starting to download fann-1.0.0.tgz (22,660 bytes)
........done: 22,660 bytes
5 source files, building
WARNING: php_bin /home/php5321/bin/php appears to have a suffix 5321/bin/php, but config variable php_suffix does not match
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
building in /root/tmp/pear/pear-build-scushkagKFxDn/fann-1.0.0
running: /root/tmp/pear/fann/configure
configure: loading site script /usr/share/site/i686-pc-linux-gnu
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for PHP prefix... /home/php5321
checking for PHP includes... -I/home/php5321/include/php -I/home/php5321/include/php/main -I/home/php5321/include/php/TSRM -I/home/php5321/include/php/Zend -I/home/php5321/include/php/ext -I/home/php5321/include/php/ext/date/lib
checking for PHP extension directory... /home/php5321/lib/php/extensions/no-debug-non-zts-20090626
checking for PHP installed headers prefix... /home/php5321/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.13.5 (ok)
checking for gawk... gawk
checking for fann support... yes, shared
/root/tmp/pear/fann/configure: line 4895: syntax error near unexpected token fi' /root/tmp/pear/fann/configure: line 4895:
fi'
ERROR: `/root/tmp/pear/fann/configure' failed
It seems that the function fann_train() does not update the weights within the network. You can check this with the following code:
<?php
$ann = fann_create_standard_array(3,array(2,4,2));
fann_save($ann, dirname(__FILE__) . "/before.net");
if(fann_train($ann,array(0.1,0.1),array(0.2,0.2))) echo 'Success'.PHP_EOL;
fann_save($ann, dirname(__FILE__) . "/after.net");
?>
After running the script (and succesfull 'training' is indicated by the Success-message), there is no difference between the files before.net and after.net.
I've looked into the code and on line 1961 of fann.c the function fann_test() is used. I think this should be fann_train().
Calling fann_create_standard_array() with some layers with 0 neurons, generate a Floating point exception: 8 and a crash.
Yes, it is a bad idea to have an empty layer in the NN though php-fann should fail nicely.
php-pecl-fann-1.0.7/NTS/fann.c:1185:51: warning: comparison of constant '3' with boolean expression is always true [-Wbool-compare]
Suggest add () to make meaning clear and then () around the whole thing, because
users of this macro do things like this:
if (!PHP_FANN_PATH_OK(retval)) {
I've tried installing the FANN 1.1.1, 1.1.0, 1.0.7 under PHP versions 5.6 & 7. Running the simple_train.php it crashes consistently at fann_train_on_file. Reducing $max_epochs makes it crash faster, reports never show up. running the xor_train.exe, simple_test.php does not crash.
Thank you for creating such a great wrapper for this awesome library. I installed it, and everything worked fine, until I tried to use fann_create_train_from_callback
, which was missing.
The FANN library version from ubuntu's repo is 2.1, which seems to be missing a few features. I installed FANN 2.2 manually without a glitch, but php-fann doesn't work anymore. I tried to re-install php-fann through pecl, but got the following error:
checking for fann support... yes, shared checking for libfann headers in default path... found in /usr/local checking for fann_set_user_data in -lfann... no configure: error: wrong libfann version (you need at least version 2.1) or lib not found
Then I tried to install it manually, only to get the same error.
Any help appreciated.
Running tests/fann_create_from_file_basic.phpt raise this error:
*** Error in `/usr/bin/zts-php': free(): corrupted unsorted chunks: 0x00007f0e0cd9ee50 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7d0b8)[0x7f0e07d6f0b8]
/lib64/libc.so.6(fclose+0x14d)[0x7f0e07d5da6d]
/lib64/libfann.so.2(fann_create_from_file+0x33)[0x7f0e06bdf3a3]
/dev/shm/BUILD/php-pecl-fann-1.0.6/ZTS/modules/fann.so(zif_fann_create_from_file+0x5f)[0x7f0e06dfa04f]
/usr/bin/zts-php(dtrace_execute_internal+0x32)[0x7f0e0b5c7b12]
/usr/bin/zts-php(+0x30dd9f)[0x7f0e0b697d9f]
/usr/bin/zts-php(execute_ex+0x4b)[0x7f0e0b6075db]
/usr/bin/zts-php(dtrace_execute_ex+0x6f)[0x7f0e0b5c79ef]
/usr/bin/zts-php(zend_execute_scripts+0x1de)[0x7f0e0b5db83e]
/usr/bin/zts-php(php_execute_script+0x218)[0x7f0e0b56b798]
/usr/bin/zts-php(+0x31020d)[0x7f0e0b69a20d]
/usr/bin/zts-php(+0xbba36)[0x7f0e0b445a36]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7f0e07d13b45]
/usr/bin/zts-php(+0xbbad5)[0x7f0e0b445ad5]
Dear Bukka,
I have followed your examples in the documentation, but i am not manage to
work in my PHP.
Call to undefined function fann_create_standard()
this seems like the library is not linked.
I am using the windows DLL files from the PECL websites, i have included the extension in the php.ini files, The apache server started successfully but i still encoutered this problems
I have the check the phpinfo() and did not found any library linked.
I been stucked here for quite a while, kindly please advise.
Million Thanks !
I have established everything according to the instruction. When performing your example I teminat gives this error message:
PHP Warning: fann_train_on_file(): Filename '/home/nkl/tmp/fann/xor.data' cannot be opened for reading in /home/nkl/tmp/fann/simple_train.php on line 19
I have even made so:
sudo php ./simple_train.php
But all the same I receive the same mistake:
PHP Warning: fann_train_on_file(): Filename '/home/nkl/tmp/fann/xor.data' cannot be opened for reading in /home/nkl/tmp/fann/simple_train.php on line 19
If I create the file '/home/nkl/tmp/fann/xor.data' in manual, I have this error:
Segmentation fault.
What do I do not correctly?
P.S.
I am use php7.0.
php -m
:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/pdo_mysql.so' - /usr/lib/php/20151012/pdo_mysql.so: undefined symbol: mysqlnd_allocator in Unknown on line 0
PHP Warning: Cannot load module 'mysqli' because required module 'mysqlnd' is not loaded in Unknown on line 0
[PHP Modules]
calendar
Core
ctype
curl
date
exif
fann
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
libxml
openssl
pcntl
pcre
PDO
Phar
posix
readline
Reflection
session
shmop
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
zlib
[Zend Modules]
Hi
I'm submitting this as it may be a different issue. I'm having troubles installing php-fann on CentOS. I'm getting
"configure: error: wrong libfann version (you need at least version 2.1) or lib not found"
even though
"checking for libfann headers in default path... found in /usr/local" and installed version is 2.2
Thanks a lot for the help.
Here is a reproduceable script below. The second time $ann is created, the resource is 'UNKNOWN' and then it crashes.
When installing from PECL compilation fails for PHP 8 because TSRM macros removed from PHP 8. Installation from Github works fine.
Compilation error looks like:
In file included from /private/tmp/pear/temp/fann/fann.c:31:
/private/tmp/pear/temp/fann/php_fann.h:229:40: error: a parameter list without types is only allowed in a function definition
void php_fannconnection_register_class(TSRMLS_D);
^
See https://github.com/php/php-src/blob/PHP-8.0/UPGRADING.INTERNALS:
c. The following things have been removed from TSRM:
- TSRMLS_DC
- TSRMLS_D
- TSRMLS_CC
- TSRMLS_C
- TSRMLS_FETCH
- TSRMLS_FETCH_FROM_CTX
- TSRMLS_SET_CTX
- tsrm_new_interpreter_context
- tsrm_set_interpreter_context
- tsrm_free_interpreter_context
- support for GNUPTH, SGI ST, and BETHREADS
Hello!
I'm trying to implement some of the examples from the original C version of Fann and I'm stuck on looping through the test data.
$ann = fann_create_from_file("trained.net");
$data = fann_read_train_from_file("training.data");
var_dump($data); //resource(5) of type (FANN Train Data)
for($i = 0; $i < fann_length_train_data($data); $i++)
{
var_dump($data[$i]); //NULL
var_dump($data->input); //NULL
var_dump($data->input[$i]); //NULL
}
Is there some method or function I can use to accomplish that or do I have to write my own wrapper that loops through the training.data file and explodes the string to arrays?
From http://pecl.php.net/package/fann, PHP Version: PHP 5.2.0 or newer
But:
/builddir/build/BUILD/php-pecl-fann-1.0.3/NTS/fann.c:907: error: 'PHP_FE_END' undeclared here (not in a function)
PHP_FE_END was introduce in PHP 5.3.8.
Perhaps it's simpler to raise the minimal version required. I will try to see if PHP_FE_END is the only problem.
P.S. PHP 5.3.3 still the official version provided in RHEL / CentOS 6
Have been playing around with this and it looks really cool, but I notice nearly all of the data types are just files and/or resources which is kinda limiting. All of my data is in SQL or NoSQL and is only accessible via ORM. There is no convert to resource capability, and no way to directly pass a database resource that I can find.
Secondly, the last thing I want to do is query a database, write to a file (SLOOOOOOW) for 5000 concurrent users, each one getting their own file. Being able to train from array or object would be really awesome, but I couldn't figure out where to modify in the source and do it myself yet.
Hello i trying it on ubuntu serveur 14.04 :
So first i install the libfan-dev library :
sudo apt-get install libfann-dev
after that i git the libfan php :
after that i lunch the training :
user1[/var/www/html_prod/php-fann/examples] > php simple_train.php
PHP Fatal error: Call to undefined function fann_create_standard() in /var/www/html_prod/php-fann/examples/simple_train.php on line 11
what is wrong please ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.