From 6d8ec7e1dfc0af8944627abbabccf6b298e722ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Paulo?= <88985821+Joao-Paulo-Silva@users.noreply.github.com> Date: Thu, 25 Dec 2025 18:06:58 -0300 Subject: [PATCH 1/5] docs: Improves the documentation of the introduction. --- .../current/intro.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/intro.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/intro.md index faccfdbc..8c57a60a 100644 --- a/i18n/pt-br/docusaurus-plugin-content-docs/current/intro.md +++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/intro.md @@ -30,13 +30,30 @@ keywords: ![Pacote de Sistemas Imunológicos Artificiais](./assets/logo.svg) + +
+ +[![GitHub stars](https://img.shields.io/github/stars/AIS-Package/aisp?style=social)](https://github.com/AIS-Package/aisp) +[![PyPI Downloads](https://static.pepy.tech/personalized-badge/aisp?period=total&units=INTERNATIONAL_SYSTEM&left_color=GRAY&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/aisp) +![License](https://img.shields.io/pypi/l/aisp) +![Python version](https://img.shields.io/pypi/pyversions/aisp) +
--- ## Introdução -**AISP** é um pacote Python de técnicas imunoinspiradas, as quais aplicam metáforas do sistema imunológico dos vertebrados ao reconhecimento de padrões e à tarefas de otimização. Concebido como um pacote de sistemas imunológicos artificiais de código aberto, o AISP é resultado de um projeto de pesquisa iniciado em **2022** no Instituto Federal do Norte de Minas Gerais - Campus Salinas (**IFNMG - Salinas**). Sua distribuição é regida pela GNU Lesser General Public License v3.0 (LGPLv3). +**AISP (Artificial Immune Systems Package)** é um pacote Python de técnicas imunoinspiradas, as quais aplicam metáforas do sistema imunológico dos vertebrados ao reconhecimento de padrões e à tarefas de otimização. Concebido como um pacote de sistemas imunológicos artificiais de código aberto, o AISP é resultado de um projeto de pesquisa iniciado em **2022** no Instituto Federal do Norte de Minas Gerais - Campus Salinas (**IFNMG - Salinas**). Sua distribuição é regida pela GNU Lesser General Public License v3.0 (LGPLv3). + +### O que voce pode fazer com o AISP? + +O AISP oferece implementações de algoritmos bio-inspirados para: + +- **Detecção de anomalias**: Identifique padrões anormais em dados. +- **Classificação**: Classifique dados com multi-classes. +- **Otimização**: Encontre soluções ótimas para funções objetivas. +- **Clustering**: Agrupe dados sem supervisão. ### Algoritmos implementados From 6267f4d0ff9937e4af94be1a05023e50d5799e3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Paulo?= <88985821+Joao-Paulo-Silva@users.noreply.github.com> Date: Fri, 26 Dec 2025 01:13:55 -0300 Subject: [PATCH 2/5] docs: Improve the English introduction documentation. --- docs/intro.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/intro.md b/docs/intro.md index 178a8f7d..1e626fc5 100644 --- a/docs/intro.md +++ b/docs/intro.md @@ -28,11 +28,31 @@ keywords: + +
+ +[![GitHub stars](https://img.shields.io/github/stars/AIS-Package/aisp?style=social)](https://github.com/AIS-Package/aisp) +[![PyPI Downloads](https://static.pepy.tech/personalized-badge/aisp?period=total&units=INTERNATIONAL_SYSTEM&left_color=GRAY&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/aisp) +![License](https://img.shields.io/pypi/l/aisp) +![Python version](https://img.shields.io/pypi/pyversions/aisp) + +
+ --- ## Introduction -**AISP** is a Python package of immunoinspired techniques that apply metaphors from the vertebrate immune system to pattern recognition and optimization tasks. Conceived as an open-source package of artificial immune systems, AISP emerged from a research project initiated in **2022** at the Instituto Federal do Norte de Minas Gerais - Campus Salinas (**IFNMG - Salinas**). Its distribution is governed by the GNU Lesser General Public License v3.0 (LGPLv3). +**AISP (Artificial Immune Systems Package)** is a Python package of immunoinspired techniques that apply metaphors from the vertebrate immune system to pattern recognition and optimization tasks. Conceived as an open-source package of artificial immune systems, AISP emerged from a research project initiated in **2022** at the Instituto Federal do Norte de Minas Gerais - Campus Salinas (**IFNMG - Salinas**). Its distribution is governed by the GNU Lesser General Public License v3.0 (LGPLv3). + +### What can you do with AISP? + +AISP provides implementations of bio-inspired algorithms for: + +- **Anomaly detection**: Identify abnormal patterns in data. +- **Classification**: Classify data with multiple classes. +- **Optmization**: Find optimal solutions for objective functions. +- **Clustering**: Group data without supervision. + ### Algorithms implemented From 056723e6b00b79af9a51f53b5732be78ef2440e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Paulo?= <88985821+Joao-Paulo-Silva@users.noreply.github.com> Date: Sun, 28 Dec 2025 11:58:53 -0300 Subject: [PATCH 3/5] feat: add faq --- docs/faq.md | 0 docs/intro.md | 2 - .../current/faq.md | 136 ++++++++++++++++++ 3 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 docs/faq.md create mode 100644 i18n/pt-br/docusaurus-plugin-content-docs/current/faq.md diff --git a/docs/faq.md b/docs/faq.md new file mode 100644 index 00000000..e69de29b diff --git a/docs/intro.md b/docs/intro.md index 1e626fc5..e4bc38d6 100644 --- a/docs/intro.md +++ b/docs/intro.md @@ -28,7 +28,6 @@ keywords: -
[![GitHub stars](https://img.shields.io/github/stars/AIS-Package/aisp?style=social)](https://github.com/AIS-Package/aisp) @@ -53,7 +52,6 @@ AISP provides implementations of bio-inspired algorithms for: - **Optmization**: Find optimal solutions for objective functions. - **Clustering**: Group data without supervision. - ### Algorithms implemented > - [x] [**Negative Selection.**](./aisp-techniques/negative-selection/) diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/faq.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/faq.md new file mode 100644 index 00000000..84bb1e09 --- /dev/null +++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/faq.md @@ -0,0 +1,136 @@ +--- +sidebar_position: 6 +title: Perguntas Frequentes +sidebar_label: FAQ +keywords: + - FAQ + - Perguntas Frequentes + - Dúvidas + - Ajuda +--- + +Soluções rápidas para possíveis duvidas sobre o aisp. + +## Uso geral + +### Qual algoritmo devo escolher? + +Depende do tipo de problema: + +- **Detecção de anomalias**: Use ``RNSA`` ou ``BNSA``. + - RNSA para problemas com dados contínuos. + - BNSA para problemas com dados binários. +- **Classificação**: Use ``AIRS``, ``RNSA`` ou ``BNSA``. + - O ``RNSA`` e ``BNSA``, foram implementados para serem aplicados a classificação multiclasse. + - O ``AIRS`` é mais robusto para ruídos nos dados. +- **Otimização**: Use ``Clonalg``. + - A implementação pode ser aplicada à otimização (min/max) de funções objetivas. +- **Clustering/Agrupamento**: Use ``AiNet``. + - Separa grupos de dados automaticamente. + - Não requer numero de grupos predefinidos. + +--- + +### Como normalizar meus dados para utilizar o algoritmo ``RNSA``? + +O RNSA trabalha exclusivamente com dados normalizados no intervalo entre [0, 1]. Portanto, antes de aplicá-lo, é necessário normalizar os dados se não estiver neste intervalo. Uma forma simples é fazer utilizando as ferramentas de normalização do **scikit-learn**, como o [``MinMaxScaler``](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.MinMaxScaler.html). + +#### Exemplo + +Neste exemplo, ``X`` representa os dados de entrada não normalizados. + +```python +from sklearn.preprocessing import MinMaxScaler + +scaler = MinMaxScaler() + +x_norm = scaler.fit_transform(X) + +# Treinando o modelo com os dados normalizados. +rnsa = RNSA(N=100, r=0.1) +rnsa.fit(x_norm, y) +``` + +--- + +## Configuração de Parâmetros + +### Como escolher o numero de detectores (N) no RNSA ou BNSA? + +O numero de detectores afeta diretamente a performance: + +- Um número reduzido de detectores pode não cobrir adequadamente o espaço não-próprio. +- Um número muito alto de detectores pode aumentar o tempo de treinamento e pode causar overfitting. + +**Recomendações**: + +- Teste diferentes valores para o número de detectores até encontrar um equilíbrio adequado entre tempo de treinamento e desempenho do modelo. +- Utilize validação cruzada para identificar o valor que apresenta os melhores resultados de forma consistente. + +--- + +### Qual raio (``r`` ou ``aff_thresh``) devo utilizar no BNSA ou RNSA? + +O raio dos detectores depende da distribuição dos dados: + +- Raio muito pequeno, podem não detectar anomalias. +- Raio muito grandes, podem sobrepor o self e nunca gerar detectores validos. + +--- + +### O que é o parâmetro ``r_s`` no RNSA? + +O ``r_s`` é o raio da amostra self. Ele define uma região ao redor de cada amostra de treinamento. + +--- + +### Clonalg: Como definir a função objetivo? + +A função objetiva deve seguir o padrão da [classe base](https://github.com/AIS-Package/aisp/blob/main/aisp/base/core/_optimizer.py#L140), Ela deve receber uma solução como entrada e retornar um valor do custo (ou afinidade). + +```python +def affinity_function(self, solution: Any) -> float: + pass +``` + +Existem duas formas de definir a função objetivo no Clonalg. + +1. Definindo a função diretamente no construtor da classe + +```python +def sphere(solution): + return np.sum(solution ** 2) + +clonalg = Clonalg( + problem_size=2, + affinity_function=sphere +) +``` + +2. Utilizando o registrador de funções + +```python +def sphere(solution): + return np.sum(solution ** 2) + +clonalg = Clonalg( + problem_size=2, +) + +clonalg.register("affinity_function", sphere) +``` + +## Informações adicionais + +### Onde encontrar mais exemplos? + +- **[Exemplos na documentação](./examples/)**. +- **[Exemplos no github](https://github.com/AIS-Package/aisp/tree/main/examples)** + +### Como contribuir para o projeto? + +Veja o [Guia de Contribuição](https://github.com/AIS-Package/aisp/blob/main/CONTRIBUTING.md) no GitHub. + +### Ainda tem dúvidas? + +- Abra uma [**Issue no GitHub**](https://github.com/AIS-Package/aisp/issues) From 2319aed08e078eaaeeee0282ab940bfb2c68376e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Paulo?= <88985821+Joao-Paulo-Silva@users.noreply.github.com> Date: Sun, 28 Dec 2025 12:19:49 -0300 Subject: [PATCH 4/5] docs: add FAQ in English --- docs/faq.md | 136 ++++++++++++++++++ .../current/faq.md | 6 +- 2 files changed, 139 insertions(+), 3 deletions(-) diff --git a/docs/faq.md b/docs/faq.md index e69de29b..759ea5ff 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -0,0 +1,136 @@ +--- +sidebar_position: 6 +title: Frequently Asked Questions +sidebar_label: FAQ +keywords: + - FAQ + - Frequently Asked Questions + - Questions + - Help +--- + +Quick solutions for possible questions about aisp. + +## General usage + +### Which algorithm should I choose? + +It depends on the type of problem: + +- **Anomaly detection**: Use ``RNSA`` or ``BNSA``. + - RNSA for problems with continuous data. + - BNSA for problems with binary data. +- **Classification**: Use ``AIRS``, ``RNSA``, or ``BNSA``. + - ``RNSA`` and ``BNSA`` were implemented to be applied to multiclass classification. + - ``AIRS`` is more robust to noise in the data. +- **Optimization**: Use ``Clonalg``. + - The implementation can be applied to objective function optimization (min/max). +- **Clustering**: Use ``AiNet``. + - Automatically separates data into groups. + - Does not require a predefined number of clusters. + +--- + +### How do I normalize my data to use the ``RNSA`` algorithm? + +RNSA works exclusively with data normalized in the range [0, 1]. Therefore, before applying it, the data must be normalized if they are not already in this range. A simple way to do this is by using normalization tools from **scikit-learn**, such as [``MinMaxScaler``](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.MinMaxScaler.html). + +#### Example + +In this example, ``X`` represents the non-normalized input data. + +```python +from sklearn.preprocessing import MinMaxScaler + +scaler = MinMaxScaler() + +x_norm = scaler.fit_transform(X) + +# Training the model with normalized data +rnsa = RNSA(N=100, r=0.1) +rnsa.fit(x_norm, y) +``` + +--- + +## Parameter configuration + +### How do I choose the number of detectors (``N``) in ``RNSA`` or ``BNSA``? + +The number of detectors directly affects performance: + +- A small number of detectors may not adequately cover the non-self space. +- A very large number of detectors may increase training time and can cause overfitting. + +**Recommendations**: + +- Test different values for the number of detectors until you find a suitable balance between training time and model performance. +- Use cross-validation to identify the value that consistently yields the best results. + +--- + +### Which radius (``r`` or ``aff_thresh``) should I use in ``BNSA`` or ``RNSA``? + +The detector radius depends on the data distribution: + +- A very small radius may fail to detect anomalies. +- A very large radius may overlap the self space and never generate valid detectors. + +--- + +### What is the ``r_s`` parameter in ``RNSA``? + +``r_s`` is the radius of the self sample. It defines a region around each training sample. + +--- + +### Clonalg: How do I define the objective function? + +The objective function must follow the pattern of the [base class](https://github.com/AIS-Package/aisp/blob/main/aisp/base/core/_optimizer.py#L140). It must receive a solution as input and return a cost (or affinity) value. + +```python +def affinity_function(self, solution: Any) -> float: + pass +``` + +There are two ways to define the objective function in Clonalg. + +1. Defining the function directly in the class constructor + +```python +def sphere(solution): + return np.sum(solution *- 2) + +clonalg = Clonalg( + problem_size=2, + affinity_function=sphere +) +``` + +2. Using the function registry + +```python +def sphere(solution): + return np.sum(solution *- 2) + +clonalg = Clonalg( + problem_size=2, +) + +clonalg.register("affinity_function", sphere) +``` + +## Additional information + +### Where can I find more examples? + +- **[Examples in the documentation](./examples/)**. +- **[Examples on GitHub](https://github.com/AIS-Package/aisp/tree/main/examples)** + +### How can I contribute to the project? + +See the [Contribution Guide](https://github.com/AIS-Package/aisp/blob/main/CONTRIBUTING.md) on GitHub. + +### Still have questions? + +- Open an [**Issue on GitHub**](https://github.com/AIS-Package/aisp/issues) diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/faq.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/faq.md index 84bb1e09..218569d7 100644 --- a/i18n/pt-br/docusaurus-plugin-content-docs/current/faq.md +++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/faq.md @@ -55,7 +55,7 @@ rnsa.fit(x_norm, y) ## Configuração de Parâmetros -### Como escolher o numero de detectores (N) no RNSA ou BNSA? +### Como escolher o numero de detectores (``N``) no ``RNSA`` ou ``BNSA``? O numero de detectores afeta diretamente a performance: @@ -69,7 +69,7 @@ O numero de detectores afeta diretamente a performance: --- -### Qual raio (``r`` ou ``aff_thresh``) devo utilizar no BNSA ou RNSA? +### Qual raio (``r`` ou ``aff_thresh``) devo utilizar no ``BNSA`` ou ``RNSA``? O raio dos detectores depende da distribuição dos dados: @@ -78,7 +78,7 @@ O raio dos detectores depende da distribuição dos dados: --- -### O que é o parâmetro ``r_s`` no RNSA? +### O que é o parâmetro ``r_s`` no ``RNSA``? O ``r_s`` é o raio da amostra self. Ele define uma região ao redor de cada amostra de treinamento. From 8197e389e510d0c74a9640a158bbd2845f829a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Paulo?= <88985821+Joao-Paulo-Silva@users.noreply.github.com> Date: Sun, 28 Dec 2025 12:23:06 -0300 Subject: [PATCH 5/5] docs: update documentation version --- .../version-0.5.x/faq.md | 136 ++++++++++++++++++ .../version-0.5.x/intro.md | 19 ++- package.json | 2 +- versioned_docs/version-0.5.x/faq.md | 136 ++++++++++++++++++ versioned_docs/version-0.5.x/intro.md | 20 ++- 5 files changed, 310 insertions(+), 3 deletions(-) create mode 100644 i18n/pt-br/docusaurus-plugin-content-docs/version-0.5.x/faq.md create mode 100644 versioned_docs/version-0.5.x/faq.md diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.5.x/faq.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.5.x/faq.md new file mode 100644 index 00000000..218569d7 --- /dev/null +++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.5.x/faq.md @@ -0,0 +1,136 @@ +--- +sidebar_position: 6 +title: Perguntas Frequentes +sidebar_label: FAQ +keywords: + - FAQ + - Perguntas Frequentes + - Dúvidas + - Ajuda +--- + +Soluções rápidas para possíveis duvidas sobre o aisp. + +## Uso geral + +### Qual algoritmo devo escolher? + +Depende do tipo de problema: + +- **Detecção de anomalias**: Use ``RNSA`` ou ``BNSA``. + - RNSA para problemas com dados contínuos. + - BNSA para problemas com dados binários. +- **Classificação**: Use ``AIRS``, ``RNSA`` ou ``BNSA``. + - O ``RNSA`` e ``BNSA``, foram implementados para serem aplicados a classificação multiclasse. + - O ``AIRS`` é mais robusto para ruídos nos dados. +- **Otimização**: Use ``Clonalg``. + - A implementação pode ser aplicada à otimização (min/max) de funções objetivas. +- **Clustering/Agrupamento**: Use ``AiNet``. + - Separa grupos de dados automaticamente. + - Não requer numero de grupos predefinidos. + +--- + +### Como normalizar meus dados para utilizar o algoritmo ``RNSA``? + +O RNSA trabalha exclusivamente com dados normalizados no intervalo entre [0, 1]. Portanto, antes de aplicá-lo, é necessário normalizar os dados se não estiver neste intervalo. Uma forma simples é fazer utilizando as ferramentas de normalização do **scikit-learn**, como o [``MinMaxScaler``](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.MinMaxScaler.html). + +#### Exemplo + +Neste exemplo, ``X`` representa os dados de entrada não normalizados. + +```python +from sklearn.preprocessing import MinMaxScaler + +scaler = MinMaxScaler() + +x_norm = scaler.fit_transform(X) + +# Treinando o modelo com os dados normalizados. +rnsa = RNSA(N=100, r=0.1) +rnsa.fit(x_norm, y) +``` + +--- + +## Configuração de Parâmetros + +### Como escolher o numero de detectores (``N``) no ``RNSA`` ou ``BNSA``? + +O numero de detectores afeta diretamente a performance: + +- Um número reduzido de detectores pode não cobrir adequadamente o espaço não-próprio. +- Um número muito alto de detectores pode aumentar o tempo de treinamento e pode causar overfitting. + +**Recomendações**: + +- Teste diferentes valores para o número de detectores até encontrar um equilíbrio adequado entre tempo de treinamento e desempenho do modelo. +- Utilize validação cruzada para identificar o valor que apresenta os melhores resultados de forma consistente. + +--- + +### Qual raio (``r`` ou ``aff_thresh``) devo utilizar no ``BNSA`` ou ``RNSA``? + +O raio dos detectores depende da distribuição dos dados: + +- Raio muito pequeno, podem não detectar anomalias. +- Raio muito grandes, podem sobrepor o self e nunca gerar detectores validos. + +--- + +### O que é o parâmetro ``r_s`` no ``RNSA``? + +O ``r_s`` é o raio da amostra self. Ele define uma região ao redor de cada amostra de treinamento. + +--- + +### Clonalg: Como definir a função objetivo? + +A função objetiva deve seguir o padrão da [classe base](https://github.com/AIS-Package/aisp/blob/main/aisp/base/core/_optimizer.py#L140), Ela deve receber uma solução como entrada e retornar um valor do custo (ou afinidade). + +```python +def affinity_function(self, solution: Any) -> float: + pass +``` + +Existem duas formas de definir a função objetivo no Clonalg. + +1. Definindo a função diretamente no construtor da classe + +```python +def sphere(solution): + return np.sum(solution ** 2) + +clonalg = Clonalg( + problem_size=2, + affinity_function=sphere +) +``` + +2. Utilizando o registrador de funções + +```python +def sphere(solution): + return np.sum(solution ** 2) + +clonalg = Clonalg( + problem_size=2, +) + +clonalg.register("affinity_function", sphere) +``` + +## Informações adicionais + +### Onde encontrar mais exemplos? + +- **[Exemplos na documentação](./examples/)**. +- **[Exemplos no github](https://github.com/AIS-Package/aisp/tree/main/examples)** + +### Como contribuir para o projeto? + +Veja o [Guia de Contribuição](https://github.com/AIS-Package/aisp/blob/main/CONTRIBUTING.md) no GitHub. + +### Ainda tem dúvidas? + +- Abra uma [**Issue no GitHub**](https://github.com/AIS-Package/aisp/issues) diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.5.x/intro.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.5.x/intro.md index faccfdbc..8c57a60a 100644 --- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.5.x/intro.md +++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.5.x/intro.md @@ -30,13 +30,30 @@ keywords: ![Pacote de Sistemas Imunológicos Artificiais](./assets/logo.svg) +
+
+ +[![GitHub stars](https://img.shields.io/github/stars/AIS-Package/aisp?style=social)](https://github.com/AIS-Package/aisp) +[![PyPI Downloads](https://static.pepy.tech/personalized-badge/aisp?period=total&units=INTERNATIONAL_SYSTEM&left_color=GRAY&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/aisp) +![License](https://img.shields.io/pypi/l/aisp) +![Python version](https://img.shields.io/pypi/pyversions/aisp) +
--- ## Introdução -**AISP** é um pacote Python de técnicas imunoinspiradas, as quais aplicam metáforas do sistema imunológico dos vertebrados ao reconhecimento de padrões e à tarefas de otimização. Concebido como um pacote de sistemas imunológicos artificiais de código aberto, o AISP é resultado de um projeto de pesquisa iniciado em **2022** no Instituto Federal do Norte de Minas Gerais - Campus Salinas (**IFNMG - Salinas**). Sua distribuição é regida pela GNU Lesser General Public License v3.0 (LGPLv3). +**AISP (Artificial Immune Systems Package)** é um pacote Python de técnicas imunoinspiradas, as quais aplicam metáforas do sistema imunológico dos vertebrados ao reconhecimento de padrões e à tarefas de otimização. Concebido como um pacote de sistemas imunológicos artificiais de código aberto, o AISP é resultado de um projeto de pesquisa iniciado em **2022** no Instituto Federal do Norte de Minas Gerais - Campus Salinas (**IFNMG - Salinas**). Sua distribuição é regida pela GNU Lesser General Public License v3.0 (LGPLv3). + +### O que voce pode fazer com o AISP? + +O AISP oferece implementações de algoritmos bio-inspirados para: + +- **Detecção de anomalias**: Identifique padrões anormais em dados. +- **Classificação**: Classifique dados com multi-classes. +- **Otimização**: Encontre soluções ótimas para funções objetivas. +- **Clustering**: Agrupe dados sem supervisão. ### Algoritmos implementados diff --git a/package.json b/package.json index 8824d4fc..9268bf8b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ais-package-github-io", - "version": "0.4.0", + "version": "0.5.0", "private": true, "scripts": { "docusaurus": "docusaurus", diff --git a/versioned_docs/version-0.5.x/faq.md b/versioned_docs/version-0.5.x/faq.md new file mode 100644 index 00000000..759ea5ff --- /dev/null +++ b/versioned_docs/version-0.5.x/faq.md @@ -0,0 +1,136 @@ +--- +sidebar_position: 6 +title: Frequently Asked Questions +sidebar_label: FAQ +keywords: + - FAQ + - Frequently Asked Questions + - Questions + - Help +--- + +Quick solutions for possible questions about aisp. + +## General usage + +### Which algorithm should I choose? + +It depends on the type of problem: + +- **Anomaly detection**: Use ``RNSA`` or ``BNSA``. + - RNSA for problems with continuous data. + - BNSA for problems with binary data. +- **Classification**: Use ``AIRS``, ``RNSA``, or ``BNSA``. + - ``RNSA`` and ``BNSA`` were implemented to be applied to multiclass classification. + - ``AIRS`` is more robust to noise in the data. +- **Optimization**: Use ``Clonalg``. + - The implementation can be applied to objective function optimization (min/max). +- **Clustering**: Use ``AiNet``. + - Automatically separates data into groups. + - Does not require a predefined number of clusters. + +--- + +### How do I normalize my data to use the ``RNSA`` algorithm? + +RNSA works exclusively with data normalized in the range [0, 1]. Therefore, before applying it, the data must be normalized if they are not already in this range. A simple way to do this is by using normalization tools from **scikit-learn**, such as [``MinMaxScaler``](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.MinMaxScaler.html). + +#### Example + +In this example, ``X`` represents the non-normalized input data. + +```python +from sklearn.preprocessing import MinMaxScaler + +scaler = MinMaxScaler() + +x_norm = scaler.fit_transform(X) + +# Training the model with normalized data +rnsa = RNSA(N=100, r=0.1) +rnsa.fit(x_norm, y) +``` + +--- + +## Parameter configuration + +### How do I choose the number of detectors (``N``) in ``RNSA`` or ``BNSA``? + +The number of detectors directly affects performance: + +- A small number of detectors may not adequately cover the non-self space. +- A very large number of detectors may increase training time and can cause overfitting. + +**Recommendations**: + +- Test different values for the number of detectors until you find a suitable balance between training time and model performance. +- Use cross-validation to identify the value that consistently yields the best results. + +--- + +### Which radius (``r`` or ``aff_thresh``) should I use in ``BNSA`` or ``RNSA``? + +The detector radius depends on the data distribution: + +- A very small radius may fail to detect anomalies. +- A very large radius may overlap the self space and never generate valid detectors. + +--- + +### What is the ``r_s`` parameter in ``RNSA``? + +``r_s`` is the radius of the self sample. It defines a region around each training sample. + +--- + +### Clonalg: How do I define the objective function? + +The objective function must follow the pattern of the [base class](https://github.com/AIS-Package/aisp/blob/main/aisp/base/core/_optimizer.py#L140). It must receive a solution as input and return a cost (or affinity) value. + +```python +def affinity_function(self, solution: Any) -> float: + pass +``` + +There are two ways to define the objective function in Clonalg. + +1. Defining the function directly in the class constructor + +```python +def sphere(solution): + return np.sum(solution *- 2) + +clonalg = Clonalg( + problem_size=2, + affinity_function=sphere +) +``` + +2. Using the function registry + +```python +def sphere(solution): + return np.sum(solution *- 2) + +clonalg = Clonalg( + problem_size=2, +) + +clonalg.register("affinity_function", sphere) +``` + +## Additional information + +### Where can I find more examples? + +- **[Examples in the documentation](./examples/)**. +- **[Examples on GitHub](https://github.com/AIS-Package/aisp/tree/main/examples)** + +### How can I contribute to the project? + +See the [Contribution Guide](https://github.com/AIS-Package/aisp/blob/main/CONTRIBUTING.md) on GitHub. + +### Still have questions? + +- Open an [**Issue on GitHub**](https://github.com/AIS-Package/aisp/issues) diff --git a/versioned_docs/version-0.5.x/intro.md b/versioned_docs/version-0.5.x/intro.md index 178a8f7d..e4bc38d6 100644 --- a/versioned_docs/version-0.5.x/intro.md +++ b/versioned_docs/version-0.5.x/intro.md @@ -28,11 +28,29 @@ keywords: +
+ +[![GitHub stars](https://img.shields.io/github/stars/AIS-Package/aisp?style=social)](https://github.com/AIS-Package/aisp) +[![PyPI Downloads](https://static.pepy.tech/personalized-badge/aisp?period=total&units=INTERNATIONAL_SYSTEM&left_color=GRAY&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/aisp) +![License](https://img.shields.io/pypi/l/aisp) +![Python version](https://img.shields.io/pypi/pyversions/aisp) + +
+ --- ## Introduction -**AISP** is a Python package of immunoinspired techniques that apply metaphors from the vertebrate immune system to pattern recognition and optimization tasks. Conceived as an open-source package of artificial immune systems, AISP emerged from a research project initiated in **2022** at the Instituto Federal do Norte de Minas Gerais - Campus Salinas (**IFNMG - Salinas**). Its distribution is governed by the GNU Lesser General Public License v3.0 (LGPLv3). +**AISP (Artificial Immune Systems Package)** is a Python package of immunoinspired techniques that apply metaphors from the vertebrate immune system to pattern recognition and optimization tasks. Conceived as an open-source package of artificial immune systems, AISP emerged from a research project initiated in **2022** at the Instituto Federal do Norte de Minas Gerais - Campus Salinas (**IFNMG - Salinas**). Its distribution is governed by the GNU Lesser General Public License v3.0 (LGPLv3). + +### What can you do with AISP? + +AISP provides implementations of bio-inspired algorithms for: + +- **Anomaly detection**: Identify abnormal patterns in data. +- **Classification**: Classify data with multiple classes. +- **Optmization**: Find optimal solutions for objective functions. +- **Clustering**: Group data without supervision. ### Algorithms implemented