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

Uploaded Python 3

File details

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

File metadata

  • Download URL: shasha-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 33506d7b6ba0c5d720182f8a57d96a98123b3ceccf98c7e1faef6e580584aa64
MD5 5027d5cf77d0f559ff867b949f21539a
BLAKE2b-256 9ffeff724dd6ec242df85203ff9413ed784c5f753043290ad4761c4cb6498806

See more details on using hashes here.

File details

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

File metadata

  • Download URL: shasha-0.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4cbb6acc4ea6554ae758c1c50f59abb02cd8edd6bce00c6dad450a59d5747dd4
MD5 8719e68968e7756a688da233dbe2de16
BLAKE2b-256 b7994553989245d7fe1a74c2f7ad239d7b59600549218bb493052ee8a4641ab1

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