Skip to main content

This package implements a 3D projection-based outlier detection algorithm using median-derived distance thresholds.

Project description

spatial_domain.anomaly.O_Sieve


class O_Sieve(data, column, tsf=1, bsf=1)


O_Sieve is an outlier detection algorithm that utilizes a 3D projection of data points. It calculates distances of data points from a centre point in the 3D space, based on the squared values of the target column. The algorithm then determines upper and lower distance thresholds using a median-based approach. Data points that fall outside these thresholds are considered outliers. This class also provides methods for visualizing the data in the 3D space.


What's new - Version release 1.0.2

  • Added support for boxplots , Pre and Post Cleaning along with the heliocentric slicing plot to perform better cleaning.

Parameters:

  • data: dataframe

    • The data on which the algorithm should be applied.
  • column: str

    • Target column, the filtering is done based on this column.
  • tsf: int or float, default=1

    • Top scaling factor, the quantity with which the median distance must be multplied above the centre plane.
  • bsf : int or float, default=1

    • Bottom scaling factor, the quantity with which the median distance must be multplied below the centre plane.

Installation

pip install vcosmos

Usage

import pandas as pd
from spatial_domain.anomaly import O_Sieve
# Reading a dataset using pandas.
df=pd.read_csv('co2.csv')
print(df.head)

#   Make       Model Vehicle Class  Engine Size(L)  ...  Fuel Consumption Hwy (L/100 km) Fuel Consumption Comb (L/100 km) Fuel Consumption Comb (mpg)  CO2 Emissions(g/km)
# 0  ACURA         ILX       COMPACT             2.0  ...                              6.7                              8.5                          33                  196
# 1  ACURA         ILX       COMPACT             2.4  ...                              7.7                              9.6                          29                  221
# 2  ACURA  ILX HYBRID       COMPACT             1.5  ...                              5.8                              5.9                          48                  136
# 3  ACURA     MDX 4WD   SUV - SMALL             3.5  ...                              9.1                             11.1                          25                  255
# 4  ACURA     RDX AWD   SUV - SMALL             3.5  ...                              8.7                             10.6                          27                  244

# [5 rows x 12 columns]

seive= O_Seive(df,'CO2 Emissions(g/km)',tsf=4.5,bsf=2)
clean_data=seive.filtered_data()
plot=seive.hcps_plot()
print(clean_data.head())

# Filtering Initiated....
# Filtering Complete.
# Ouliers Removed: 11
#     Make       Model Vehicle Class  Engine Size(L)  ...  Fuel Consumption Hwy (L/100 km) Fuel Consumption Comb (L/100 km) Fuel Consumption Comb (mpg)  CO2 Emissions(g/km)
# 0  ACURA         ILX       COMPACT             2.0  ...                              6.7                              8.5                          33                  196
# 1  ACURA         ILX       COMPACT             2.4  ...                              7.7                              9.6                          29                  221
# 2  ACURA  ILX HYBRID       COMPACT             1.5  ...                              5.8                              5.9                          48                  136
# 3  ACURA     MDX 4WD   SUV - SMALL             3.5  ...                              9.1                             11.1                          25                  255
# 4  ACURA     RDX AWD   SUV - SMALL             3.5  ...                              8.7                             10.6                          27                  244

# [5 rows x 12 columns]

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

vcosmos-1.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

vcosmos-1.1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file vcosmos-1.1.0.tar.gz.

File metadata

  • Download URL: vcosmos-1.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for vcosmos-1.1.0.tar.gz
Algorithm Hash digest
SHA256 582ef02bb4bcd45cd473372d3d2e7415183feaab9e1d9b918eb0fac34b3eee1b
MD5 073e91344b5aac23597afbe0cc8e9ab6
BLAKE2b-256 2c68881368b37fd3c82e93958b4ab44b1896f180294cd71ee018d4a22d1f243b

See more details on using hashes here.

File details

Details for the file vcosmos-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: vcosmos-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for vcosmos-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0939b1c0b67d67c33f6669c4c75244894e5715dfb3ff360a179a29fd813f2e94
MD5 aa5154ba41ac5739a8111adf81bb110f
BLAKE2b-256 efb30fb0754045a85ba38180a352eca0f3354212e862c57aaa68382ae56a89b6

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