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
- Primal
- Dual
- Naive Bayes
- GaussianNB
- MultinomialNB
- Decision Tree (both Regression/Classification)
- Random Forest (both Regression/Classification)
- GBDT (both Regression/Classification)
- PCA
- LDA
Preprocessing:
- normalize
- MinMaxScaler
- StandardScaler
- KFold
- GridSearchCV
If you are not familiar with Mojo projects, you can get started here: https://docs.modular.com/mojo/manual/get-started/
- MAX 25.5
Additionally, you may want to install bellow Python packages for a better usability and to run tests:
- Pandas
- Scikit-learn
- Matplotlib
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.
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.
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.
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 *
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:
- Apply improvements to the code and Open a Pull Request
- Report a bug
- Suggest new features
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.