Skip to content

olia110/ProjectLinearRegression

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ProjectLinearReg

Installation & Setup

Installing Ninja

If ninja is not installed, you can install it using one of the following methods:

Using Conda

conda install -c conda-forge ninja

1. Create and Activate a Conda Environment

conda create -n linear_reg_env -y
conda activate linear_reg_env
conda install -c conda-forge cmake
conda install matplotlib

2. Install Dependencies

Install xtensor and xtensor-blas from conda-forge:

conda install -c conda-forge xtensor xtensor-blas
conda install -c conda-forge cmake

3. Build the Project

Use CMake and Ninja to build the project:

mkdir build && cd build
cmake -G Ninja ..
ninja

4. Run the Main Application

./main

5. Run the Tests

./tests/test_linear_regression

5. Run the visualization

./src/visualization

Main Files

  • src/main.cc: It generates a synthetic dataset, applies linear regression using both closed-form and gradient descent methods, and outputs the results.

  • src/optim.h and src/optim.cc: These files define the algorithms used in the project. The ClosedForm class implements the closed-form solution for linear regression, while the GradientDescent class implements the iterative gradient descent algorithm.

  • src/loss.h and src/loss.cc: Defines the loss functions used to evaluate the performance of the linear regression model. The MSELoss class calculates the mean squared error, and the RMSELoss class calculates the root mean squared error.

  • tests/test_linear_regression.cc: Unit tests for the linear regression model.

  • src/visualization.cc: This file contains the code for the visualization of the data and the results.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published