Author: ds_cool_user

How to fix ModuleNotFoundError: No module named ‘sklearn.cross_validation’ ?

If you are getting the below error, Traceback (most recent call last): File “regression.py”, line 14, in from sklearn.cross_validation import train_test_split ModuleNotFoundError: No module named ‘sklearn.cross_validation’ Don’t worry, you can fix it very easily. You might have imported train_test_split as shown below Replace that with That will fix it 🙂

Predict employee salary using multi linear regression (Python)

Let’s discuss steps to predict salary using regression here. The regression model used is multi linear regression. Assume that, a company’s salary for it’s programmers is as shown below Total, Lead, Manager, Certifications, Salary 1,0,0,0,20000 1.5,0,0,0,23000 2,0,0,0,25000 2,0,0,1,30000 2.5,0,0,0,27000 3,0,0,2,30000 3.5,1,0,0,33000 3.5,1,0,1,35000 3.5,1,0,2,40000 4,1,0,0,35000 4,2,0,0,40000 4,2,0,2,43000 So in the table, there are some independent variables […]

Predict profit using simple linear regression (Python)

regression.py It’s the core file, that read a csv file. And we are doing simple linear regression on data read from the csv file. api.py This file can be called from any other application to get real and predicted value for a comparison. We already developed a sample web application, that use Vue.js to display […]

How to use the OneHotEncoder directly?

Have you ever got the below warnings? FutureWarning: The handling of integer data will change in version 0.22. Currently, the categories are determined based on the range [0, max(values)], while in the future they will be determined based on the unique values. If you want the future behaviour and silence this warning, you can specify […]

Fill missing data using SimpleImputer

If you get the below error while predicting missing values, You should use SimpleImputer instead of Imputer. DeprecationWarning: Class Imputer is deprecated; Imputer was deprecated in version 0.20 and will be removed in 0.22. Import impute.SimpleImputer from sklearn instead.  warnings.warn(msg, category=DeprecationWarning) A sample code that show how to use SimpleImputer is given below.

Scroll to top