Challenge: Implement Negative Selection Algorithm
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:
- Generate detectors: in the
generate_detectorsfunction, you must:- Generate random
candidatepatterns. - Check if the
candidatepattern is in theself_set. - Only add the
candidateto thedetectorsset if it is not a "self" pattern.
- Generate random
- Classify patterns: in the
classify_patternsfunction, you must:- Check each
patternfrom thetest_patternslist. - If the
patternis in theself_set, classify it as'self'. - Else, if the
patternis in thedetector_set, classify it as'non-self'. - Otherwise (if it is not "self" and not in the generated detector list), classify it as
'non-self'.
- Check each
Solução
Obrigado pelo seu feedback!
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Can you explain this in simpler terms?
What are some examples related to this topic?
How does this information apply to real-life situations?
Awesome!
Completion rate improved to 6.25
Challenge: Implement Negative Selection Algorithm
Deslize para mostrar o menu
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:
- Generate detectors: in the
generate_detectorsfunction, you must:- Generate random
candidatepatterns. - Check if the
candidatepattern is in theself_set. - Only add the
candidateto thedetectorsset if it is not a "self" pattern.
- Generate random
- Classify patterns: in the
classify_patternsfunction, you must:- Check each
patternfrom thetest_patternslist. - If the
patternis in theself_set, classify it as'self'. - Else, if the
patternis in thedetector_set, classify it as'non-self'. - Otherwise (if it is not "self" and not in the generated detector list), classify it as
'non-self'.
- Check each
Solução
Obrigado pelo seu feedback!
single