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

Uploaded Python 3

File details

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

File metadata

  • Download URL: shasha-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 172be65e9a24d74ccfcbcc070910e1753b27f5dc4c6ede88b79e90d73aa5389f
MD5 d716c770e975e8abe1fc264b8581ce97
BLAKE2b-256 0dad2b885aadf62bf01ee27fbe00ca3d13526acb7c876d9b52edcb2f5b574e4d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: shasha-0.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d81c9db68076fe467bbcf602cf2e1d30669ad2b0a4eb35cab34e835d2e1b29b7
MD5 7d93546f4c92def7853d4063037ffd63
BLAKE2b-256 b4f17e477f0399833482cfd32db05e287ae76d07152934b79bf581b86f1aecff

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