Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
IT Security NachrichtenAb 1.10: Meldepflicht für IT-Vorfälle in Österreich | heise online(22.09.2026 um 23:31 Uhr)
IT Security NachrichtenIT Security News Daily Summary 2026-09-22(22.09.2026 um 23:55 Uhr)
IT Security NachrichtenIT Security News Hourly Summary 2026-09-23 00h : 3 posts(23.09.2026 um 00:00 Uhr)
IT Security NachrichtenRelays Are Masking Chinese Access to Frontier AI Models in the US(22.09.2026 um 23:12 Uhr)
Malware / Trojaner / VirenAttackers Use Wallpaper Engine to Distribute Malware(22.09.2026 um 15:10 Uhr)
IT Security NachrichtenSweden fines Miljödata $183,000 over breach affecting 2.2 million(22.09.2026 um 23:40 Uhr)
IT Security NachrichtenRogue external MFA providers can steal passwords during logins(22.09.2026 um 23:45 Uhr)
IT Security NachrichtenÖsterreich setzt NIS2 um, erhält Bundesamt für Cybersicherheit(22.09.2026 um 23:24 Uhr)
IT NachrichtenHere’s a Newer Galaxy Z Fold 8 Update for You(22.09.2026 um 23:19 Uhr)
IT Security NachrichtenAb 1.10: Meldepflicht für IT-Vorfälle in Österreich | heise online(22.09.2026 um 23:31 Uhr)
IT Security NachrichtenIT Security News Daily Summary 2026-09-22(22.09.2026 um 23:55 Uhr)
IT Security NachrichtenIT Security News Hourly Summary 2026-09-23 00h : 3 posts(23.09.2026 um 00:00 Uhr)
IT Security NachrichtenRelays Are Masking Chinese Access to Frontier AI Models in the US(22.09.2026 um 23:12 Uhr)
Malware / Trojaner / VirenAttackers Use Wallpaper Engine to Distribute Malware(22.09.2026 um 15:10 Uhr)
IT Security NachrichtenSweden fines Miljödata $183,000 over breach affecting 2.2 million(22.09.2026 um 23:40 Uhr)
IT Security NachrichtenRogue external MFA providers can steal passwords during logins(22.09.2026 um 23:45 Uhr)
IT Security NachrichtenÖsterreich setzt NIS2 um, erhält Bundesamt für Cybersicherheit(22.09.2026 um 23:24 Uhr)
IT NachrichtenHere’s a Newer Galaxy Z Fold 8 Update for You(22.09.2026 um 23:19 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Predicting Employee Salary Using Linear Regression

In this project ,I am predicting an employee's salary based on their years of experience using linear regression model.Linear regression is a statistical method used to model the relationship between a dependent variable and an independent…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

In this project ,I am predicting an employee's salary based on their years of experience using linear regression model.Linear regression is a statistical method used to model the relationship between a dependent variable and an independent variable.

In this case:




  • X(Independent Variable) represents Years Of Experience

  • Y(Dependent Variable) represents the salary





Libraries Used



The following Python libraries are used in this project:





  • pandas for handling data frames


  • seaborn and matplotlib for visualization


  • Scikit-learn (sklearn) provides a collection of tools for data preprocessing, model training and evaluation



import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score
from sklearn.feature_selection import f_regression
%matplotlib inline








Data Preparation



Read the excel file that contains the data set.



Excel Dataset First 5

Then define the X and Y variables .




The X variable is stored in a DataFrame format.







X=df[['YearsExperience']]#Should be in dataframe or 2d array
y=df['Salary']










Splitting the Data set



The dataset is split into training and testing sets ,both X and Y are split accordingly.

In this project 25% data(test size = 0.25) is used for testing the rest to train the model.




##Train Test Split
X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.25,random_state=42)









Model validation



To evaluate whether there is a valid relationship exists between years of experience and salary F-regression is used to calculate the:




  • F-value(622.5):Measures how well the independent variable explains the dependent variable.

  • p-value helps(0.0):Determines the statistical significance of the relationship.



F Regression



Since the p-value is less than 0.05 we reject the null hypothesis which states that there is no relationship between salary and years of experience. This confirms that a strong relationship exists between the two variables.




In general, a higher F-value and a smaller p-value indicate a stronger and more significant relationship







Prediction



The Linear Regression model is trained by fitting it to the training dataset using model.fit().




model= LinearRegression()
model.fit(X_train,y_train)






The Linear Regression model follows the formula:




Y=b0​+b1​X

Where:

Y = Dependent Variable (Salary)

b₀ = Intercept (Predicted salary when years of experience = 0)

b₁ = Slope (Rate of change in salary per year of experience)

X = Independent Variable (Years of Experience)




From the trained model, we can obtain:




  1. The intercept()
    The predicted salary for an employee with 0 yrs of experience




model.intercept_







  1. The slope (coefficient)
    Represents the change in salary for each additional year of experience




model.coef_






The trained model is then used to predict salaries on the test dataset using model.predict(X_test).



Prediction of salaries






Model Evaluation



The model’s performance is evaluated using the R-squared (R²) metric.

The R² score measures how much of the variation in salary is explained by years of experience.

In this case the R² score is 0.93 (93%) indicating that years of experience explain most of the variation in salary showing a strong model fit.



R2 Score






Plot the Model



To visualize the relationship and the regression line:

SalaryvsYearExperience visual






Conclusion



This project demonstrates that Linear Regression can effectively model the relationship between years of experience and salary.



Thank you for reading!❤️.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Predicting Employee Salary Using Linear Regression

Thematisch verwandte Begriffe: Predicting, Employee, Salary, Using · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-58268 | SIPGO is a library for writing SIP services in the GO language. Prior to…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick