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

Opgave

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

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 4. Kapitel 4
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

close

Awesome!

Completion rate improved to 6.25

bookChallenge: Implement Negative Selection Algorithm

Stryg for at vise menuen

Opgave

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 desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 4. Kapitel 4
single

single

some-alt