Skip to main content

A Collection of Machine Learning Algorithms implemented from Scratch

Project description

Py-Shasha

Py-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 py-shasha

Usage

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

Linear Regression

from py-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 py-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 py-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 py-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 py-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 py-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 py-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.1.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.1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for shasha-0.0.1.tar.gz
Algorithm Hash digest
SHA256 309c211a99f9f924655f02ebaa3290d2fcfe928b0bc9e332c4224f17e2c7cf5b
MD5 860f6a1bf0bad5a453c813aa1819e7fa
BLAKE2b-256 ef39692f4e51fa0b40ef15206ee8848c7e655a0ba6f389aa57200b1c16baf70b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: shasha-0.0.1-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.13.0

File hashes

Hashes for shasha-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 60145708b4707d33104aed31669f443b07ea9d2728046c5af5ac4b0a803669c9
MD5 d4dae43bc0bb4a7de9308978549b52f8
BLAKE2b-256 5a03e5e7107ef9c7b23e0e31455daf21eef0c8a7f2c9fdbc40aa4509e87b3f97

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