Skip to main content

Mines sequence patterns co-occuring with non-compliant windows in a target feature.

Project description

nwc-pattern-mining

Non-compliant Window Co-occurrence pattern mining in temporal data

  • A Python library to find sequential association patterns in time-series data, co-occurring with target anomalous windows.
  • Anomalous windows are sequences in which a target variable defies expected behavior (e.g. Emissions from a vehicle).
  • The patterns are found in co-occurrence with a specific non-compliant feature (to decipher the reason behinds it's irregular behavior).
  • The package uses various pruning methodologies to speed up pattern mining, and hashing for quick support count.
  • The algorithm is based on research: (Discovering non-compliant window co-occurrence patterns)[https://link.springer.com/article/10.1007/s10707-016-0289-3]

API-description:

from nwc_pattern_miner import mine_sequence_patterns

API Parameters:

  • series_df: pd.DataFrame; Input DataFrame (Only features [discretized] and Target [binarized] columns)
  • nc_window_col: str; Column Name with Binary Target (Anomalous Windows)
  • support_threshold: float; Support threshold for sequence co-occurrence patterns
  • crossk_threshold: float; Ripley's Cross-k threshold for sequence co-occurrence patterns
  • pattern_length: int; length of feature sequences co-occurring with anomalous windows
  • confidence_threshold: float, default=-1; Confidence threshold for sequence co-occurrence patterns
  • lag: int, default= 0; lag consideration between sequence patterns and anomalous windows
  • invalid_seq_indexes: list, default=list(); list of indexes across which sequence patterns would be invalidated
  • output_metric: {'crossk', 'support'}, default='crossk'; Metric used to sort patterns mined
  • output_type: {'topk', 'threshold'}, default='topk'; Type of output for sequence patterns mined
  • output_threshold: float, default= -1; Threshold cutoff used to get output sequence patterns, if output_type='threshold'
  • topk: int, default=100; Top-k sequence patterns obtained based on output_metric, if output_type='topk'
  • pruning_type: str, default=apriori; Between [apriori, br-dr], both have same run-time, 'br-dr' does more enumerations but enumeration speed is much faster due to UB pruning.

Sample Input DataFrame:

engrpm EGRkgph MSPhum EngTq NCWindow
9 11 5 3 1
3 1 5 4 0

Sample Output DataFrame:

engrpm EGRkgph MSPhum EngTq Count Support Kvalue Confidence First Occurrence Index
4 4 4 5 5 5 2 2 2 146 0.00528 2.377 1.0 47167
4 4 4 7 7 7 250 0.00643 2.357 1.0 41984

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

nwc_pattern_miner-0.2.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

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

nwc_pattern_miner-0.2-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file nwc_pattern_miner-0.2.tar.gz.

File metadata

  • Download URL: nwc_pattern_miner-0.2.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.4

File hashes

Hashes for nwc_pattern_miner-0.2.tar.gz
Algorithm Hash digest
SHA256 e99d21f43522234454c4522e9e10bbdd9c7b1f75bfdce84bda060cad6ac6075f
MD5 dc679c3898b40222817c06d8a424a6e5
BLAKE2b-256 210ed4b96a8b08073c8a5ba87f4d04b3236a3454deabd3f5f4053448a7058c78

See more details on using hashes here.

File details

Details for the file nwc_pattern_miner-0.2-py3-none-any.whl.

File metadata

  • Download URL: nwc_pattern_miner-0.2-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.4

File hashes

Hashes for nwc_pattern_miner-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 96cdecd6dd4773d910bb659f909c572fe7d2f516935ba9ea0806f7f9154e99aa
MD5 215f0d16fc57b9610971dfbdd6285705
BLAKE2b-256 2e3e71a05185356eb4112963555fd48e98fc4e6dd4092f4af7bd4cccd9d8ed48

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