?? readme.txt
字號:
Python binding for fann compiled for Windows with Visual Studio C++ 2005 Professional.
To use the precompiled binding copy the contents of the precompiled subdirectory in the archive
to a pyfann directory in your python library directory ex. D:/Python24/Lib/pyfann/. Then use
the simple_train.py example from the python binding to get started.
-----------------------------
If you wish to compile the binding on Windows, install the following:
fann - precompiled with the 2.1.0 CVS fannExplorer version with the gsoc cvs branch binding
Python - tested with 2.4.3 IDLE Python-Enthought Edition from http://code.enthought.com/enthon/
SWIG - 1.3.24 is included in the Python-Enthought Edition (does NOT work with 1.3.31)
C++ - use Visual Studio C++ 2005 Professional (not tested with the free 2008 Express edition)
Then follow these steps:
Unpack the pyfannWin32 archive in the python binding directory under the fann directory.
Set the following environment variables in the System Control Panel applet on the Advanced pane:
PYTHON_INCLUDE : Set this to the directory that contains python.h
PYTHON_LIB : Set this to the directory that contains the python library
Example using Python 2.4.3:
PYTHON_INCLUDE: d:\python24\include
PYTHON_LIB: d:\python24\libs\python24.lib
Make sure SWIG is in the PATH environment variable (at a command line type type: swig -version).
Double-click the pyfannWin32.sln file in the pyfannWin32 directory (AFTER setting the environment).
Select the Release configuration in the Solution Configurations dropdown.
Select Rebuild Solution in the Build Menu.
Copy the _libfann.dll from pyfannWin32/Release, __init__.py and libfann.py from the pyfann directory
to a subdirectory named pyfann in the Python Lib directory.
Note that the Debug version will not link because it requires a debug version of the python24 dll.
This is specified in the pyconfig.h distribution file with #pragma comment(lib,"python24_d.lib")
Performance note:
To further optimize performance (30-40% reduction in training time) the python binding could be
changed to use 32-bit floating point instead of 64-bit. This requires changes in pyfann.i and
pyfann_wrap.cxx (change the two instances of #include "doublefann.h" to #include "floatfann.h")
and a change in the pyfannWin32 project configuration properties (on the C/C++, Advanced page
change Force Includes from doublefann.h to floatfann.h). On CPU's with SSE2 SIMD support support
this can be further optimized on the C/C++, Code Generation page by enabling 'Streaming SIMD
Instructions 2' under 'Enable Enhanced Instruction Set'.
Changes:
2007.10.30 Updated python binding to gsoc cvs branch and fannExplorer fixed source.
2006.09.02 Eliminated dependency on C runtime libraries (MSCV80).
More aggressive function inlining optimizations enabled.
Post-build event added that copies binding files to a precompiled subdirectory from
there they can be copied to the Python24/Lib/pyfann directory (remember to delete
any *.pyc files from the pyfann directory if python compilation is enabled).
2006.08.30 Initial version
Sample usage:
from pyfann import libfann
myAnn = libfann.neural_net()
myAnn.create_standard_array([2, 8, 9, 1])
myAnn.get_num_input()
myAnn.get_num_output()
myAnn.print_parameters()
myAnn.set_learning_rate(0.7)
myAnn.set_activation_function_output(libfann.SIGMOID_SYMMETRIC_STEPWISE)
myAnn.run([1.0,1.0])
myAnn.train([1.0,1.0],[-1.0])
myAnn.run([1.0,1.0])
data = libfann.training_data()
data.set_train_data([[-1.0, -1.0], [-1.0, 1.0], [1.0, -1.0], [1.0, 1.0]], [[-1.0], [1.0], [1.0], [-1.0]])
myAnn.train_on_data(data, 1000, 50, 0.001)
myAnn.run([-1.0,-1.0])
myAnn.run([-1.0, 1.0])
myAnn.run([ 1.0,-1.0])
myAnn.run([ 1.0, 1.0])
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -