I need review for my first project

Hello
My name is Wiktor i’m new to ai/ml topics.I made very simple linear regression project but i dont know if it is correct so i need code review and some tips/tricks.

Project is about predicting salary for employe with some work experience. I took the data from kaggle. To be honest i dont know what i did right and what i did wrong.
My bigest problems here are:
-scaling
-code structure

Write anything u think that can improve this simple program. <3
Project: GitHub - wikt0r2115/Machine-learning-first-project-Salary: My first linear regression project
Kaggle: Salary Dataset - Simple linear regression | Kaggle

2 Likes

hi brother! my condition was same as yours a month ago but i am following book " Hands on machine learning with scikit learn keras and tensorflow . it helped me a lot . my python programming is not very strong so i am facing trouble reading book effectively but maybe you can easily gain knowledge from that book
Note - you can implement this code in 5 lines at most using scikit learn (after making Dataframe )

2 Likes

Oh yea i forgot to mention that i made it from scratch on purpose to better understand the concept of cost function and gradient descent. Thanks for book recomendation ill try that one.

2 Likes

@Wiktor1, which “DeepLearning.AI” courses have you completed?

I’m about to end first part of machine learning specialization. Its from DeepLearning.AI with Stanford. @TMosh

1 Like

In order to handle other datasets (which generally will have multiple features), I recommend you use numpy so you have access to matrix functions like dot products. Then you can get rid of the for-loops for computing the gradients.

Once you’re comfortable that you know how the algorithms work, you probably should switch to using sklearn or a similar package.

These packages have advanced solutions for finding the optimum solutions. Function minimizers are an art all their own. You don’t need to re-invent that wheel.

2 Likes

Thanks a lot for advices ill try to do same project with np and sklearn to see the diffrence in predicions.

1 Like

Hey !
I was looking into your code and it looks like everything seems to be right. however, I believe that there is a way to figure it out the accuracy of your predictions .

1 Like

Hi @Wiktor1 , Just yesterday, I stepped through the DeepLearningAI short course “Pair Programming with a Large Language Model” which shows us how to use an LLM as a coding tutor of sorts, to get ideas about how to improve our code, debug and also to generate test scripts code. You might want to take a look at that short course. I’ve used ChatGPT myself to get ideas about how to improve my own code. The short course shows you how to set up your prompt for optimal ‘back and forth’ with the model, and you can ask the model to ‘show me how to improve this code’ and have your program identified in the prompt as “this code.” My response here might not make complete sense, but if you take the short course (which is true to its name and is quite easy to step through), it might help. Best of luck!

1 Like