Introduction
============

This tool provides a Python interface to LIBLINEAR with instance weight support

Installation
============

Please check README for detail.

USAGE
=====

The usage is basically the same as the version without supporting
instance weights. We only show differences below.

- Function: train

    There are three ways to call train()

    >>> model = train(W, y, x [, 'training_options'])
    >>> model = train(prob [, 'training_options'])
    >>> model = train(prob, param)

    W: a list/tuple/ndarray of l training weights (type must be double).
       Use [] if no weights.

    y: a list/tuple/ndarray of l training labels (type must be int/double).

    x: 1. a list/tuple of l training instances. Feature vector of
          each training instance is a list/tuple or dictionary.

       2. an l * n numpy ndarray or scipy spmatrix (n: number of features).

    training_options: a string in the same form as that for LIBLINEAR command
                      mode.

    prob: an problem instance generated by calling
          problem(W, y, x).

    param: an parameter instance generated by calling
           parameter('training_options')

    model: the returned model instance. See linear.h for details of this
           structure. If '-v' is specified, cross validation is
           conducted and the returned model is just a scalar: cross-validation
           accuracy for classification and mean-squared error for regression.
           If the '-C' option is specified, the best parameter C is found
           by cross validation. The returned model is a tuple of the best C
           and the corresponding cross-validation accuracy. The parameter
           selection utility is supported by only -s 0 and -s 2.

    To train the same data many times with different
    parameters, the second and the third ways should be faster..

    Examples:

	>>> from liblinearutil import *
	>>> y, x = svm_read_problem('../heart_scale')

	# Without Scipy support
	>>> W = [1] * len(y)
	>>> W[0] = 10

	# With Scipy support
	>>> import scipy
	>>> W = scipy.asarray([1] * len(y))
	>>> W[0] = 10

	>>> prob = problem(W, y, x)
	>>> param = parameter('-c 5')
	>>> m = train([], y, x, '-c 5')
	>>> m = train(W, y, x)
	>>> m = train(prob, param)
	>>> CV_ACC = train(W, y, x, '-v 3')
