0
$\begingroup$

here is the source code of the model and the csv file. Using the csv file I have to apply linear regression Algorithm on it using "Sales" and "Profit". Train the model in such a way that model can predict the value of profit on given sales values. Accuracy on training and testing data:

training set score: 0.332318
test set score: 0.035073

I even changed the parameter values(test_size, random_state), but the model still underfitting. what should I make changes in my code to avoid underfitting?

$\endgroup$

2 Answers 2

2
$\begingroup$

Building a model from 1 feature rarely makes sense. Just applying rules (product X has profit margin Y) would be better in this case. You need more features in the model. If this problem is even separable. All data does not lend to machine learning. Predicting profit from sales and products lends itself to rules.

$\endgroup$
0
$\begingroup$

Looking at your codes it uses just one variable to predict y variable. This is a case where model is not complex enough you are facing a problem of HIGH BIAS. You will have to use more variable for training like Products Categories, Product Price etc to capture relatioship between X & Y and get a better model.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.