Skip to content

Ayushman0Singh/MLfromscratch

Repository files navigation

ML Implementations from scratch

Small Implementation of linear regression, logistic regression and Decision tree model from scratch using Python.

Introduction This code offers the following functionalities:

  • Custom r2_score function to calculate the R-squared value (coefficient of determination).
  • LinearRegression class for linear regression:
    • Configurable learning rate and number of iterations.
    • fit method to train the model on a dataset.
    • predict method to make predictions.
  • Testing script demonstrating usage:
    • Creates synthetic data.
    • Trains and fits the model.
    • Makes predictions and evaluates performance.
    • Visualizes results.

Usage

  1. Import and initialize:

    from regression import LinearRegression
    
    model = LinearRegression(learning_rate=0.001, num_iterations=1000)
  2. Use the Fit and predict Methods

    X_train, y_train = ...  # Your training data
    model.fit(X_train, y_train)
    predictions = model.predict(X_new)

Dependencies

  • numpy
  • sklearn (used for testing)
  • matplotlib (used for testing)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages