• Home
  • About Us
  • Contact Us
  • Disclaimer
  • Privacy Policy
Monday, June 2, 2025
newsaiworld
  • Home
  • Artificial Intelligence
  • ChatGPT
  • Data Science
  • Machine Learning
  • Crypto Coins
  • Contact Us
No Result
View All Result
  • Home
  • Artificial Intelligence
  • ChatGPT
  • Data Science
  • Machine Learning
  • Crypto Coins
  • Contact Us
No Result
View All Result
Morning News
No Result
View All Result
Home Artificial Intelligence

Journey to Full-Stack Information Scientist: Mannequin Deployment | by Alex Davis | Jan, 2025

Admin by Admin
January 5, 2025
in Artificial Intelligence
0
14umvrom7f2ybkxfp3bmjma.png
0
SHARES
0
VIEWS
Share on FacebookShare on Twitter


First, for our instance, we have to develop a mannequin. Since this text focuses on mannequin deployment, we won’t fear in regards to the efficiency of the mannequin. As an alternative, we are going to construct a easy mannequin with restricted options to give attention to studying mannequin deployment.

On this instance, we are going to predict a knowledge skilled’s wage based mostly on just a few options, equivalent to expertise, job title, firm measurement, and many others.

See information right here: https://www.kaggle.com/datasets/ruchi798/data-science-job-salaries (CC0: Public Area). I barely modified the info to cut back the variety of choices for sure options.

#import packages for information manipulation
import pandas as pd
import numpy as np

#import packages for machine studying
from sklearn import linear_model
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import OneHotEncoder, OrdinalEncoder
from sklearn.metrics import mean_squared_error, r2_score

#import packages for information administration
import joblib

First, let’s check out the info.

Picture by Creator

Since all of our options are categorical, we are going to use encoding to remodel our information to numerical. Under, we use ordinal encoders to encode expertise degree and firm measurement. These are ordinal as a result of they characterize some type of development (1 = entry degree, 2 = mid-level, and many others.).

For job title and employment sort, we are going to create a dummy variables for every choice (observe we drop the primary to keep away from multicollinearity).

#use ordinal encoder to encode expertise degree
encoder = OrdinalEncoder(classes=[['EN', 'MI', 'SE', 'EX']])
salary_data['experience_level_encoded'] = encoder.fit_transform(salary_data[['experience_level']])

#use ordinal encoder to encode firm measurement
encoder = OrdinalEncoder(classes=[['S', 'M', 'L']])
salary_data['company_size_encoded'] = encoder.fit_transform(salary_data[['company_size']])

#encode employmeny sort and job title utilizing dummy columns
salary_data = pd.get_dummies(salary_data, columns = ['employment_type', 'job_title'], drop_first = True, dtype = int)

#drop unique columns
salary_data = salary_data.drop(columns = ['experience_level', 'company_size'])

Now that we now have reworked our mannequin inputs, we are able to create our coaching and take a look at units. We’ll enter these options right into a easy linear regression mannequin to foretell the worker’s wage.

#outline unbiased and dependent options
X = salary_data.drop(columns = 'salary_in_usd')
y = salary_data['salary_in_usd']

#break up between coaching and testing units
X_train, X_test, y_train, y_test = train_test_split(
X, y, random_state = 104, test_size = 0.2, shuffle = True)

#match linear regression mannequin
regr = linear_model.LinearRegression()
regr.match(X_train, y_train)

#make predictions
y_pred = regr.predict(X_test)

#print the coefficients
print("Coefficients: n", regr.coef_)

#print the MSE
print("Imply squared error: %.2f" % mean_squared_error(y_test, y_pred))

#print the adjusted R2 worth
print("R2: %.2f" % r2_score(y_test, y_pred))

Let’s see how our mannequin did.

READ ALSO

A Chook’s Eye View of Linear Algebra: The Fundamentals

How one can Construct an MCQ App

Picture by Creator

Seems like our R-squared is 0.27, yikes. Much more work would must be finished with this mannequin. We might possible want extra information and extra info on the observations. However for the sake of this text, we are going to transfer ahead and save our mannequin.

#save mannequin utilizing joblib
joblib.dump(regr, 'lin_regress.sav')
Tags: AlexDataDavisDeploymentFullStackJanJourneymodelScientist

Related Posts

Image 201.png
Artificial Intelligence

A Chook’s Eye View of Linear Algebra: The Fundamentals

June 2, 2025
Chatgpt image apr 15 2025 06 52 32 am 1 1024x683.png
Artificial Intelligence

How one can Construct an MCQ App

June 2, 2025
Kelly sikkema whs7fpfkwq unsplash scaled 1.jpg
Artificial Intelligence

Simulating Flood Inundation with Python and Elevation Information: A Newbie’s Information

June 1, 2025
Ds for cx 1024x683.png
Artificial Intelligence

The Secret Energy of Information Science in Buyer Help

May 31, 2025
Article title.png
Artificial Intelligence

Fingers-On Consideration Mechanism for Time Sequence Classification, with Python

May 30, 2025
Gaia 1024x683.png
Artificial Intelligence

GAIA: The LLM Agent Benchmark Everybody’s Speaking About

May 30, 2025
Next Post
1sqjlfy5x2wpacz8v57juba.gif

Predicting a Ball Trajectory. Polynomial Slot in Python with NumPy | by Florian Trautweiler | Jan, 2025

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

POPULAR NEWS

0 3.png

College endowments be a part of crypto rush, boosting meme cash like Meme Index

February 10, 2025
Gemini 2.0 Fash Vs Gpt 4o.webp.webp

Gemini 2.0 Flash vs GPT 4o: Which is Higher?

January 19, 2025
1da3lz S3h Cujupuolbtvw.png

Scaling Statistics: Incremental Customary Deviation in SQL with dbt | by Yuval Gorchover | Jan, 2025

January 2, 2025
0khns0 Djocjfzxyr.jpeg

Constructing Data Graphs with LLM Graph Transformer | by Tomaz Bratanic | Nov, 2024

November 5, 2024
How To Maintain Data Quality In The Supply Chain Feature.jpg

Find out how to Preserve Knowledge High quality within the Provide Chain

September 8, 2024

EDITOR'S PICK

Marco H Tallarico Distance.jpg

From a Level to L∞ | In direction of Information Science

May 2, 2025
1hrh2myh809upgo82ftpmeg Scaled.jpeg

Superior Time Intelligence in DAX with Efficiency in Thoughts

February 20, 2025
Depositphotos 669916654 Xl Scaled.jpg

Why Rehab Facilities Want Information Analytics for search engine optimization

December 7, 2024
2d2e6db7 3472 4fa4 B134 6fb521579701 800x420.jpg

SEC delays resolution on Franklin Templeton Bitcoin & Ethereum index ETF

November 21, 2024

About Us

Welcome to News AI World, your go-to source for the latest in artificial intelligence news and developments. Our mission is to deliver comprehensive and insightful coverage of the rapidly evolving AI landscape, keeping you informed about breakthroughs, trends, and the transformative impact of AI technologies across industries.

Categories

  • Artificial Intelligence
  • ChatGPT
  • Crypto Coins
  • Data Science
  • Machine Learning

Recent Posts

  • A Chook’s Eye View of Linear Algebra: The Fundamentals
  • MiTAC Computing Unveils AI and Cloud Infrastructure Partnership with AMD at COMPUTEX
  • Coinbase and Irdeto Unite to Combat Crypto-Fueled Cybercrime
  • Home
  • About Us
  • Contact Us
  • Disclaimer
  • Privacy Policy

© 2024 Newsaiworld.com. All rights reserved.

No Result
View All Result
  • Home
  • Artificial Intelligence
  • ChatGPT
  • Data Science
  • Machine Learning
  • Crypto Coins
  • Contact Us

© 2024 Newsaiworld.com. All rights reserved.

Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?