Giter VIP home page Giter VIP logo

tzesh / forester Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.53 MB

Modular python class to use Random Forest Classifier and make predictions without re-training data. Does search to find best suitable hyper parameters to the given dataset. Evaluates and saves the statistics, also logs every single action using a logging mechanism.

License: GNU General Public License v3.0

Python 100.00%
classification machine-learning pickle random-forest ready-to-use-application scikit-learn

forester's Introduction

Forester

Modular python class to use Random Forest Classifier and make predictions without re-training data. Does search to find best suitable hyper parameters to the given dataset. Evaluates and saves the statistics, also logs every single action using a logging mechanism.

Features

  • Doesn't need to re-train data
  • Don't need to manually preprocess data
  • Predicts using the best hyper parameters
  • Saves statistics
  • Logs every single action
  • Modular
  • Easy to use

General Project Structure

  • data
    • data.csv # your data that you want to use to train the model
  • log
    • data_unique_datetime_identifier.txt # simply a log file
  • model
    • data_model_encoders.pickle # encoders that are used to encode the data in the preprocessing step
    • data_model_feature_names.pickle # feature names
    • data_model_value_name.pickle # output name
  • statistics
    • data_model_datetime_identifier_confusion_matrix.png # confusion matrix
    • data_model_datetime_identifier_decision_tree.dot # decision tree of the first tree
    • data_model_datetime_identifier_statistics.txt # statistics like accuracy, precision, recall, f1-score, etc.

Usage

from forester import Forester

# Initialize Forester
## Assumes that the data is in the './data/data.csv' file and the default delimiter is ','
## When we set train=True, it will train the model and save the required files
forester = Forester(train=True)

# Create your prediction data
val = [0,...,'Example', 1]

# call make_prediction method
## It will return the prediction
prediction = forester.make_prediction(val)

# Print the prediction
print(prediction)

Example usages from different datasets can be found in the Example.py file.

When you first run the code (Example.py), it will train the model and save the required files. After that, it will use the saved files to make predictions without re-training the model.

First run of Example.py

On the sequential runs, it will use the saved files to make predictions without re-training the model.

Second run of Example.py

Requirements

  • Python 3.6+
  • Scikit-learn
  • Pandas
  • NumPy
  • SciPy

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.