Python-Powered Model: Docker Deployment for Predictive Insights ✨
I have learned how to operate a machine learning predictive model. This model is designed to predict salaries based on given years of experience. I've utilized Python libraries such as Pandas and Scikit-learn for this purpose. The model is deployed within a Docker container.
The Python code I've developed allows the model to take input from the user. This input consists of the number of years of experience someone has. Based on this input, the model predicts the corresponding salary. Conversely, if the user provides a salary input, the model predicts the number of years of experience associated with that salary.
In summary, this predictive model serves to estimate salaries based on years of experience, and vice versa.
Here's the python code :
import pandas
dataset=pandas.read_csv("salary.csv")
x=dataset["Years of Experience"]
y=dataset["Salary"]
X=x.values.reshape(-1,1)
from sklearn.linear_model import LinearRegression
model=LinearRegression()
model.fit(X,y)
c=model.coef_
kk=float(input("enter the predictor"))
k=model.predict([[kk]])
print(k)
Docker commands :
sudo su - root
yum install docker
systemctl start docker
docker pull centos:7
docker run -it --name mycode centos:7
##after this enter in your container
yum install vim
yum install python3-pip
vim salary.csv
vim task.py
pip3 install pandas
pip3 install scikit-learn
python3 task.py
##your code is run and give input to the model.
Thank You
Great job, Nitin Singh! Your journey into deploying machine learning models using Python and Docker is truly inspiring. Your dedication to mastering predictive insights is commendable. Keep up the fantastic work!
It looks great! Did you deployed the docker container on any cloud service?