Skip to content

yetalit/Mojmelo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Issues BSD-3-Clause License CodeQL


About The Project

The name Mojmelo is derived from the "Mojo Machine Learning" expression. It includes the implementation of Machine Learning algorithms from scratch in pure Mojo. Here is the list of the algorithms:

  • Linear Regression
  • Polynomial Regression
  • Logistic Regression
  • KNN
  • KMeans
  • DBSCAN
  • SVM
    1. Primal
    2. Dual
  • Naive Bayes
    1. GaussianNB
    2. MultinomialNB
  • Decision Tree (both Regression/Classification)
  • Random Forest (both Regression/Classification)
  • GBDT (both Regression/Classification)
  • PCA
  • LDA

Preprocessing:

  • normalize
  • MinMaxScaler
  • StandardScaler
  • KFold
  • GridSearchCV

Getting Started

If you are not familiar with Mojo projects, you can get started here: https://docs.modular.com/mojo/manual/get-started/

Prerequisites

  • MAX 25.5

Additionally, you may want to install bellow Python packages for a better usability and to run tests:

  1. Pandas
  2. Scikit-learn
  3. Matplotlib

Installation

There are two ways you can install mojmelo: Using Pixi CLI or through the source code.

To complete the installation, you should also finish the setup process which will be discussed later.

Pixi CLI

Make sure you have the Modular community channel (https://repo.prefix.dev/modular-community) in your pixi.toml file in the channels section, then Run the following command:

pixi add mojmelo

To start the setup process, Run the following command from the main folder of your project:

bash ./.pixi/envs/default/etc/conda/test-files/mojmelo/0/tests/setup.sh

Note: For better results, please try not to run other tasks on your pc during the setup process.

Source Code

You can also install mojmelo through the source code. This way, you will have the source code in your project.

First, Download mojmelo folder and setup.mojo file. Then Add the following task to your pixi.toml file in the tasks section:

[tasks]
setup = """
cd <path_to_mojmelo_location> &&
mojo ./setup.mojo &&
mojo ./setup.mojo 1 &&
mojo ./setup.mojo 2 &&
mojo ./setup.mojo 3 &&
mojo ./setup.mojo 4 &&
mojo ./setup.mojo 5 &&
mojo ./setup.mojo 6 &&
mojo ./setup.mojo 7 &&
mojo ./setup.mojo 8 &&
mojo ./setup.mojo 9"""

Don't forget to change <path_to_mojmelo_location> according to where mojmelo folder and setup.mojo file are stored.

Then Run the following command to start the setup process:

pixi run setup

Note: For better results, please try not to run other tasks on your pc during the setup process.

Usage

Just import any model you want this way:

from mojmelo.LinearRegression import LinearRegression

You may also want to use the utility codes I've written for this project:

from mojmelo.utils.Matrix import Matrix
from mojmelo.utils.utils import *

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

You can contribute to the project in 3 ways:

  1. Apply improvements to the code and Open a Pull Request
  2. Report a bug
  3. Suggest new features

Acknowledgments

Took inspiration from Patrick Loeber's MLfromscratch and Erik Linder-Norén's ML-From-Scratch

MAX and Mojo usage and distribution are licensed under the Modular Community License.

About

Machine Learning algorithms in pure Mojo 🔥

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •