◷ Reading Time: 2 minutes

### FlexRule.Extensions.Analytics

This extension enables Predictive Analytics capability to FlexRule platform. The extensions adds both expression commands Toolbox commands.

#### train

Trains and builds a predictive model using data.

` train (list, algorithm, class, options)`

- algorithm:
- PMML v4.3 (Read Details)
- Regression Model
- Generalized Regression Model
- Naive Bayes Model
- Classification and Regression Tree Model
- Support Vector Machine Model
- Random Forest (Mining Model)
- Neural Networks Model
- Clustering Model
- Gradient Boosting Machine Model (Mining Model)
- Association Rules Model
- K-Nearest Neighbors Model

- c45: Decision Tree

- nb: Naive Bayes

- PMML v4.3 (Read Details)
- class: attributes name that is the class name (i.e. attribute or field of data that going to be the result of prediction)
- options: Algorithm options if it is available
- Return: analytic’s trainedModel

#### predict

Uses a trained model to predict results for a data record.

` predict (trainedModel, data, options)`

- trainedModel: the train function result.
- data: Situation that requires the prediction. (i.e. a JSON with fields of value)
- options: Algorithm options if it is available

#### extractRules

Extracts rules for Decision Tree.

` extractRules (trainedModel, type)`

- type: if, elseIf
- Retrun: list of rules that are bases of the trained model

### Examples

The following examples are available by default when you open FlexRule Designer.