This repository contains a custom implementation of a Decision Tree Classifier and Regressor in Python. The code contained in this repository is for self-practice purposes only. Please refrain from using these models for deployment. I recommend using scikit-learn's models for production use.
The models implemented here may not be optimal. The purpose i made this repository is because i am learning to build machine learning algorithms from scratch. If you like to try some models i have built, you can pull this repository and follow some example on how to use it.
Use this to create a machine learning model. Again, i recommend using scikit-learn's models for production use.
If you want to use the custom DecisionTreeClassifier
in your project or anything else, follow these steps:
-
Clone this repository to your workspace (if you have not done it)
!git clone https://github.com/fadhilmuh/machine_learning_practice.git
-
Import the model you want. For example,
DecisionTreeClassifier
class:from machine_learning_practice.models.decision_trees import DecisionTreeClassifier
or import the whole library
import machine_learning_practice as MLP
-
initialize the
DecisionTreeClassifier
:tree = DecisionTreeClassifier()
or if you use from the main library (following the previous step)
tree = MLP.models.decision_trees.DecisionTreeClassifier()
-
fit the tree with your data
tree.fit(features, target)
further example is available in the example
directory.