Skip to main content

Logistic Regression Classifier

Project description

logregnumpy

Pet Project. Logistic Regressor Classifier.

Performs a gradient descent method for a loss minimizing.

Works with binary and multiclass targets.

Parameters

lr : float, default=1e-3 Learning rate (size) for each step of an gradient descent.

l2_reg : float, default=0.2 Degree of L2 penalty.

epochs : int, default=100 Number of gradient descent iterations.

Examples

>>> from sklearn.datasets import load_iris  
>>> from logregnumpy import LogRegNumpy  
>>> X, y = load_iris(return_X_y=True)  
>>> model = LogRegNumpy(l2_reg=0.1, epochs=1000)  
>>> model.fit(X, y)  
>>> model.predict(X)[:3]  

array([0, 0, 0])  

>>> model.predict_proba(X)[:3]

array([[9.69584306e-01, 3.04018742e-02, 1.38198704e-05],  
       [9.32753885e-01, 6.71844981e-02, 6.16165599e-05],  
       [9.57931295e-01, 4.20313028e-02, 3.74027136e-05]])  

Methods

fit(X, y, verbose=False, plot=False) Fit the model according to the given training data. May return a loss value graph.

Parameters

X : array-like of shape (n_samples, n_features) Training vector, where n_samples is the number of samples and
n_features is the number of features.
y : array-like of shape (n_samples,)
Target vector relative to X.
verbose : bool, default=False
If true, returns array with loss values on each iteration.
plot : bool, default=False
If true, returns a loss value graph.

predict(X) Predict class labels for samples in X.
predict_proba(X) Probability estimates.

Notes

To successfully uninstall the package from Jupyter notebook, use the following code:

pip uninstall logregnumpy --yes

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

logregnumpy-0.1.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

logregnumpy-0.1.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file logregnumpy-0.1.1.tar.gz.

File metadata

  • Download URL: logregnumpy-0.1.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6

File hashes

Hashes for logregnumpy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 43e147e6af0b9ba9aefdcd7c6292f2381d99f31eebdf69939d158d150d2e22ad
MD5 8696e8e714afe99bbb6e684b084fc67a
BLAKE2b-256 a42df6511551ba54b437d845a0a92d09d88c06ff7d9d927176a84ddd880c848c

See more details on using hashes here.

File details

Details for the file logregnumpy-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: logregnumpy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6

File hashes

Hashes for logregnumpy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f4c0cc39c8696248e125b59be4ec9cfebc145e0376ff3c583d5989143fd836e4
MD5 8e48bd32c39c33569adbf1ab605f598d
BLAKE2b-256 bbf9a7888504519ae50dd9c0aa5a7a314047f5a4c5fd5a232b6646de5d50a0a3

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