Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® oneAPI Data Analytics Library
- Linear regression; predict with coefficients

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Farzaneh_T_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-06-2017
10:16 AM

107 Views

Linear regression; predict with coefficients

Hi there,

I wonder whether we can predict using DAAL prediction algorithm, only with regression coefficients from a training performed before. Basically how can I use only the prediction algorithm individually?

Thanks,

Farzaneh

1 Solution

VictoriyaS_F_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-10-2017
01:31 AM

107 Views

Hello Farzaneh,

Intel(R) DAAL provides the ability to use linear regression prediction algorithm with the pre-computed coefficients. To implement this scenario you have to create linear regression model object using this constructor:

/* Create linear regression model object using the default parameters */ Parameter defaultParameter; services::SharedPtr<ModelNormEq> model(new ModelNormEq(nFeatures, nDependentVariables, defaultParameter, 0.0));

and set the pre-computed coefficients into this model. Please use getBeta() method to access the coefficients of the model:

/* Get the numeric table with coefficients from the model */ NumericTablePtr betaTable = model->getBeta();

The coefficients are stored as a numeric table of size nDependentVariables x (nFeatures + 1). Here nDependentVariables is the number of dependent variables (or responses) you want to predict; nFeatures is the number of features in the data set. The first value in the row of coefficients is an intercept coefficient, the second value in each row is the coefficient that corresponds to the first feature in the data set, ..., the last value in the row - corresponds to the last feature in the data set.

For your convenience I attach an example that shows how to use linear regression prediction algorithm with the pre-trained coefficients.

Best regards,

Victoriya

Link Copied

2 Replies

VictoriyaS_F_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-10-2017
01:31 AM

108 Views

Hello Farzaneh,

Intel(R) DAAL provides the ability to use linear regression prediction algorithm with the pre-computed coefficients. To implement this scenario you have to create linear regression model object using this constructor:

/* Create linear regression model object using the default parameters */ Parameter defaultParameter; services::SharedPtr<ModelNormEq> model(new ModelNormEq(nFeatures, nDependentVariables, defaultParameter, 0.0));

and set the pre-computed coefficients into this model. Please use getBeta() method to access the coefficients of the model:

/* Get the numeric table with coefficients from the model */ NumericTablePtr betaTable = model->getBeta();

The coefficients are stored as a numeric table of size nDependentVariables x (nFeatures + 1). Here nDependentVariables is the number of dependent variables (or responses) you want to predict; nFeatures is the number of features in the data set. The first value in the row of coefficients is an intercept coefficient, the second value in each row is the coefficient that corresponds to the first feature in the data set, ..., the last value in the row - corresponds to the last feature in the data set.

For your convenience I attach an example that shows how to use linear regression prediction algorithm with the pre-trained coefficients.

Best regards,

Victoriya

Farzaneh_T_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-11-2017
11:08 AM

107 Views

Hi Victoriya,

Thanks for your complete response!

Best,

Farzaneh

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.