Giter VIP home page Giter VIP logo

advance-ml-project's Introduction

Make a ExtraTreesClassifier algo from scratch ๐Ÿงฉ

[Pacmann Project]

This project provides an implementation of a Extra Trees Classifier algorithm from scratch, without libraries scikit-learn. i'll embark on a journey to create an Extra Trees Classifier from scratch, immersing ourselves in the intricate details of its inner workings.

By constructing each component step-by-step, we'll uncover the elegance and effectiveness of this ensemble learning technique. Our journey begins with crafting a clear pseudocode, ensuring a well-structured and efficient implementation.

Let's dive into the core algorithm ๐Ÿš€

Pseudocode for fitting model

Input: n_estimators, max_depth, min_samples_split
Output: Initialized ETC model

1. Set n_estimators, max_depth, dan min_samples_split into input params.
2. Initialize the array to store the decision trees.
3. Return the initialized Extra Trees model.

Pseudocode for training model

Input: Training data (X_train, y_train)
Output: Ensemble of decision trees

1. Loop as many times as n_estimators:
    a. Take a random sample with replacement from the training data.
    b. Build a decision tree using the subset of data taken.
    c. Add the decision tree to the ensemble.
2. Return the ensemble of decision trees.

Pseudocode for predict data

Input: Test data (X_test)
Output: Class prediction for each sample in X_test

1. Loop for each sample in X_test:
    a. Perform prediction using each tree in the ensemble.
    b. Collect the prediction results from all trees.
2. Perform majority voting for each sample:
    a. Calculate the frequency of each class based on the prediction results.
    b. Select the class with the highest frequency as the final prediction.
3. Return the class prediction for each sample in X_test.

How to run?

  • clone the repo
  • take the dummy dataset or the dataset you want to train on.
  • import package with command -> from ExtraTree import ExtraTreesClassifier
  • Example usage :
    # Training
    etc = ExtraTreesClassifier( n_estimators=1, max_depth=2, min_samples_split=5)
    etc.fit(X_train, y_train)
    # predict
    predictions = etc.predict(X_test)
    

Acknowledgements

advance-ml-project's People

Contributors

ridwenddev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.