Skip to main content

Fast L2-reguralized linear regression

Project description

PyFastL2LiR: Fast L2-regularized Linear Regression

PyPI version GitHub license

PyFastL2LR is fast implementation of ridge regression (regression with L2 normalization) that is developed for predicting neural netowrk unit activities from fMRI data. This method is five times faster than ordinary implementations of ridge regression, and can be used with feature selection.

Installation

$ pip install fastl2lir

When installing on Python >= 3.5, threadpoolctl are required.

Usage

import fastl2lir


model = fastl2lir.FastL2LiR()
model.fit(X, Y, alpha, n_feat)
Y_predicted = model.predict(X)

Here,

  • X: A matrix (# of training samples x # of voxels).
  • Y: A vector including label information (# of training samples x # of cnn features).
  • alpha: Regularization term of L2 normalization.
  • n_feat: # of features to be selected (feature selection is based on correlation coefficient).

See demo.py for more examples.

Notice

  • You don't need to add bias term in X; FastL2LiR automatically adds the bias term in the input data.
  • FastL2LiR.fit() automatically performs feature selection. You don't need to select features by yourself.
  • X and Y should be z-scored with mean and standard deviation of training data.

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

fastl2lir-0.11.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

fastl2lir-0.11-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file fastl2lir-0.11.tar.gz.

File metadata

  • Download URL: fastl2lir-0.11.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for fastl2lir-0.11.tar.gz
Algorithm Hash digest
SHA256 7930d6c5c0886392a2236f08e637199b965d4167afef0632da678737f8c7cd62
MD5 7617b8780e86a5f903c0ff4b6e856d63
BLAKE2b-256 01670094fbe23ad1cba35f5b70dad8c4d6bacf3b93956a103c02f9d7fda8d875

See more details on using hashes here.

File details

Details for the file fastl2lir-0.11-py3-none-any.whl.

File metadata

  • Download URL: fastl2lir-0.11-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for fastl2lir-0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 4d831fc1d9ab0bad20301f9495e91b9f16677ebcac68296a8906acbd9dfc3f89
MD5 42a2d88a9f6bf25848b5b3de475c70f6
BLAKE2b-256 40949508edf9642dca84d57c35cd9b0dfce52fafcfcb708cee46fd580f518029

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