Download Free Audio of The train_test_split method divides x into traini... - Woord

Read Aloud the Text Content

This audio was created by Woord's Text to Speech service by content creators from all around the world.


Text Content or SSML code:

<speak> The train_test_split method divides x<break strength="weak"/> into training and testing data. <break strength="strong"/>It divides y also into training <break strength="weak"/>and test data based on the percentage given.<break strength="strong"/> For example, <break strength="weak"/>the default training data size is 80%, <break strength="weak"/>and the testing data size is 20%. <break strength="strong"/>Here we have not given any size. <break strength="strong"/>So x is divided into two data sets and stored in variables.<break strength="strong"/> This method divides x into train_x <break strength="weak"/>and test_x. <break strength="strong"/>And this method divides y into train_y and test_y. <break strength="strong"/>So the training data is stored in a variable train_y, <break strength="weak"/>and testing data is stored in a variable test_y. <break strength="strong"/>Randomly data is separated into training and testing data.<break strength="x-strong"/> It selects the student data randomly. <break strength="strong"/>The parameter random_state is the seed value for the random sampling.<break strength="strong"/> If you don't specify the random state and run method many times,<break strength="weak"/> then a different selection will be chosen every time. <break strength="strong"/>To ensure that the same sampling is selected for every execution,<break strength="weak"/> you need to specify some integer to the random state.<break strength="strong"/> Hence every time you run, <break strength="weak"/>you get the same results. <break strength="x-strong"/> Now we will take a model <break strength="weak"/>and train that model on this 80% training data.<break strength="strong"/> After training the model, <break strength="weak"/>we will l test the model on the 20% testing data. <break strength="strong"/>We use the multiple linear regression model to solve this problem. <break strength="x-strong"/> This model is available in the linear_model class as linear regression. <break strength="x-strong"/> You need to import the LinearRegression class. <break strength="strong"/>Give this a name LR. <break strength="weak"/>You need to test the performance of the model. <break strength="x-strong"/> For testing the model, <break strength="weak"/>we need to calculate the mean absolute error. <break strength="x-strong"/> What is mean absolute error?<break strength="x-strong"/> Absolute Error is the amount of error in your measurements.<break strength="strong"/> It is the difference between the Measured value and the True value.<break strength="strong"/> The Mean Absolute Error (MAE) is the average of all absolute errors.<break strength="x-strong"/> </speak>