Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • P pyod
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 144
    • Issues 144
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 16
    • Merge requests 16
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Yue Zhao
  • pyod
  • Issues
  • #194
Closed
Open
Issue created May 20, 2020 by Administrator@rootContributor

Contamination parameter in LOCI

Created by: shortydips24

Testing multiple values of the contamination parameter yielded the same percentage of outliers (~13%). Review of the source code describes the contamination parameter used in the threshold. However, when looking at the source code for the threshold, the contamination parameter is set to k and does not use the contamination parameter. The contamination parameter is defined in the function as a parameter but not called at any point during the source code.

threshold_ : float The threshold is based on contamination. It is the n_samples * contamination most abnormal samples in decision_scores_. The threshold is calculated for generating binary outlier labels.

self.threshold_ = k

self.labels_ = (self.decision_scores_ > self.threshold_).astype('int').ravel()

Therefore, the number of outliers is defined only by the value of k, and not the contamination parameter. The % of outliers generated does not match the expected % of outliers.

One other finding of note, when looking at the function calculate_decision_score, outlier scores are only generated for a hardcoded value of n_hat: if n_hat >= 20: outlier_scores[p_ix] = mdef / sigma_mdef if mdef > (self.threshold * sigma_mdef):

Current logic does not seem to output outlier_scores when n_hat <20. Authors should consider parameterizing this value with n_hat having a default of >= 20 or to throw an error message when n_hat is not >=20.

Assignee
Assign to
Time tracking