Skip to content

This repository contains code and materials from the University of Luxembourg Workshop (October 12th, 2024), demonstrating a simple linear regression model to predict exam scores based on study hours. The repository includes Python code, workshop slides, and additional resources for learning basic machine learning concepts.

License

Notifications You must be signed in to change notification settings

SteveProkovas/University-of-Luxembourg-Workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

University of Luxembourg Workshop

This repository contains a simple Python implementation of a linear regression model that predicts exam scores based on study hours. The project is part of the University of Luxembourg Workshop (October 12th, 2024) and is published here for anyone interested in revisiting the material discussed during the workshop.

Table of Contents

Overview

This project demonstrates how to use a basic linear regression model to predict exam scores from the number of hours studied. The training data consists of three student records, with each entry representing the hours studied and the corresponding exam score.

This example was covered in the University of Luxembourg Workshop, and this repository provides an opportunity to revisit and understand the concepts of machine learning, specifically linear regression.

Model Explanation

The model aims to learn a relationship between the number of hours studied (input) and the exam score (output). It adjusts its parameter ( w ) to minimize the error between predicted and actual scores using a simple gradient descent algorithm.

Training Data

  • Student A: Studied 1 hour, scored 50 points.
  • Student B: Studied 3 hours, scored 65 points.
  • Student C: Studied 5 hours, scored 80 points.

The model finds the best parameter ( w ) to make accurate predictions based on this data.

Learning Process

  • Initial guess for ( w ): Starts at 10.0.
  • Learning rate: 0.01
  • Stopping criterion: Converges when the change in ( w ) is smaller than the tolerance of 1e-6.

The model iterates over the data, adjusts ( w ) to minimize the prediction error, and stops when convergence is reached.

Code Overview

Here’s a simplified explanation of the code:

  1. Initialize Parameters: Set an initial guess for ( w ) and define the learning rate, number of epochs, and tolerance for convergence.
  2. Training Loop: For each epoch, the model:
    • Predicts exam scores.
    • Computes errors based on actual scores.
    • Updates ( w ) using gradient descent.
    • Checks for convergence.
  3. Final Output: Prints the learned value of ( w ) and the final predictions.

Running the Code

To run this project, clone the repository and execute the Python script.

git clone https://github.com/SteveProkovas/University-of-Luxembourg-Workshop.git
cd University-of-Luxembourg-Workshop
python Example.py

Requirements

  • Python 3.x
  • No external libraries are required for this implementation.

Workshop Slides

You can view the slides from the University of Luxembourg Workshop here.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

About

This repository contains code and materials from the University of Luxembourg Workshop (October 12th, 2024), demonstrating a simple linear regression model to predict exam scores based on study hours. The repository includes Python code, workshop slides, and additional resources for learning basic machine learning concepts.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages