Skip to main content

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

Project description

vcosmos.spatial_domain.anomaly.O_Seive


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


O_Seive 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.


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, defaul-t=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 above the centre plane.

Installation

pip install vcosmos

Usage

import pandas as pd
from spatial_domain.anomaly import O_Seive
# 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-0.0.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

vcosmos-0.0.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vcosmos-0.0.1.tar.gz
  • Upload date:
  • Size: 4.3 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-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e37d3c99c01580276683e7e32be13620a023135816a4dede562d90b6da49d88d
MD5 78e560456fd641a44172b5f1119394f2
BLAKE2b-256 9bf8e96871acc092ab83edb7a25aad76e725cb2422ea75f7b6919cd038f3d6af

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vcosmos-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 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-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e9014efddf2122339394c3ad6bfce3bbe5a0b8af54cefd7fc71a992dfb081e45
MD5 2f1d2c56221bdbd903d5eb7523dd62b8
BLAKE2b-256 5497e647af6bd5500a4d5e791fc0fe1cfc050bd24eaf30f78e56585c412ef902

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