Metadata-Version: 2.1
Name: vcosmos
Version: 1.1.0
Summary: This package implements a 3D projection-based outlier detection algorithm using median-derived distance thresholds.
Home-page: https://github.com/KarthikDevalla/vcosmos.git
Author: Karthik Devalla
Author-email: ihatecoding666@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE.txt

# __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
```python
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]
```
---
