Python Functions Distributed With the Adapter for Python


The following python statistical functions are distributed with the Adapter for Python.

In the Reporting Server Synonym Editor, these functions are available when you create an expression. Right-click a measure field, point to New Expression, and click Apply Function or Advanced Expression. Click post-aggregation to gain access to the Python Statistical functions, as shown in the following image.

Double-click a function name to add the function to the expression and open a dialog box for entering parameters.

Reference: BLR_CLASSIFY: Binary Logistic Regression

BLR_CLASSIFY(options, proba_flag, predictor_field, target_field)

where:

options

Fixed length alphanumeric. Will host additional options.

proba_flag

Is a keyword, indicating whether to display proba. Valid values are PROBA, to display proba, and NO_PROBA, to not display proba.

predictor_field

Numeric, Is the predictor field name.

For example, the following call predicts if a car is HIGHEND (a virtual field) or not, based on MPG and RPM:

BLR_CLASSIFY(' ',PROBA,MPG,RPM,HIGHEND)
target_field

Numeric. Is the target field.

For example, the following call predicts if a car is HIGHEND (a virtual field) or not, based on MPG and RPM:

BLR_CLASSIFY(' ',PROBA,MPG,RPM,HIGHEND)

Reference: KNN_CLASSIFY: K-Nearest-Neighbors Classification

KNN_CLASSIFY(options, neighbors, power, input_field, input_field[, input_field])

where:

options

Fixed length alphanumeric. Will host additional options.

neighbors

Integer. Is the number of neighbors.

power

Integer. Is the power of the L^p-distance.

input_field, input_field[, input_field

Numeric. Are at least two data sets to be analyzed.

For example, the following call predicts the EDUCATION-level based on the EDUCATION-levels of the 5 nearest neighbors in AGE-INCOME-space, based on the Manhattan-distance:

KNN_CLASSIFY(' ',5,1,AGE,INCOME,EDUCATION)

Reference: KNN_REGRESS: K-Nearest-Neighbors Regression

KNN_REGRESS(options, neighbors, power, input_field, input_field[, input_field])

where:

options

Fixed length alphanumeric. Will host additional options.

neighbors

Integer. Is the number of neighbors.

power

Integer. Is the power of the L^p-distance.

input_field, input_field[, input_field

Numeric. Are at least two data sets to be analyzed.

For example, the following call predicts INCOME-value based on the INCOME-values of the 10 nearest neighbors in EDUCATION-AGE-space, based on the Euclidean distance:

KNN_REGRESS(' ',10,2,EDUCATION,AGE,INCOME) 

Reference: POLY_REGRESS: Polynomial Features Generation and Regression

POLY_REGRESS(options, degree, terms_generated, input_field, input_field[, input_field])

where:

options

Fixed length alphanumeric. Will host additional options.

degree

Integer. Is the degree of the polynomial.

terms_generated

Is a keyword identifying the terms to be generated. Valid values are ALL_TERMS or INTERACTION_ONLY.

input_field, input_field[, input_field

Numeric. Are at least two data sets to be analyzed.

For example, the following call:

POLY_REGRESS(' ',2,ALL_TERMS,EDUCATION,AGE,INCOME)

Uses the input field values to derive the following polynomial:

 INCOME = A*EDUCATION + B*AGE + C*EDUCATION*AGE

and returns for each (INCOME,AGE) the predicted INCOME-value

Reference: RF_CLASSIFY: Random Forest Classification

RF_CLASSIFY(options, estimators, input_field, input_field[, input_field])

where:

options

Fixed length alphanumeric. Will host additional options.

estimators

Integer. Is the number of estimators.

input_field, input_field[, input_field

Numeric. Are at least two data sets to be analyzed.

For example, the following call predicts the EDUCATION class based on the INCOME and AGE values, using 10 neighbors decision trees:

RF_CLASSIFY(' ',10,INCOME,AGE,EDUCATION)

Reference: RF_REGRESS: Random Forest Regression

RF_REGRESS(options, estimators, input_field, input_field[, input_field])

where:

options

Fixed length alphanumeric. Will host additional options.

estimators

Integer. Is the number of estimators.

input_field, input_field[, input_field

Numeric. Are at least two data sets to be analyzed.

For example, the following call predicts the INCOME-value using 10 decision trees, using the predictors AGE and EDUCATION:

RF_REGRESS(' ',10,EDUCATION,AGE,INCOME)