linearTrain
warning
The document is a continuation of the previous document, if you have landed directly on this page then, Please read from page Get started.
#
What is linearTrain component ?linearTrain component is used to train the linear regression model on 2 parameters and saves the learnt parameters in trainedValues.txt file.
- Description : linearTrain() takes an input(through STDIN) as .csv file and column name 1 and column name 2 with values, which we train using linear regression algorithm and trained parameters are stored in .txt file for further use. Check Input and output parameters for details.
- Parameters :
- Input(Via STDIN) : A JSON String with following contents:
- Input1 : .csv file name (which container 2 columns with values)
- Input2 : column1 name
- Input3 : column2 name
- Output(Via STDOUT) : A JSON string with following contents
- trainedValues.txt file which contains trained values i.e. the model
- Input(Via STDIN) : A JSON String with following contents:
#
List of linearTrain features in shunya stack- linearTrain component train the linear-regression model on csv file and stored the trained values in .txt file.
#
Using linearTrain features in Shunya stack#
1. Getting trained values after linear-regression using linearTrain component- linearTrain give trainedValues.txt which contains predicted values.
Lets look into code to understand how to output.
C++
with above c++ program, you will get trainedValues.txt file stored in your system, which has trained values.
Python
with above python program, you will get trainedValues.txt file stored in your system, which has trained values.
#
Understand this component with an example (ready to use code)- This is an example for linear-regression training and predicton and here we will be using 2 components: linearTrain and linearPredict
- Check this ready to use example in c++ and python
- C++ Example
- In this folder there is a file, linear-reg.cpp
- linearTrain Components used
- linearPredict component used
- Run code by yourself
- You will get a new image stored in system.