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

Uploaded Python 3

File details

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

File metadata

  • Download URL: logregnumpy-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 0ddab1dbc58b7afe43ff6f30014c1d6b6fd5abd7e8c3c3a1ee6ca82e1b458e4b
MD5 59185a8ba348f72a8003f3660f0c7f63
BLAKE2b-256 3d216cbe1ba4f4284f5160b9fc221b286b1f3ff933756dec7f41c71579162afc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: logregnumpy-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 54076c8e9572029b680af81f3dba7b9866f1471495513957b8d2415589412882
MD5 f13af8796adc0c57a66448a425a3f690
BLAKE2b-256 c1e69551a44af2f987d5429c03f89eb866509d5f80097890f6211e3a0d3e9105

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