Skip to main content

A Collection of Machine Learning Algorithms implemented from Scratch

Project description

Py-Shasha

Shasha is a collection of machine learning models implemented from scratch. This library provides simple and easy-to-use implementations of various machine learning algorithms, including linear regression, multiple regression, logistic regression, k-nearest neighbors (KNN), decision trees,random forests,XGB classifier and SVM.

Installation

You can install Shasha using pip:

pip install shasha

Usage

Here are some examples of how to use the models provided by Shasha:

Linear Regression

from shasha import My_Linear_Regression
import numpy as np

# Sample data
X_train = np.array([[1], [2], [3]])
y_train = np.array([1, 2, 3])

# Create and train the model
model = My_Linear_Regression()
model.fit(X_train, y_train)

# Make predictions
predictions = model.predict(X_train)
print(predictions)

Multiple Regression

from shasha import My_Multiple_Regression
import numpy as np

# Sample data
X_train = np.array([[1, 2], [2, 3], [3, 4]])
y_train = np.array([1, 2, 3])

# Create and train the model
model = My_Multiple_Regression()
model.fit(X_train, y_train)

# Make predictions
predictions = model.predict(X_train)
print(predictions)

Logistic Regression

from shasha import My_Logistic_Regression
import numpy as np

# Sample data
X_train = np.array([[1, 2], [2, 3], [3, 4]])
y_train = np.array([0, 1, 0])

# Create and train the model
model = My_Logistic_Regression()
model.fit(X_train, y_train)

# Make predictions
predictions = model.predict(X_train)
print(predictions)

K-Nearest Neighbors (KNN)

from shasha import My_KNN
import numpy as np

# Sample data
X_train = np.array([[1, 2], [2, 3], [3, 4]])
y_train = np.array([0, 1, 0])
X_test = np.array([[2, 2]])

# Create and train the model
model = My_KNN(n_neighbors=3)
model.fit(X_train, y_train)

# Make predictions
predictions = model.predict(X_test)
print(predictions)

Random Forest

from shasha import My_Random_Forest
import numpy as np

# Sample data
X_train = np.array([[1, 2], [2, 3], [3, 4]])
y_train = np.array([0, 1, 0])
X_test = np.array([[2, 2]])

# Create and train the model
model = My_Random_Forest(n_trees=10)
model.fit(X_train, y_train)

# Make predictions
predictions = model.predict(X_test)
print(predictions)

Decision Tree

from shasha import My_DecisionTree
import numpy as np

# Sample data
X_train = np.array([[1, 2], [2, 3], [3, 4]])
y_train = np.array([0, 1, 0])
X_test = np.array([[2, 2]])

# Create and train the model
model = My_DecisionTree()
model.fit(X_train, y_train)

# Make predictions
predictions = model.predict(X_test)
print(predictions)

XGBoost Classifier

from py-shasha import My_XGB_Classifier
import numpy as np

# Sample data
X_train = np.array([[1, 2], [2, 3], [3, 4]])
y_train = np.array([0, 1, 0])
X_test = np.array([[2, 2]])

# Create and train the model
model = My_XGB_Classifier()
model.fit(X_train, y_train)

# Make predictions
predictions = model.predict(X_test)
print(predictions)

Support Vector Machine (SVM)

from shasha import My_SVM
import numpy as np

# Sample data
X_train = np.array([[1, 2], [2, 3], [3, 4]])
y_train = np.array([0, 1, 0])
X_test = np.array([[2, 2]])

# Create and train the model
model = My_SVM()
model.fit(X_train, y_train)

# Make predictions
predictions = model.predict(X_test)
print(predictions)

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Contact

For any questions or feedback, please contact Shabari Prakash.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shasha-0.0.5.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shasha-0.0.5-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file shasha-0.0.5.tar.gz.

File metadata

  • Download URL: shasha-0.0.5.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for shasha-0.0.5.tar.gz
Algorithm Hash digest
SHA256 3f3f6af392af2b940f11634241eb06d59ab6622054c5e0d58d74ceb6a54a22de
MD5 f9cbff23af3c8370f54b94a4e88a546d
BLAKE2b-256 3546c74e624cb689bbaed02fa3845dfa7fb12a33dc6bbeb8403ca917a573d823

See more details on using hashes here.

File details

Details for the file shasha-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: shasha-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for shasha-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 779844fef848255144337ae35566d1b7740449250520ea1c33de09487e97be5d
MD5 c7fa82fcf08dc4238469052ea8a02e67
BLAKE2b-256 b47fb555b4738827f0a0949122b416d1b21e56a0868e928c3dd65b6aed5e5ebc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page