Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Implement Negative Selection Algorithm | Artificial Immune Systems
Bio-Inspired Algorithms

bookChallenge: Implement Negative Selection Algorithm

Oppgave

Swipe to start coding

In this challenge, you will implement a basic negative selection algorithm (NSA) for anomaly detection.
This algorithm is inspired by the human immune system, which learns to distinguish between self (normal) and non-self (foreign) patterns.

You are given a list of self_patterns representing normal data.
Your task is to implement two core functions:

  1. Generate detectors: in the generate_detectors function, you must:
    • Generate random candidate patterns.
    • Check if the candidate pattern is in the self_set.
    • Only add the candidate to the detectors set if it is not a "self" pattern.
  2. Classify patterns: in the classify_patterns function, you must:
    • Check each pattern from the test_patterns list.
    • If the pattern is in the self_set, classify it as 'self'.
    • Else, if the pattern is in the detector_set, classify it as 'non-self'.
    • Otherwise (if it is not "self" and not in the generated detector list), classify it as 'non-self'.

Løsning

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 4. Kapittel 4
single

single

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

close

Awesome!

Completion rate improved to 6.25

bookChallenge: Implement Negative Selection Algorithm

Sveip for å vise menyen

Oppgave

Swipe to start coding

In this challenge, you will implement a basic negative selection algorithm (NSA) for anomaly detection.
This algorithm is inspired by the human immune system, which learns to distinguish between self (normal) and non-self (foreign) patterns.

You are given a list of self_patterns representing normal data.
Your task is to implement two core functions:

  1. Generate detectors: in the generate_detectors function, you must:
    • Generate random candidate patterns.
    • Check if the candidate pattern is in the self_set.
    • Only add the candidate to the detectors set if it is not a "self" pattern.
  2. Classify patterns: in the classify_patterns function, you must:
    • Check each pattern from the test_patterns list.
    • If the pattern is in the self_set, classify it as 'self'.
    • Else, if the pattern is in the detector_set, classify it as 'non-self'.
    • Otherwise (if it is not "self" and not in the generated detector list), classify it as 'non-self'.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 4. Kapittel 4
single

single

some-alt