# yaplf: Yet Another Python Learning Framework

yaplf is a modular, extensible machine learning framework written in python, including different models and learning algorithms for classification; currently, the framework supports:

• perceptrons (either trained through Rosenblatt or gradient descent algorithm),
• multilayer perceptrons with generic number of hidden layers (trained through error backpropagation algorithm with customizable learning rate, momentum, error threshold, and arbitrary differentiable activation functions on the various layers),
• SV classifiers (both in the original and soft-margin formulation, and providing an extensible set of kernel functions),
• an implementation of special SV classification algorithms for data of variable quality.

All models and algorithms are accessed in a consistent way, so that it is easy to compare the performances of different learning approaches on a same data set.

The system is opened to the addition of new models and algorithms for classification, as well as to other machine learning techniques such as regression or clustering. Moreover, it provides model-independent support for k-fold cross validation, extensive support for generating 2D and 3D images exploiting different graphic libraries (matplotlib and sage are currently supported and automatically detected), and basic support for multi-threading.

yaplf can be used out of the box both within a plain python environment or coupled with the open source sage system, either in form of extended python scripts or within a web-based interactive notebook.

Finally, the system includes the support for graphic observation of iterative learning algorithms, including:

• the visualization of error versus iteration number (with arbitrary error metrics), and
• the visualization of trajectories in the model space.

These features make yaplf an interesting tool also for teaching machine learning.

## yaplf at a glance

yaplf includes:

• different models for classification (currently perceptrons, multilayer perceptrons and SV classifiers) which are accessed in a consistent way;
• a system opened to addition of new models for classification and other machine learning techniques;
• model-independent support for k-fold cross validation;
• extensive support for generating images exploiting different graphic libraries (matplotlib and sage are currently supported and automatically detected);
• a solution for machine learning research and teaching.

## Prerequisites

yaplf requires:

• python >= 2.5.4
• numpy >= 1.3.0
• (optional) matplotlib >= 0.99.1 in order to render pictures
• (optional) cvxopt >= 0.9 or PyML >= 0.7 in order to train SV models

Moreover, yaplf is implemented to be effortlessly run within sage >= 4.2.

## Install instructions

The software is available on GitHub, and is installed as follows, assuming a bash is used in a Unix/Linux/Mac OS X standard installation:.

1. Clone the yaplf repository locally.
2. uncompress the gzipped tarball:
$gunzip yaplf-0.7.tar.gz$ tar -xf yaplf-0.7.tar

3. move the obtained yaplf-0.7 directory to an appropriate place in the file system, say /path/to/yaplf;
4. add the corresponding path to the PYTHONPATH environment variable:
export PYTHONPATH=$PYTHONPATH:/path/to/yaplf  5. (sage users only) add the same path to the SAGE_PATH environment variable: export SAGE_PATH=$SAGE_PATH:/path/to/yaplf


Of course instructions 3-4 affect exclusively the running bash instance, so it is a better choice to include them in .bash_profile or in an equivalent location.

The distribution is actually created through distutils, so step 2 can be done following the usual python pattern:

\$ python setup.py install

executing then the following steps with reference to the standard python installation location of the used system.

## Documentation

yaplf source is fully documented through docstrings, thus the documentation is directly accessible within a python shell or a sage notebook through standard python methodology.

This section contains additional documentation focused on special topics. Besides a basic yaplf tutorial, the documentation consists of several yaplf recipes: