Close Menu
    Trending
    • AI Twin Generator from Image (Unfiltered): My Experience
    • “How to Build an Additional Income Stream from Your Phone in 21 Days — A Plan You Can Copy” | by Zaczynam Od Zera | Aug, 2025
    • Generative AI in Human Resources: Transforming Talent, Learning & Leadership
    • How This Founder Went From Side Hustle to 2,200 Franchises
    • Elon Musk’s Grok Imagine Goes Android—“Superhuman Imagination Powers” at Your Fingertips (But Ethics Remain Cloudy)
    • LLM’lerde Halüsinasyonları Azaltmak için Doğrulama Algoritmaları | by Güray Ataman | Aug, 2025
    • STEM Education in Africa: Engineering Student’s Story
    • How I Helped a Local Company Generate $5 Million in 6 Months
    AIBS News
    • Home
    • Artificial Intelligence
    • Machine Learning
    • AI Technology
    • Data Science
    • More
      • Technology
      • Business
    AIBS News
    Home»Artificial Intelligence»Journey to Full-Stack Data Scientist: Model Deployment | by Alex Davis | Jan, 2025
    Artificial Intelligence

    Journey to Full-Stack Data Scientist: Model Deployment | by Alex Davis | Jan, 2025

    Team_AIBS NewsBy Team_AIBS NewsJanuary 4, 2025No Comments3 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    First, for our instance, we have to develop a mannequin. Since this text focuses on mannequin deployment, we is not going to fear concerning the efficiency of the mannequin. As a substitute, 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 a couple of options, resembling expertise, job title, firm dimension, and so on.

    See information right here: https://www.kaggle.com/datasets/ruchi798/data-science-job-salaries (CC0: Public Area). I barely modified the information to scale 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 information.

    Picture by Writer

    Since all of our options are categorical, we are going to use encoding to rework our information to numerical. Under, we use ordinal encoders to encode expertise stage and firm dimension. These are ordinal as a result of they characterize some sort of development (1 = entry stage, 2 = mid-level, and so on.).

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

    #use ordinal encoder to encode expertise stage
    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 dimension
    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 authentic columns
    salary_data = salary_data.drop(columns = ['experience_level', 'company_size'])

    Now that we have now remodeled 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 impartial and dependent options
    X = salary_data.drop(columns = 'salary_in_usd')
    y = salary_data['salary_in_usd']

    #cut 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.

    Picture by Writer

    Appears like our R-squared is 0.27, yikes. Much more work would have to be performed with this mannequin. We might doubtless want extra information and extra data 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')



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleBuilding Lightweight AI Agents with Hugging Face SmolAgents, OpenAI GPT, and Serper.dev | by Albin Issac | Tech Learnings | Jan, 2025
    Next Article A Faster PC Is Just One Click Away—and Just $14.99
    Team_AIBS News
    • Website

    Related Posts

    Artificial Intelligence

    AI Twin Generator from Image (Unfiltered): My Experience

    August 21, 2025
    Artificial Intelligence

    Elon Musk’s Grok Imagine Goes Android—“Superhuman Imagination Powers” at Your Fingertips (But Ethics Remain Cloudy)

    August 21, 2025
    Artificial Intelligence

    Mydreamcompanion Image generator: My Unfiltered Thoughts

    August 21, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    AI Twin Generator from Image (Unfiltered): My Experience

    August 21, 2025

    I Tried Buying a Car Through Amazon: Here Are the Pros, Cons

    December 10, 2024

    Amazon and eBay to pay ‘fair share’ for e-waste recycling

    December 10, 2024

    Artificial Intelligence Concerns & Predictions For 2025

    December 10, 2024

    Barbara Corcoran: Entrepreneurs Must ‘Embrace Change’

    December 10, 2024
    Categories
    • AI Technology
    • Artificial Intelligence
    • Business
    • Data Science
    • Machine Learning
    • Technology
    Most Popular

    How Instance Segmentation is Transforming the World of Sports and Gaming | by Wisepl | Aug, 2025

    August 20, 2025

    3 Unconventional Productivity Tips to Stimulate Creative Thinking

    December 16, 2024

    ‘4-Hour Workweek’ Led to a $600,000 Side Hustle in 16 Months

    February 8, 2025
    Our Picks

    AI Twin Generator from Image (Unfiltered): My Experience

    August 21, 2025

    “How to Build an Additional Income Stream from Your Phone in 21 Days — A Plan You Can Copy” | by Zaczynam Od Zera | Aug, 2025

    August 21, 2025

    Generative AI in Human Resources: Transforming Talent, Learning & Leadership

    August 21, 2025
    Categories
    • AI Technology
    • Artificial Intelligence
    • Business
    • Data Science
    • Machine Learning
    • Technology
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us
    Copyright © 2024 Aibsnews.comAll Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.