Skip to main content

A small package for LoRAS oversampling

Project description


Localized Randomized Affine Shadowsampling (LoRAS) oversampling technique


The latest version is available on PyPi and installable with the command: pip install loras


There is just one method fit_resample(maj_class_points, min_class_points, k, num_shadow_points, list_sigma_f, num_generated_points, num_aff_comb, random_state=42)

There are two mandatory inputs:

  • maj_class_points : Majority class parent data points which is a non-empty list containing numpy arrays acting as points
  • min_class_points : Minority class parent data points which is a non-empty list containing numpy arrays acting as points

There are also optional parameters:

  • k : Number of nearest neighbours to be considered per parent data point (default value: 8 if len(min_class_points)<100 else 30)
  • num_shadow_points : Number of generated shadowsamples per parent data point (default value: ceil(2*num_aff_comb / k))
  • list_sigma_f : List of standard deviations for normal distributions for adding noise to each feature (default value: [0.005, ... , 0.005])
  • num_generated_points : Number of shadow points to be chosen for a random affine combination (default value: ceil((len(maj_class_points) + len(min_class_points)) / len(min_class_points)))
  • num_aff_comb : Number of generated LoRAS points for each nearest neighbours group (default value: min_class_points.shape[1])


  • min_class_points::oversampled_set : Concatenation of original data points and oversampled ones

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for loras, version 0.0.22b0
Filename, size File type Python version Upload date Hashes
Filename, size loras-0.0.22b0-py3-none-any.whl (4.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size loras-0.0.22b0.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page