Changes

Jump to: navigation, search

DPS921/Franky

489 bytes added, 11:21, 26 November 2018
Source
return 0;
}
 
</source>
The function called "lin_reg_norm_eq_dense_batch.cpp" in the DAAL library was manipulated to test the linear regression model. First, the function "trainModel()" is called. This function reads the "train.csv" data,
and then merges the columns based on the number of independent and dependent variables, in this case it is simple regression with 1 dependent and 1 independent variable. An optimized algorithm is then initialized, training data and dependent values are passed in, and trained based on the data within the csv file. A training result is produced, which is a line of best fit model for the data. The "testModel()" function is then called, which initilized initialized a test algorithm. The algorithm works by passing the dependent variable into the training model, and the independent values are predicted. The model predicted y = 0.5x + 1, which matches nearly perfectly with the random data which was stored to both the train.csv, and test.csv files.
====Code====
<source>
/* file: lin_reg_norm_eq_dense_batch.cpp */
/*******************************************************************************
printNumericTable(testGroundTruth, "Ground truth (first 10 rows):", 10);
}
</source>
====Performance====
====Fix====
Processes generating random numbers for our starting data points are taking up some time in the serial region. The random number generator uses a for-loop. Let's apply OpenMP worksharing to make it more efficient
<source>
# [https://software.intel.com/en-us/node/506154 Parallel_reduce()]
# [https://helloacm.com/cc-linear-regression-tutorial-using-gradient-descent/ Linear Regression In C++]
# [https://github.com/intel/daal/tree/daal_2019/algorithms/kernel/linear_regression Linear Regression Algorithms from Intel DAAL Library]
# [https://github.com/y2s82/franky Github repository of the code used]
70
edits

Navigation menu