## Method

transform(y)

## new Binarizer(y, positiveLabel[, positiveId][, negativeId])

Transforming arrays with labels to vector appropriate for binary classifiers.

### Example

    // import analytics module
    var analytics = require('qminer').analytics;
    // create binarizer with 'b' as positive label
    var binarizer = new analytics.preprocessing.Binarizer('b');

### Parameters

Name | Type | Optional | Description
--- | --- | --- | ---
y | Array |  | Labels.
positiveLabel | (string or number) |  | Positive label.
positiveId | number | Yes | Value when matching positive label. Defaults to `1`.
negativeId | number | Yes | Value when not matching positive label. Defaults to `-1`.

## Method

### transform(y) → modul:la.Vector

Transform given array of labels to binary numeric vector.

#### Example

    // import analytics module
    var analytics = require('qminer').analytics;
    // create binarizer with 'b' as positive label
    var binarizer = new analytics.preprocessing.Binarizer('b');
    // get vector with binarized labels
    var bins = binarizer.transform(['a','b','a','c']);

#### Parameter

Name | Type | Optional | Description
--- | --- | --- | ---
y | (Array of number, Array of string, module:la.Vector, or module:la.StrVector) |  | Labels.

Returns

  `modul:la.Vector`B Binarized vector.