diff --git a/docs/about-us.mdx b/docs/about-us.mdx
index 81059da4..0d837149 100644
--- a/docs/about-us.mdx
+++ b/docs/about-us.mdx
@@ -28,7 +28,7 @@ The AISP, or Artificial Immune Systems Package, had its origins in a research pr
name='Alison Zille Lopes'
date='2022'
githubUrl='https://github.com/alisonzille'
- lattesUrl='http://lattes.cnpq.br/3294097090760981'
+ lattesUrl='https://lattes.cnpq.br/3294097090760981'
/>
@@ -44,7 +44,7 @@ The AISP, or Artificial Immune Systems Package, had its origins in a research pr
date='2022-2023'
description="I was tasked with implementing version 0.1, which features the BNSA and RNSA negative selection classes, including fixed and variable radius versions."
githubUrl='https://github.com/Joao-Paulo-Silva'
- lattesUrl='http://lattes.cnpq.br/2561057724411407'
+ lattesUrl='https://lattes.cnpq.br/2561057724411407'
/>
\ No newline at end of file
diff --git a/docs/advanced-guides/Core/negative-selection.md b/docs/advanced-guides/Core/negative-selection.md
index e5b80d60..a85f9771 100644
--- a/docs/advanced-guides/Core/negative-selection.md
+++ b/docs/advanced-guides/Core/negative-selection.md
@@ -8,7 +8,7 @@ last_update:
The functions perform detector checks and utilize Numba decorators for Just-In-Time compilation
-### Function check_detector_bnsa_validity(...):
+## Function check_detector_bnsa_validity(...)
```python
def check_detector_bnsa_validity(
@@ -20,18 +20,19 @@ def check_detector_bnsa_validity(
Checks the validity of a candidate detector (vector_x) against samples from a class (x_class) using the Hamming distance. A detector is considered INVALID if its distance to any sample in ``x_class`` is less than or equal to ``aff_thresh``.
-
**Parameters**:
+
* x_class (``npt.NDArray``): Array containing the class samples. Expected shape: (n_samples, n_features).
* vector_x (``npt.NDArray``): Array representing the detector. Expected shape: (n_features,).
* aff_thresh (``float``): Affinity threshold.
**returns**:
+
* True if the detector is valid, False otherwise.
---
-### Function bnsa_class_prediction(...):
+## Function bnsa_class_prediction(...)
```python
def bnsa_class_prediction(
@@ -40,21 +41,23 @@ def bnsa_class_prediction(
aff_thresh: float
) -> int:
```
-Defines the class of a sample from the non-self detectors.
+Defines the class of a sample from the non-self detectors.
**Parameters**:
+
* features (``npt.NDArray``): binary sample to be classified (shape: [n_features]).
* class_detectors (``npt.NDArray``): Array containing the detectors of all classes
(shape: [n_classes, n_detectors, n_features]).
* aff_thresh (``float``): Affinity threshold that determines whether a detector recognizes the sample as non-self.
**returns**:
+
* int: Index of the predicted class. Returns -1 if it is non-self for all classes.
---
-### Function check_detector_rnsa_validity(...):
+## Function check_detector_rnsa_validity(...)
```python
def check_detector_rnsa_validity(
@@ -65,9 +68,11 @@ def check_detector_rnsa_validity(
p: float
) -> bool:
```
+
Checks the validity of a candidate detector (vector_x) against samples from a class (x_class) using the Hamming distance. A detector is considered INVALID if its distance to any sample in ``x_class`` is less than or equal to ``aff_thresh``.
**Parameters**:
+
* x_class (``npt.NDArray``): Array containing the class samples. Expected shape: (n_samples, n_features).
* vector_x (``npt.NDArray``): Array representing the detector. Expected shape: (n_features,).
* threshold (``float``): threshold.
@@ -75,6 +80,7 @@ Checks the validity of a candidate detector (vector_x) against samples from a cl
* p (``float``): Parameter for the Minkowski distance (used only if `metric` is "minkowski").
**returns**:
+
* int: Index of the predicted class. Returns -1 if it is non-self for all classes.
----
\ No newline at end of file
+---
diff --git a/docs/advanced-guides/Utils/Display.md b/docs/advanced-guides/Utils/Display.md
index df7dfba6..51c3bbdb 100644
--- a/docs/advanced-guides/Utils/Display.md
+++ b/docs/advanced-guides/Utils/Display.md
@@ -149,4 +149,4 @@ def finish(self) -> None
End the table display, printing the bottom border and total time.
----
\ No newline at end of file
+---
diff --git a/docs/advanced-guides/Utils/Distance.md b/docs/advanced-guides/Utils/Distance.md
index f3d61352..31981a44 100644
--- a/docs/advanced-guides/Utils/Distance.md
+++ b/docs/advanced-guides/Utils/Distance.md
@@ -15,15 +15,16 @@ def hamming(u: npt.NDArray, v: npt.NDArray) -> np.float64:
```
The function to calculate the normalized Hamming distance between two points.
-
-$((x₁ ≠ x₂) + (y₁ ≠ y₂) + ... + (yn ≠ yn)) / n$
+$$\frac{(x_1 \neq y_1) + (x_2 \neq y_2) + \cdots + (x_n \neq y_n)}{n}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -36,15 +37,15 @@ def euclidean(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64]) -> np.floa
Function to calculate the normalized Euclidean distance between two points.
-$√( (x₁ - x₂)² + (y₁ - y₂)² + ... + (yn - yn)²)$
-
-
+$$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -56,15 +57,16 @@ def cityblock(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64]) -> np.floa
```
Function to calculate the normalized Manhattan distance between two points.
-
-$(|x₁ - x₂| + |y₁ - y₂| + ... + |yn - yn|) / n$
+$$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -76,19 +78,20 @@ def minkowski(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64], p: float =
```
Function to calculate the normalized Minkowski distance between two points.
-
-$(( |X₁ - Y₁|p + |X₂ - Y₂|p + ... + |Xn - Yn|p) ¹/ₚ) / n$
+$$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
* p float: The p parameter defines the type of distance to be calculated:
- - p = 1: **Manhattan** distance — sum of absolute differences.
- - p = 2: **Euclidean** distance — sum of squared differences (square root).
- - p > 2: **Minkowski** distance with an increasing penalty as p increases.
+ * p = 1: **Manhattan** distance — sum of absolute differences.
+ * p = 2: **Euclidean** distance — sum of squared differences (square root).
+ * p > 2: **Minkowski** distance with an increasing penalty as p increases.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -107,12 +110,14 @@ def compute_metric_distance(
Function to calculate the distance between two points by the chosen ``metric``.
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
* metric (``int``): Distance metric to be used. Available options: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)]
* p (``float``): Parameter for the Minkowski distance (used only if `metric` is "minkowski").
**Returns:**
+
* Distance (``double``) between the two points with the selected metric.
---
@@ -130,14 +135,15 @@ def min_distance_to_class_vectors(
Calculates the minimum distance between an input vector and the vectors of a class.
-
**Parameters:**
+
* x_class (``npt.NDArray``): Array containing the class vectors to be compared with the input vector. Expected shape: (n_samples, n_features).
* vector_x (``npt.NDArray``): Vector to be compared with the class vectors. Expected shape: (n_features,).
* metric (``int``): Distance metric to be used. Available options: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)]
* p (``float``): Parameter for the Minkowski distance (used only if `metric` is "minkowski").
**Returns:**
+
* float: The minimum distance calculated between the input vector and the class vectors.
* Returns -1.0 if the input dimensions are incompatible.
@@ -148,16 +154,19 @@ Calculates the minimum distance between an input vector and the vectors of a cla
```python
def get_metric_code(metric: str) -> int:
```
+
Returns the numeric code associated with a distance metric.
**Parameters:**
+
* metric (str): Name of the metric. Can be "euclidean", "manhattan", "minkowski" or "hamming".
**Raises**
-----------
+
* ``ValueError``: If the metric provided is not supported
**Returns:**
+
* ``int``: Numeric code corresponding to the metric.
----
\ No newline at end of file
+---
diff --git a/docs/advanced-guides/Utils/Metrics.md b/docs/advanced-guides/Utils/Metrics.md
index c92962b2..d65da92c 100644
--- a/docs/advanced-guides/Utils/Metrics.md
+++ b/docs/advanced-guides/Utils/Metrics.md
@@ -21,16 +21,19 @@ Function to calculate precision accuracy based on lists of true labels and
predicted labels.
**Parameters**:
+
* **_y_true_** (``Union[npt.NDArray, list]``): Ground truth (correct) labels.
Expected to be of the same length as `y_pred`.
* **_y_pred_** (``Union[npt.NDArray, list]``): Predicted labels. Expected to
be of the same length as `y_true`.
Returns:
+
* **_Accuracy_** (``float``): The ratio of correct predictions to the total
number of predictions.
**Raises**:
+
* `ValueError`: If `y_true` or `y_pred` are empty or if they do not have the same length.
----
\ No newline at end of file
+---
diff --git a/docs/advanced-guides/Utils/Multiclass.md b/docs/advanced-guides/Utils/Multiclass.md
index 772e2373..83c58b1d 100644
--- a/docs/advanced-guides/Utils/Multiclass.md
+++ b/docs/advanced-guides/Utils/Multiclass.md
@@ -19,8 +19,10 @@ according to the output class, to loop through the sample array, only in positio
the output is the class being trained.
**Parameters**:
+
* ***classes*** (``list or npt.NDArray``): list with unique classes.
* ***y*** (npt.NDArray): Receives a ``y``[``N sample``] array with the output classes of the ``X`` sample array.
**returns**:
+
* dict: A dictionary with the list of array positions(``y``), with the classes as key.
diff --git a/docs/advanced-guides/Utils/Sanitizers.md b/docs/advanced-guides/Utils/Sanitizers.md
index a7d113cd..b57a8053 100644
--- a/docs/advanced-guides/Utils/Sanitizers.md
+++ b/docs/advanced-guides/Utils/Sanitizers.md
@@ -14,14 +14,14 @@ def sanitize_choice(value: T, valid_choices: Iterable[T], default: T) -> T
The function ``sanitize_choice(...)``, returns the value if it is present in the set of valid choices; otherwise, returns the default value.
-
**Parameters:**
+
* ***value*** (``T``): The value to be checked.
* ***valid_choices*** (``Iterable[T]``): A collection of valid choices.
* ***default***: The default value to be returned if ``value`` is not in ``valid_choices``.
-
**Returns:**
+
* `T`: The original value if valid, or the default value if not.
---
@@ -35,12 +35,13 @@ def sanitize_param(value: T, default: T, condition: Callable[[T], bool]) -> T:
The function ``sanitize_param(...)``, returns the value if it satisfies the specified condition; otherwise, returns the default value.
**Parameters:**
+
* value (``T``): The value to be checked.
* default (``T``): The default value to be returned if the condition is not satisfied.
* condition (``Callable[[T], bool]``): A function that takes a value and returns a boolean, determining if the value is valid.
-
**Returns:**
+
* `T`: The original value if the condition is satisfied, or the default value if not.
---
@@ -54,9 +55,11 @@ def sanitize_seed(seed: Any) -> Optional[int]:
The function ``sanitize_param(...)``, returns the seed if it is a non-negative integer; otherwise, returns None.
**Parameters:**
+
* seed (``Any``): The seed value to be validated.
**Returns:**
+
* ``Optional[int]``: The original seed if it is a non-negative integer, or ``None`` if it is invalid.
---
@@ -73,10 +76,10 @@ def sanitize_bounds(
The function ``sanitize_bounds(...)``, validate and normalize feature bounds.
**Parameters:**
+
* ***bounds*** (``Any``): he input bounds, which must be either None or a dictionary with 'low' and 'high' keys.
* ***problem_size*** (``int``): The expected length for the normalized bounds lists, corresponding to the number of features in the problem.
-
**Returns:**
-* `Dict[str, list]`: Dictionary ``{'low': [low_1, ..., low_N], 'high': [high_1, ..., high_N]}``.
+* `Dict[str, list]`: Dictionary ``{'low': [low_1, ..., low_N], 'high': [high_1, ..., high_N]}``.
diff --git a/docs/advanced-guides/Utils/Validation.md b/docs/advanced-guides/Utils/Validation.md
index c0e4e944..fdbcb573 100644
--- a/docs/advanced-guides/Utils/Validation.md
+++ b/docs/advanced-guides/Utils/Validation.md
@@ -21,7 +21,9 @@ This function analyzes the input vector and classifies its data as one of the su
* `vector` (`npt.NDArray`): An array containing the data to be classified.
**Returns**
+
* `FeatureType` (`Literal["binary-features", "continuous-features", "ranged-features"]`): The detected type of data in the vector.
**Raises**
-* `UnsupportedDataTypeError`: Raised if the vector contains an unsupported data type.
\ No newline at end of file
+
+* `UnsupportedDataTypeError`: Raised if the vector contains an unsupported data type.
diff --git a/docs/advanced-guides/base-classes-reference/csa/airs.md b/docs/advanced-guides/base-classes-reference/csa/airs.md
index 6bb93a08..9b48c5d6 100644
--- a/docs/advanced-guides/base-classes-reference/csa/airs.md
+++ b/docs/advanced-guides/base-classes-reference/csa/airs.md
@@ -26,7 +26,7 @@ therefore are considered essential for the overall functioning of the system.
---
-### def _check_and_raise_exceptions_fit(...):
+### def _check_and_raise_exceptions_fit(...)
Verify the fit parameters and throw exceptions if the verification is not successful.
@@ -41,22 +41,23 @@ def _check_and_raise_exceptions_fit(
):
```
-
**Parameters**:
-* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, [``N samples`` (rows)][``N features`` (columns)].
-* ***y*** (``npt.NDArray``): Array of target classes of ``X`` with [``N samples`` (lines)].
-* ***algorithm*** (``Literal["continuous-features", "binary-features"], optional``): Specifies the type of algorithm to use, depending
+
+* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, \[``N samples`` (rows)\]\[``N features`` (columns)\].
+* ***y*** (``npt.NDArray``): Array of target classes of ``X`` with \[``N samples`` (lines)].
+* ***algorithm*** (``Literal["continuous-features", "binary-features"], optional``): Specifies the type of algorithm to use, depending
on whether the input data has continuous or binary features.
**Raises**
+
* `TypeError`:
If X or y are not ndarrays or have incompatible shapes.
* `ValueError`
- If _class_ is BNSA and X contains values that are not composed only of 0 and 1.
+ If *class* is BNSA and X contains values that are not composed only of 0 and 1.
---
-### def _check_and_raise_exceptions_fit(...):
+### def _check_and_raise_exceptions_predict(...)
Verify the fit parameters and throw exceptions if the verification is not successful.
@@ -71,18 +72,20 @@ def _check_and_raise_exceptions_predict(
) -> None:
```
-
**Parameters**:
-* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, [``N samples`` rows)][``N features`` (columns)].
+
+* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, \[``N samples`` (rows)\]\[``N features`` (columns)].
* ***expected*** (``int``): Expected number of features per sample (columns in X).
-* ***algorithm*** (``Literal["continuous-features", "binary-features"], optional``): Specifies the type of algorithm to use, depending
+* ***algorithm*** (``Literal["continuous-features", "binary-features"], optional``): Specifies the type of algorithm to use, depending
on whether the input data has continuous or binary features.
**Raises**
+
* ``TypeError``
If X is not a ndarray or list.
* `FeatureDimensionMismatch`
If the number of features in X does not match the expected number.
* `ValueError`
If algorithm is binary-features and X contains values that are not composed only of 0 and 1.
----
\ No newline at end of file
+
+---
diff --git a/docs/advanced-guides/base-classes-reference/ina/ainet.md b/docs/advanced-guides/base-classes-reference/ina/ainet.md
index 201d6c3b..7a21c8b5 100644
--- a/docs/advanced-guides/base-classes-reference/ina/ainet.md
+++ b/docs/advanced-guides/base-classes-reference/ina/ainet.md
@@ -33,7 +33,7 @@ def _check_and_raise_exceptions_fit(X: npt.NDArray)
**Parameters**:
-* ***X*** (`npt.NDArray`): Training array, containing the samples and their characteristics, \[`N samples` (rows)]\[`N features` (columns)].
+* ***X*** (`npt.NDArray`): Training array, containing the samples and their characteristics, \\[`N samples` (rows)]\\[`N features` (columns)].
**Raises**:
@@ -56,7 +56,7 @@ def _check_and_raise_exceptions_predict(
**Parameters**:
-* ***X*** (`npt.NDArray`): Input array for prediction, containing the samples and their characteristics, \[`N samples` (rows)]\[`N features` (columns)].
+* ***X*** (`npt.NDArray`): Input array for prediction, containing the samples and their characteristics, \\[`N samples` (rows)]\\[`N features` (columns)].
* ***expected*** (`int`, default=0): Expected number of features per sample (columns in X).
* ***feature_type*** (`FeatureType`, default="continuous-features"): Specifies the type of features: "continuous-features", "binary-features", or "ranged-features".
diff --git a/docs/advanced-guides/base-classes-reference/nsa.md b/docs/advanced-guides/base-classes-reference/nsa.md
index 3317e175..021c4575 100644
--- a/docs/advanced-guides/base-classes-reference/nsa.md
+++ b/docs/advanced-guides/base-classes-reference/nsa.md
@@ -23,11 +23,12 @@ keywords:
The ``BaseNSA`` class contains utility functions with the ``protected`` modifier that can be inherited by various classes for ease of use. It includes functions for distance calculation, data separation to improve training and prediction efficiency, accuracy measurement and other functions.
-### Protected Functions:
+### Protected Functions
---
-#### Function _check_and_raise_exceptions_fit(...):
+#### Function _check_and_raise_exceptions_fit(...)
+
```python
def _check_and_raise_exceptions_fit(
X: npt.NDArray = None,
@@ -35,20 +36,24 @@ def _check_and_raise_exceptions_fit(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Function responsible for verifying fit function parameters and throwing exceptions if the verification is not successful.
**Parameters**:
-* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, [``N samples`` (rows)][``N features`` (columns)].
-* ***y*** (``npt.NDArray``): Array of target classes of ``X`` with [``N samples`` (lines)].
-* ***_class_*** (Literal[RNSA, BNSA], optional): Current class. Defaults to 'RNSA'.
+
+* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, \[``N samples`` (rows)\]\[``N features`` (columns)].
+* ***y*** (``npt.NDArray``): Array of target classes of ``X`` with \[``N samples`` (lines)].
+* ****class**** (Literal[RNSA, BNSA], optional): Current class. Defaults to 'RNSA'.
**Raises**
+
* ``TypeError``: If X or y are not ndarrays or have incompatible shapes.
-* ``ValueError``: If _class_ is BNSA and X contains values that are not composed only of 0 and 1.
+* ``ValueError``: If *class* is BNSA and X contains values that are not composed only of 0 and 1.
---
-#### Function _check_and_raise_exceptions_predict(...):
+#### Function _check_and_raise_exceptions_predict(...)
+
```python
def _check_and_raise_exceptions_predict(
X: npt.NDArray = None,
@@ -56,17 +61,20 @@ def _check_and_raise_exceptions_predict(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Function responsible for verifying predict function parameters and throwing exceptions if the verification is not successful.
**Parameters**:
-* ***X*** (``npt.NDArray``): Input array for prediction, containing the samples and their characteristics, [``N samples`` (rows)][``N features`` (columns)].
+
+* ***X*** (``npt.NDArray``): Input array for prediction, containing the samples and their characteristics, \[``N samples`` (rows)\]\[``N features`` (columns)].
* ***expected*** (``int``): Expected number of features per sample (columns in X).
-* _class_ (``Literal[RNSA, BNSA], optional``): Current class. Defaults to 'RNSA'.
+* *class* (``Literal[RNSA, BNSA], optional``): Current class. Defaults to 'RNSA'.
**Raises**
+
* ``TypeError``: If X is not an ndarray or list.
* ``FeatureDimensionMismatch``: If the number of features in X does not match the expected number.
-* ``ValueError``: If _class_ is BNSA and X contains values that are not composed only of 0 and 1.
+* ``ValueError``: If *class* is BNSA and X contains values that are not composed only of 0 and 1.
---
@@ -77,4 +85,4 @@ Represents a non-self detector of the RNSA class.
**Attributes:**
* ***position*** (``np.ndarray``): Detector feature vector.
-* ***radius*** (``float, optional``): Detector radius, used in the V-detector algorithm.
\ No newline at end of file
+* ***radius*** (``float, optional``): Detector radius, used in the V-detector algorithm.
diff --git a/docs/advanced-guides/base-module/Classifier.md b/docs/advanced-guides/base-module/Classifier.md
index 9b1e1ada..697cd21b 100644
--- a/docs/advanced-guides/base-module/Classifier.md
+++ b/docs/advanced-guides/base-module/Classifier.md
@@ -21,13 +21,12 @@ keywords:
- BNSA
---
-## ``class BaseClassifier(ABC, Base)``:
+## ``class BaseClassifier(ABC, Base)``
Base class for classification algorithms, defining the abstract methods ``fit`` and ``predict``, and implementing the ``get_params`` method.
## Abstract methods
-
### def fit(...)
```python
@@ -38,11 +37,9 @@ Fit the model to the training data.
Implementation:
-- [RNSA](/docs/aisp-techniques/negative-selection/rnsa#Function-fit)
-- [BNSA](/docs/aisp-techniques/negative-selection/bnsa#Function-fit)
-- [AIRS](/docs/aisp-techniques/clonal-selection-algorithms/airs/#Function-fit)
-
-
+- [RNSA](../../aisp-techniques/negative-selection/RNSA.md#Function-fit)
+- [BNSA](../../aisp-techniques/negative-selection/BNSA.md#Function-fit)
+- [AIRS](../../aisp-techniques/clonal-selection-algorithms/airs/#Function-fit)
### def predict(...)
@@ -54,35 +51,35 @@ Performs label prediction for the given data.
Implementation:
-- [RNSA](/docs/aisp-techniques/negative-selection/rnsa#Function-predict)
-- [BNSA](/docs/aisp-techniques/negative-selection/bnsa#Function-predict)
-- [AIRS](/docs/aisp-techniques/clonal-selection-algorithms/airs/#Function-predict)
+- [RNSA](../../aisp-techniques/negative-selection/RNSA.md#Function-predict)
+- [BNSA](../../aisp-techniques/negative-selection/BNSA.md#Function-predict)
+- [AIRS](../../aisp-techniques/clonal-selection-algorithms/airs/#Function-predict)
---
## Methods
-
### def score(...)
```python
def score(self, X: npt.NDArray, y: list) -> float
```
+
Score function calculates forecast accuracy.
-This function performs the prediction of X and checks how many elements are equal between vector y and y_predicted.
+This function performs the prediction of X and checks how many elements are equal between vector y and y_predicted.
This function was added for compatibility with some scikit-learn functions.
**Parameters**:
-+ ***X***: ``np.ndarray``
+
+- ***X***: ``np.ndarray``
Feature set with shape (n_samples, n_features).
-+ ***y***: ``np.ndarray``
+- ***y***: ``np.ndarray``
True values with shape (n_samples,).
**Returns**:
-+ accuracy: ``float`` The accuracy of the model.
-
+- accuracy: ``float`` The accuracy of the model.
### Function _slice_index_list_by_class(...)
@@ -93,4 +90,3 @@ def __slice_index_list_by_class(self, y: npt.NDArray) -> dict:
```
Returns a dictionary with the classes as key and the indices in ``X`` of the samples.
-
diff --git a/docs/advanced-guides/base-module/Clusterer.md b/docs/advanced-guides/base-module/Clusterer.md
index 68487813..565b9c96 100644
--- a/docs/advanced-guides/base-module/Clusterer.md
+++ b/docs/advanced-guides/base-module/Clusterer.md
@@ -52,7 +52,7 @@ This abstract method must be implemented by subclasses.
**Implementation**:
-* [AiNet](/docs/aisp-techniques/immune-network-theory/ainet#Function-fit)
+* [AiNet](../../aisp-techniques/immune-network-theory/AiNet.md#Function-fit)
---
@@ -77,7 +77,7 @@ This abstract method must be implemented by subclasses.
**Implementation**:
-* [AiNet](/docs/aisp-techniques/immune-network-theory/ainet#Function-predict)
+* [AiNet](../../aisp-techniques/immune-network-theory/AiNet.md#Function-predict)
---
diff --git a/docs/advanced-guides/base-module/Mutation.md b/docs/advanced-guides/base-module/Mutation.md
index a280bfbc..f7d906db 100644
--- a/docs/advanced-guides/base-module/Mutation.md
+++ b/docs/advanced-guides/base-module/Mutation.md
@@ -17,8 +17,6 @@ keywords:
- Vector Mutation
---
-# Mutation
-
Contains functions that generate sets of mutated clones from continuous or binary vectors, simulating the clonal expansion process in artificial immune systems.
## clone_and_mutate_continuous
@@ -122,4 +120,3 @@ This function creates `n` clones of the input permutation vector and applies ran
### Returns
* `clone_set` (`npt.NDArray[np.int64]`): Array with shape `(n, len(vector))` containing the `n` mutated clones of the original vector.
-
diff --git a/docs/advanced-guides/base-module/Optimizer.md b/docs/advanced-guides/base-module/Optimizer.md
index 568e8bb3..3e0d99cf 100644
--- a/docs/advanced-guides/base-module/Optimizer.md
+++ b/docs/advanced-guides/base-module/Optimizer.md
@@ -83,7 +83,8 @@ def _record_best(self, cost: float, best_solution: Any) -> None
Record a new cost value and update the best solution if improved.
**Parameters**:
- * ***cost***: `float` - Cost value to be added to the history.
+
+* ***cost***: `float` - Cost value to be added to the history.
---
@@ -97,7 +98,8 @@ Generate a formatted summary report of the optimization process. The report incl
its associated cost, and the evolution of cost values per iteration.
**Returns**:
- * **report**: `str` - A formatted string containing the optimization summary.
+
+* **report**: `str` - A formatted string containing the optimization summary.
---
@@ -110,12 +112,14 @@ def register(self, alias: str, function: Callable[..., Any]) -> None
Register a function dynamically in the optimizer instance.
**Parameters**:
- * ***alias***: `str` - Name used to access the function as an attribute.
- * ***function***: `Callable[..., Any]` - Callable to be registered.
+
+* ***alias***: `str` - Name used to access the function as an attribute.
+* ***function***: `Callable[..., Any]` - Callable to be registered.
**Raises**:
- * **TypeError**: If `function` is not callable.
- * **AttributeError**: If `alias` is protected and cannot be modified, or if `alias` does not exist in the
+
+* **TypeError**: If `function` is not callable.
+* **AttributeError**: If `alias` is protected and cannot be modified, or if `alias` does not exist in the
optimizer class.
---
@@ -141,13 +145,14 @@ def optimize(self, max_iters: int = 50, n_iter_no_change=10, verbose: bool = Tru
Execute the optimization process. This method must be implemented by the subclass to define how the optimization strategy explores the search space.
**Parameters**:
- * ***max_iters***: `int` - Maximum number of iterations.
- * ***n_iter_no_change***: `int`, default=10 - The maximum number of iterations without updating the best solution.
- * ***verbose***: `bool`, default=True - Flag to enable or disable detailed output during optimization.
+
+* ***max_iters***: `int` - Maximum number of iterations.
+* ***n_iter_no_change***: `int`, default=10 - The maximum number of iterations without updating the best solution.
+* ***verbose***: `bool`, default=True - Flag to enable or disable detailed output during optimization.
**Implementation**:
-* [Clonalg](/docs/aisp-techniques/clonal-selection-algorithms/clonalg#Function-optimize)
+* [Clonalg](../../aisp-techniques/clonal-selection-algorithms/clonalg.md#Function-optimize)
---
@@ -160,7 +165,9 @@ def affinity_function(self, solution: Any) -> float
Evaluate the affinity of a candidate solution. This method must be implemented by the subclass to define the problem-specific.
**Parameters**:
- * ***solution***: `Any` - Candidate solution to be evaluated.
+
+* ***solution***: `Any` - Candidate solution to be evaluated.
**Returns**:
- * **cost**: `float` - Cost value associated with the given solution.
+
+* **cost**: `float` - Cost value associated with the given solution.
diff --git a/docs/aisp-techniques/clonal-selection-algorithms/Cell.md b/docs/aisp-techniques/clonal-selection-algorithms/Cell.md
index 9b474ef2..8992d823 100644
--- a/docs/aisp-techniques/clonal-selection-algorithms/Cell.md
+++ b/docs/aisp-techniques/clonal-selection-algorithms/Cell.md
@@ -17,20 +17,20 @@ lastUpdatedAt: 2025/05/25
author: João Paulo
---
-# Célula-B de memória
-
Representa uma célula-B de memória.
-### Constructor:
+### Constructor
Parameters:
+
* **vector** (``Optional[npt.NDArray]``): A feature vector of the cell. Defaults to None.
---
-### Function hyper_clonal_mutate(...):
+### Function hyper_clonal_mutate(...)
Parameters:
+
* **n** (``int``): The number of clones to be generated from mutations in the original cell.
* **feature_type** (``Literal["continuous-features", "binary-features", "ranged-features"]``): Specifies the type of
algorithm to use based on the nature of the input features
@@ -49,4 +49,4 @@ def hyper_clonal_mutate(
) -> npt.NDArray
```
-Returns an array containing N mutated vectors from the original cell.
\ No newline at end of file
+Returns an array containing N mutated vectors from the original cell.
diff --git a/docs/aisp-techniques/clonal-selection-algorithms/airs/README.md b/docs/aisp-techniques/clonal-selection-algorithms/airs/README.md
index 012ac7ab..ec591bfb 100644
--- a/docs/aisp-techniques/clonal-selection-algorithms/airs/README.md
+++ b/docs/aisp-techniques/clonal-selection-algorithms/airs/README.md
@@ -14,7 +14,7 @@ author: João Paulo
# AIRS - Artificial Immune Recognition System
-The ``AIRS`` class aims to perform classification using metaphors of selection and clonal expansion.
+The ``AIRS`` class aims to perform classification using metaphors of selection and clonal expansion.
This implementation is inspired by AIRS2, a simplified version of the original AIRS algorithm.
Introducing adaptations to handle continuous and binary datasets.
@@ -33,36 +33,37 @@ Based on Algorithm 16.5 from Brabazon et al. [1](#1).
:::
-## AIRS Constructor:
-
+## AIRS Constructor
**Attributes:**
-* **n_resources** (``float``): Total amount of available resources. Defaults to 10.
-* **rate_clonal** (``float``): Maximum number of possible clones of a class. This quantity is multiplied by (cell stimulus * rate_hypermutation) to define the number of clones. Defaults to 10.
-* **rate_hypermutation** (``int``): The rate of mutated clones derived from rate_clonal as a scalar factor. Defaults to 0.75.
-* **affinity_threshold_scalar** (``float``): Normalized affinity threshold. Defaults to 0.75.
-* **k** (``int``): The number of K nearest neighbors that will be used to choose a label in the prediction. Defaults to 10.
-* **max_iters** (``int``): Maximum number of interactions in the refinement process of the ARB set exposed to aᵢ. Defaults to 100.
-* **resource_amplified** (``float``): Resource consumption amplifier is multiplied with the incentive to subtract resources. Defaults to 1.0 without amplification.
-* **metric** (Literal["manhattan", "minkowski", "euclidean"]): Way to calculate the distance between the detector and the sample:
- * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression:
- $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + ... + (Y_{n} - Y_{n})^2}$$
- * ``'minkowski'`` ➜ The calculation of the distance is given by the expression:
- $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + ... |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - X_{1}| + |Y_{2} - Y_{2}| + ... + |Y_{n} - Y_{n}|)$$.
+
+- **n_resources** (``float``): Total amount of available resources. Defaults to 10.
+- **rate_clonal** (``float``): Maximum number of possible clones of a class. This quantity is multiplied by (cell stimulus * rate_hypermutation) to define the number of clones. Defaults to 10.
+- **rate_hypermutation** (``int``): The rate of mutated clones derived from rate_clonal as a scalar factor. Defaults to 0.75.
+- **affinity_threshold_scalar** (``float``): Normalized affinity threshold. Defaults to 0.75.
+- **k** (``int``): The number of K nearest neighbors that will be used to choose a label in the prediction. Defaults to 10.
+- **max_iters** (``int``): Maximum number of interactions in the refinement process of the ARB set exposed to aᵢ. Defaults to 100.
+- **resource_amplified** (``float``): Resource consumption amplifier is multiplied with the incentive to subtract resources. Defaults to 1.0 without amplification.
+- **metric** (Literal["manhattan", "minkowski", "euclidean"]): Way to calculate the distance between the detector and the sample:
+ - ``'Euclidean'`` ➜ The calculation of the distance is given by the expression:
+ $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$
+ - ``'minkowski'`` ➜ The calculation of the distance is given by the expression:
+ $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
+ - ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$.
Defaults to **"Euclidean"**.
-* **seed** (``Optional[int]``): Seed for the random generation of detector values. Defaults to None.
+- **seed** (``Optional[int]``): Seed for the random generation of detector values. Defaults to None.
- ``**kwargs``:
- - **p** (``float``): This parameter stores the value of ``p`` used in the Minkowski distance.
+ - **p** (``float``): This parameter stores the value of ``p`` used in the Minkowski distance.
The default is ``2``, which means normalized Euclidean distance. Different values of p lead to different variants of the Minkowski distance. [Learn more](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
**Other initialized variables:**
-* **cells_memory** (``dict``): This variable stores a list of memory cells by class.
-* **affinity_threshold** (``dict``): Defines the affinity threshold between antigens.
-* **classes** (``npt.NDArray``): List of output classes.
+
+- **cells_memory** (``dict``): This variable stores a list of memory cells by class.
+- **affinity_threshold** (``dict``): Defines the affinity threshold between antigens.
+- **classes** (``npt.NDArray``): List of output classes.
---
@@ -75,12 +76,14 @@ The ``fit(...)`` function generates detectors for the non-owners relative to the
```python
def fit(self, X: npt.NDArray, y: npt.NDArray):
```
+
It performs the training according to ``X`` and ``y``, using the method Artificial Immune Recognition System (``AIRS``).
**Input parameters:**
-* **X**: Array with sample features, with **N** samples (rows) and **N** features (columns), normalized to values between [0, 1].
-* **y**: Array with output classes corresponding to **N** samples related to ``X``.
-* **verbose**: Boolean, default ``True``, determines if the feedback from the detector generation will be printed.
+
+- **X**: Array with sample features, with **N** samples (rows) and **N** features (columns), normalized to values between [0, 1].
+- **y**: Array with output classes corresponding to **N** samples related to ``X``.
+- **verbose**: Boolean, default ``True``, determines if the feedback from the detector generation will be printed.
*Returns the class instance.*
@@ -95,15 +98,17 @@ def predict(self, X: npt.NDArray) -> npt.NDArray:
```
**Input parameter:**
-* **X**: Array with the features for prediction, with **N** samples (rows) and **N** columns.
+
+- **X**: Array with the features for prediction, with **N** samples (rows) and **N** columns.
**Returns:**
-* **C**: An array of predictions with the output classes for the given features.
-* **None**: If there are no detectors.
+
+- **C**: An array of predictions with the output classes for the given features.
+- **None**: If there are no detectors.
---
-### Function score(...):
+### Function score(...)
The ``score(...)`` function calculates the accuracy of the trained model by making predictions and calculating the accuracy.
@@ -117,13 +122,14 @@ Returns accuracy as a ``float``.
## Private Methods
-### Function _refinement_arb(...):
+### Function _refinement_arb(...)
The function "_refinement_arb(...)" refines the ARB set until the average stimulation value exceeds the defined threshold (``affinity_threshold_scalar``).
Parameters:
-* **c_match** (``Cell``): Cell with the highest stimulation relative to aᵢ.
-* **arb_list** (``List[_ARB]``): ARB set.
+
+- **c_match** (``Cell``): Cell with the highest stimulation relative to aᵢ.
+- **arb_list** (``List[_ARB]``): ARB set.
```python
def _refinement_arb(self, ai: npt.NDArray, c_match: Cell, arb_list: List[_ARB]) -> _ARB:
@@ -133,7 +139,7 @@ Returns the cell (_ARB) with the highest ARB stimulation.
---
-### Function _cells_affinity_threshold(...):
+### Function _cells_affinity_threshold(...)
The function "_cells_affinity_threshold(...)" calculates the affinity threshold based on the average affinity between training instances, where aᵢ and aⱼ are a pair of antigens, and affinity is measured by distance (Euclidean, Manhattan, Minkowski, Hamming).
**Following the formula:**
@@ -144,7 +150,8 @@ $$
$$
Parameters:
-* **antigens_list** (``NDArray``): List of training antigens.
+
+- **antigens_list** (``NDArray``): List of training antigens.
```python
def _cells_affinity_threshold(self, antigens_list: npt.NDArray):
@@ -152,13 +159,14 @@ def _cells_affinity_threshold(self, antigens_list: npt.NDArray):
---
-### Function _affinity(...):
+### Function _affinity(...)
The function "_affinity(...)" calculates the stimulus between two vectors using metrics.
Parameters:
-* **u** (``npt.NDArray``): Coordinates of the first point.
-* **v** (``npt.NDArray``): Coordinates of the second point.
+
+- **u** (``npt.NDArray``): Coordinates of the first point.
+- **v** (``npt.NDArray``): Coordinates of the second point.
```python
def _affinity(self, u: npt.NDArray, v: npt.NDArray) -> float:
@@ -168,12 +176,13 @@ Returns the stimulus rate between the vectors.
---
-### Function _init_memory_c(...):
+### Function _init_memory_c(...)
The function "_init_memory_c(...)" initializes memory cells by randomly selecting `n_antigens_selected` from the list of training antigens.
Parameters:
-* **antigens_list** (``NDArray``): List of training antigens.
+
+- **antigens_list** (``NDArray``): List of training antigens.
```python
def _init_memory_c(self, antigens_list: npt.NDArray) -> List[Cell]:
@@ -181,10 +190,10 @@ def _init_memory_c(self, antigens_list: npt.NDArray) -> List[Cell]:
---
-
-# References
+## References
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
\ No newline at end of file
+### 1
+>
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
diff --git a/docs/aisp-techniques/clonal-selection-algorithms/airs/abr.md b/docs/aisp-techniques/clonal-selection-algorithms/airs/abr.md
index d60358f7..13ad2b94 100644
--- a/docs/aisp-techniques/clonal-selection-algorithms/airs/abr.md
+++ b/docs/aisp-techniques/clonal-selection-algorithms/airs/abr.md
@@ -25,16 +25,18 @@ Individual from the set of recognizing cells (ABR), inherits characteristics fro
:::
-### Constructor:
+### Constructor
Parameters:
+
* vector (``npt.NDArray``): A feature vector of the cell. Defaults to None.
---
-### Function consume_resource(...):
+### Function consume_resource(...)
Parameters:
+
* n_resource (```float```) : The initial amount of resources.
* amplified (``float``): Amplifier for resource consumption by the cell. It is multiplied by the cell's stimulus. The default value is 1.
diff --git a/docs/aisp-techniques/clonal-selection-algorithms/clonalg.md b/docs/aisp-techniques/clonal-selection-algorithms/clonalg.md
index 13941075..634a0334 100644
--- a/docs/aisp-techniques/clonal-selection-algorithms/clonalg.md
+++ b/docs/aisp-techniques/clonal-selection-algorithms/clonalg.md
@@ -31,7 +31,6 @@ specific implementation. This adaptation aims to generalize CLONALG to minimizat
maximization tasks, in addition to supporting continuous, discrete, and permutation problems.
:::
-
---
## CLONALG Constructor
@@ -70,11 +69,13 @@ def optimize(
This method execute the optimization process and return the population.
**Input parameters:**
+
* **max_iters**: `int`, default=50 - The maximum number of interactions.
* **n_iter_no_change**: `int`, default=10 - The maximum number of iterations without an improvement in the best solution.
* **verbose**: `bool`, default=True - A flag to enable or disable detailed output during the optimization process.
**Returns:**
+
* `npt.NDArray`: The best antibody population after clonal expansion.
---
@@ -88,9 +89,11 @@ def affinity_function(self, solution: npt.NDArray) -> np.float64:
This method evaluates the affinity of a candidate solution. It raises a `NotImplementedError` if no affinity function has been provided to the class instance.
**Input parameters:**
+
* **solution**: `npt.NDArray` - The candidate solution to be evaluated.
**Returns:**
+
* `np.float64`: The affinity value associated with the solution.
---
@@ -106,10 +109,12 @@ def _select_top_antibodies(self, n: int, antibodies: list[tuple]) -> list[tuple]
This method selects the top `n` antibodies based on their affinity scores, according to the `mode` (`'min'` or `'max'`).
**Input parameters:**
+
* **n**: `int` - The number of antibodies to select.
* **antibodies**: `list[tuple]` - A list of tuples, where each tuple represents an antibody and its associated score.
**Returns:**
+
* `list[tuple]`: A list containing the `n` selected antibodies.
---
@@ -123,6 +128,7 @@ def _init_population_antibodies(self) -> npt.NDArray:
This method initializes the initial population of antibodies randomly.
**Returns:**
+
* `npt.NDArray`: A list of the initialized antibodies.
---
@@ -136,6 +142,7 @@ def _diversity_introduction(self):
This method introduces new random antibodies into the population to maintain genetic diversity and help prevent premature convergence.
**Returns:**
+
* `npt.NDArray`: An array of new random antibodies.
---
@@ -149,13 +156,14 @@ def _clone_and_mutate(self, antibody: npt.NDArray, n_clone: int, rate_hypermutat
This method generates mutated clones from a single antibody. The mutation strategy depends on the `feature_type` specified during initialization (`'binary-features'`, `'continuous-features'`, `'ranged-features'`, or `'permutation-features'`).
**Input parameters:**
+
* **antibody**: `npt.NDArray` - The original antibody vector to be cloned and mutated.
* **n_clone**: `int` - The number of clones to generate.
* **rate_hypermutation**: `float` - The hypermutation rate.
**Returns:**
- * `npt.NDArray`: An array containing the mutated clones.
+* `npt.NDArray`: An array containing the mutated clones.
---
@@ -168,16 +176,17 @@ def _clone_and_hypermutation(self, population: list[tuple]) -> list:
This method clones and hypermutates a population of antibodies. It returns a list of all clones and their affinities with respect to the cost function.
**Input parameters:**
+
* **population**: `list[tuple]` - The list of antibodies to be evaluated and cloned.
**Returns:**
-* `list`: A list of mutated clones.
+* `list`: A list of mutated clones.
---
+## References
-# References
-
-##### 1
-> BROWNLEE, Jason. Clonal Selection Algorithm. Clever Algorithms: Nature-inspired Programming Recipes., 2011. Available at: https://cleveralgorithms.com/nature-inspired/immune/clonal_selection_algorithm.html
\ No newline at end of file
+### 1
+>
+> BROWNLEE, Jason. Clonal Selection Algorithm. Clever Algorithms: Nature-inspired Programming Recipes., 2011. Available at: [https://cleveralgorithms.com/nature-inspired/immune/clonal_selection_algorithm.html](https://cleveralgorithms.com/nature-inspired/immune/clonal_selection_algorithm.html)
diff --git a/docs/aisp-techniques/immune-network-theory/AiNet.md b/docs/aisp-techniques/immune-network-theory/AiNet.md
index 581ecf11..0ccdc92c 100644
--- a/docs/aisp-techniques/immune-network-theory/AiNet.md
+++ b/docs/aisp-techniques/immune-network-theory/AiNet.md
@@ -1,6 +1,5 @@
---
id: ainet
-title: AiNet
sidebar_label: AiNet - Clustering and Compression
sidebar_position: 1
pagination_next: null
@@ -28,26 +27,25 @@ lastUpdatedAt: 2025/08/19
author: João Paulo
---
-# AiNet - Artificial Immune Network para Clustering and Compression.
+# AiNet - Artificial Immune Network para Clustering and Compression
The AiNet class aims to perform clustering using metaphors inspired by immune network theory.
This class implements the aiNet algorithm, an artificial immune network model designed for
clustering and data compression tasks. The aiNet algorithm uses principles from immune
network theory, clonal selection, and affinity maturation to compress high-dimensional
-datasets [1](#1).
+datasets [1](#1).
For clustering, the class uses SciPy's implementation of the [**Minimum Spanning Tree**
(MST)](#2) to remove the most distant nodes and separate the groups
:::info
-**``AiNet``** extends the **[``BaseAiNet`` class](/docs/advanced-guides/base-classes-reference/ina/ainet)**, inheriting its base functionality.
+**``AiNet``** extends the **[``BaseAiNet`` class](../../advanced-guides/base-classes-reference/ina/ainet.md)**, inheriting its base functionality.
:::
## Constructor
-
```python
class AiNet(
self,
@@ -68,6 +66,7 @@ class AiNet(
```
**Attributes:**
+
* **N** (``int``): Number of memory cells (antibodies) in the population. Defaults to 50.
* **n_clone** (``int``): Number of clones generated per selected memory cell. Defaults to 10.
* **top_clonal_memory_size** (``Optional[int]``): Number of highest-affinity antibodies selected for cloning. Defaults to 5.
@@ -78,20 +77,21 @@ class AiNet(
* **max_iterations** (``int``): Maximum number of training iterations. Defaults to 10.
* **k** (``int``): Number of nearest neighbors used for label prediction. Defaults to 3.
* **metric** (Literal["manhattan", "minkowski", "euclidean"]): Way to calculate the distance between the detector and the sample:
- * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression:
- $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + ... + (Y_{n} - Y_{n})^2}$$
- * ``'minkowski'`` ➜ The calculation of the distance is given by the expression:
- $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + ... |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - X_{1}| + |Y_{2} - Y_{2}| + ... + |Y_{n} - Y_{n}|)$$.
+ * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression:
+ $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$
+ * ``'minkowski'`` ➜ The calculation of the distance is given by the expression:
+ $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
+ * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$.
Defaults to **"Euclidean"**.
* **seed** (``Optional[int]``): Seed for random number generation. Defaults to None.
* **use_mst_clustering** (``bool``): Whether to perform MST-based clustering. Defaults to True.
* **kwargs**:
- * **p** (``float``): Parameter for Minkowski distance. Defaults to 2.
+ * **p** (``float``): Parameter for Minkowski distance. Defaults to 2.
**Other initialized variables:**
+
* **_population_antibodies** (``npt.NDArray``): Stores the current set of antibodies.
* **_memory_network** (``dict``): Dictionary mapping clusters to antibodies.
* **_mst_structure** (``scipy.sparse.csr_matrix``): MST adjacency structure.
@@ -109,7 +109,7 @@ Trains the AiNet model on input data:
```python
def fit(self, X: npt.NDArray, verbose: bool = True):
-````
+```
**Input parameters:**
@@ -165,7 +165,7 @@ Initializes antibody population randomly.
```python
def _init_population_antibodies(self) -> npt.NDArray:
-````
+```
**Returns:** Initialized antibodies (`npt.NDArray`).
@@ -302,12 +302,14 @@ def _build_mst(self):
---
-# References
+## References
-##### 1
+### 1
+>
> De Castro, Leandro & José, Fernando & von Zuben, Antonio Augusto. (2001). aiNet: An Artificial Immune Network for Data Analysis.
-> Available at: [https://www.researchgate.net/publication/228378350_aiNet_An_Artificial_Immune_Network_for_Data_Analysis](https://www.researchgate.net/publication/228378350_aiNet_An_Artificial_Immune_Network_for_Data_Analysis)
+> Available at: [https://www.researchgate.net/publication/228378350_aiNet_An_Artificial_Immune_Network_for_Data_Analysis](https://www.researchgate.net/publication/228378350_aiNet_An_Artificial_Immune_Network_for_Data_Analysis)
-##### 2
+### 2
+>
> SciPy Documentation. *Minimum Spanning Tree*.
-> Available at: [https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree)
\ No newline at end of file
+> Available at: [https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree)
diff --git a/docs/aisp-techniques/immune-network-theory/README.mdx b/docs/aisp-techniques/immune-network-theory/README.mdx
index 76ad1ad2..148e0fbe 100644
--- a/docs/aisp-techniques/immune-network-theory/README.mdx
+++ b/docs/aisp-techniques/immune-network-theory/README.mdx
@@ -31,9 +31,9 @@ The Artificial Immune Network can be applied in different contexts, such as:
-# References
+## References
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
+### 1
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
diff --git a/docs/aisp-techniques/negative-selection/BNSA.md b/docs/aisp-techniques/negative-selection/BNSA.md
index 6a2ca342..3a4e0e0b 100644
--- a/docs/aisp-techniques/negative-selection/BNSA.md
+++ b/docs/aisp-techniques/negative-selection/BNSA.md
@@ -1,6 +1,5 @@
---
id: bnsa
-title: BNSA
sidebar_label: BNSA - Binary Negative Selection Algorithm
sidebar_position: 2
pagination_next: null
@@ -24,7 +23,7 @@ last_update:
# BNSA (Binary Negative Selection Algorithm)
-## Constructor RNSA:
+## Constructor RNSA
The ``BNSA`` (Binary Negative Selection Algorithm) class has the purpose of classifying and identifying anomalies through the self and not self methods.
@@ -45,6 +44,7 @@ class BNSA(
* *N* (``int``): Number of detectors. Defaults to ``100``.
* *aff_thresh* (``float``): The variable ('affinity threshold') represents the percentage of dissimilarity between the T cell and the own samples. The default value is 10% (0.1), while a value of 1.0 represents 100% dissimilarity.
+
:::note
Setting the difference percentage too high can result in the inability to generate detectors for non-self.
:::
@@ -53,8 +53,8 @@ Setting the difference percentage too high can result in the inability to genera
possible infinite loop if a radius is defined that it is not possible to generate non-self detectors. Defaults to ``1000``.
* *seed* (``int``): Seed for the random generation of values in the detectors. Defaults to ``None``.
* no_label_sample_selection (``str``): Method for selecting labels for samples designated as non-members by all non-member detectors. **Available method types:**
- - (``max_average_difference``): Selects the class with the highest average difference among the detectors.
- - (``max_nearest_difference``): Selects the class with the highest difference between the nearest and farthest detector from the sample.
+ * (``max_average_difference``): Selects the class with the highest average difference among the detectors.
+ * (``max_nearest_difference``): Selects the class with the highest difference between the nearest and farthest detector from the sample.
**Other variables initiated:**
@@ -62,10 +62,8 @@ possible infinite loop if a radius is defined that it is not possible to generat
* *classes* (``npt.NDArray``): list of output classes.
-
---
-
### Function fit(...)
The ``fit(...)`` function generates the detectors for non-fits with respect to the samples:
@@ -76,8 +74,9 @@ def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
In it, training is performed according to ``X`` and ``y``, using the negative selection method(``NegativeSelect``).
-**The input parameters are:**
-* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
+**The input parameters are:**
+
+* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
* ``y``: array with the output classes arranged in **N** samples that are related to ``X``.
@@ -95,10 +94,12 @@ The ``predict(...)`` function performs class prediction using the generated dete
def predict(self, X: npt.NDArray) -> npt.NDArray:
```
-**The input parameter is:**
+**The input parameter is:**
+
* ``X``: array with the characteristics for the prediction, with **N** samples (Rows) and **N** columns.
-**Returns:**
+**Returns:**
+
* ``C``: prediction array, with the output classes for the given characteristics.
* ``None``: if there are no detectors.
@@ -128,8 +129,9 @@ The function ``__assign_class_to_non_self_sample(...)``, determines the class of
def __assign_class_to_non_self_sample(self, line: npt.NDArray, c: list):
```
-**The input parameter is:**
+**The input parameter is:**
+
* ***line*** (``npt.NDArray``): Sample to be classified.
* ***c*** (``list``): List of predictions to be updated with the new classification.
----
\ No newline at end of file
+---
diff --git a/docs/aisp-techniques/negative-selection/README.md b/docs/aisp-techniques/negative-selection/README.md
index 325d8e55..be74a482 100644
--- a/docs/aisp-techniques/negative-selection/README.md
+++ b/docs/aisp-techniques/negative-selection/README.md
@@ -6,30 +6,37 @@ sidebar_position: 1
**Negative selection** is the process in which the immune system maturates T-cells, also known as T-lymphocytes, which make them capable of detecting non-self. Thus, the Negative Selection Algorithm (NSA) uses hyperspheres symbolizing the detectors in an N-dimensional data space. [[1]](#1)
-# classes
+## classes
> 1. **[Binary version:](BNSA.md)**
+>
>> The binary algorithm adapted for multiple classes in this project is based on the version proposed by [Forrest et al. (1994)](#2), originally developed for computer security.
>>> **Example:**
->>> + [Mushrooms Database](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/BNSA/mushrooms_dataBase_example_en.ipynb)
+>>>
+>>> + [Mushrooms Database](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/BNSA/mushrooms_dataBase_example_en.ipynb)
> 2. **[Real-Valued version:](RNSA.md)**
+>
>>This algorithm has two different versions: one based on the canonical version [[1]](#1) and another with variable radius detectors [[3]](#3). Both are adapted to work with multiple classes and have methods for predicting data present in the non-self region of all detectors and classes.
>>> **Examples:**
->>> + [Iris Database](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/iris_dataBase_example_en.ipynb)
->>> + [Geyser Database](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/geyser_dataBase_example_en.ipynb)
+>>>
+>>> + [Iris Database](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/iris_dataBase_example_en.ipynb)
+>>> + [Geyser Database](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/geyser_dataBase_example_en.ipynb)
-# References
+## References
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
+### 1
+>
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
-##### 2
-> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: http://dx.doi.org/10.1109/RISP.1994.296580.
+### 2
+>
+> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: [https://dx.doi.org/10.1109/RISP.1994.296580](https://dx.doi.org/10.1109/RISP.1994.296580).
-##### 3
-> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: http://dx.doi.org/10.1007/978-3-540-24854-5_30.
+### 3
+>
+> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: [https://dx.doi.org/10.1007/978-3-540-24854-5_30](https://dx.doi.org/10.1007/978-3-540-24854-5_30).
----
\ No newline at end of file
+---
diff --git a/docs/aisp-techniques/negative-selection/RNSA.md b/docs/aisp-techniques/negative-selection/RNSA.md
index 37444177..1787b8ea 100644
--- a/docs/aisp-techniques/negative-selection/RNSA.md
+++ b/docs/aisp-techniques/negative-selection/RNSA.md
@@ -1,6 +1,5 @@
---
id: rnsa
-title: RNSA
sidebar_label: RNSA - Real-Valued Negative Selection Algorithm
sidebar_position: 1
keywords:
@@ -21,7 +20,7 @@ last_update:
# RNSA (Real-Valued Negative Selection Algorithm)
-## Constructor RNSA:
+## Constructor RNSA
The ``RNSA`` (Real-Valued Negative Selection Algorithm) class has the purpose of classifying and identifying anomalies through the self and not self methods.
@@ -44,6 +43,7 @@ class RNSA(
* *N* (``int``): Number of detectors. Defaults to ``100``.
* *r* (``float``): Radius of the detector. Defaults to ``0.05``.
+
:::note
it is important to consider that setting a very low radius for the detector can significantly reduce the detection rate. On the other hand, a very large radius can make it impossible to incorporate the detector into the search space, which can also compromise detection performance. It is essential to find a balance between the radius size and detection efficiency to achieve the best possible results.
:::
@@ -51,32 +51,31 @@ it is important to consider that setting a very low radius for the detector can
* *k* (``int``): Number of neighbors near the randomly generated detectors to perform the distance average calculation. Defaults to ``1``.
* *metric* (``str``): Way to calculate the distance between the detector and the sample:
- * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression: $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + ... + (Y_{n} - Y_{n})^2}$$.
+ * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression: $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$.
- * ``'minkowski'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + ... |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - X_{1}| + |Y_{2} - Y_{2}| + ... + |Y_{n} - Y_{n}|)$$.
+ * ``'minkowski'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
+ * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$.
Defaults to ``'euclidean'``.
-
* *max_discards* (``int``): This parameter indicates the maximum number of consecutive detector discards, aimed at preventing a possible infinite loop in case a radius is defined that cannot generate non-self detectors. Defaults to ``1000``.
* *seed* (``int``): Seed for the random generation of values in the detectors. Defaults to ``None``.
* *algorithm* (``str``), Set the algorithm version:
- * ``'default-NSA'``: Default algorithm with fixed radius.
- * ``'V-detector'``: This algorithm is based on the article "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", by Ji, Z., Dasgupta, D. (2004), and uses a variable radius for anomaly detection in feature spaces.
+ * ``'default-NSA'``: Default algorithm with fixed radius.
+ * ``'V-detector'``: This algorithm is based on the article "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", by Ji, Z., Dasgupta, D. (2004), and uses a variable radius for anomaly detection in feature spaces.
Defaults to ``'default-NSA'``.
* *r_s* (``float``): rₛ Radius of the ``X`` own samples.
-- ``**kwargs``:
- - *non_self_label* (``str``): This variable stores the label that will be assigned when the data has only one
+
+* ``**kwargs``:
+ * *non_self_label* (``str``): This variable stores the label that will be assigned when the data has only one
output class, and the sample is classified as not belonging to that class. Defaults to ``'non-self'``.
- - *cell_bounds* (``bool``): If set to ``True``, this option limits the generation of detectors to the space within the plane between 0 and 1. This means that any detector whose radius exceeds this limit is discarded, this variable is only used in the ``V-detector`` algorithm.
- - p (``float``): This parameter stores the value of ``p`` used in the Minkowski distance. The default is ``2``, which represents normalized Euclidean distance. Different values of p lead to different variants of the Minkowski
+ * *cell_bounds* (``bool``): If set to ``True``, this option limits the generation of detectors to the space within the plane between 0 and 1. This means that any detector whose radius exceeds this limit is discarded, this variable is only used in the ``V-detector`` algorithm.
+ * p (``float``): This parameter stores the value of ``p`` used in the Minkowski distance. The default is ``2``, which represents normalized Euclidean distance. Different values of p lead to different variants of the Minkowski
distance [learn more](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
-
**Other variables initiated:**
@@ -96,8 +95,9 @@ def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
In it, training is performed according to ``X`` and ``y``, using the negative selection method(``NegativeSelect``).
-The input parameters are:
-* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
+The input parameters are:
+
+* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
* ``y``: array with the output classes arranged in **N** samples that are related to ``X``.
@@ -115,10 +115,12 @@ The ``predict(...)`` function performs class prediction using the generated dete
def predict(self, X: npt.NDArray) -> npt.NDArray:
```
-**The input parameter is:**
+**The input parameter is:**
+
* ``X``: array with the characteristics for the prediction, with **N** samples (Rows) and **N** columns.
-**Returns:**
+**Returns:**
+
* ``C``: prediction array, with the output classes for the given characteristics.
* ``None``: if there are no detectors.
@@ -149,12 +151,13 @@ def __checks_valid_detector(self, X: npt.NDArray, vector_x: npt.NDArray, samples
```
**The input parameters are:**
+
* ``X``: array with sample characteristics with **N** samples (rows) and **N** characteristics (columns), normalized to values between [0, 1].
* ``vector_x``: Randomly generated candidate detector.
* ``samplesIndexClass``: Array with the indexes of a class.
-
+
**Returns:** ``True`` for detectors that do not have samples inside or ``False`` if they do.
---
@@ -179,9 +182,11 @@ In this function, when there is class ambiguity, it returns the class that has t
```python
def __compare_sample_to_detectors(self, line):
```
+
**The input parameters are:**
+
* line: vector with N-features
-
+
**Returns:** The predicted class with the detectors or None if the sample does not qualify for any class.
---
@@ -193,13 +198,14 @@ Check if the distance between the detector and the samples, minus the radius of
```python
def __detector_is_valid_to_Vdetector(self, distance, vector_x):
```
-
+
**The input parameters are:**
* distance (``float``): minimum distance calculated between all samples.
* vector_x (``numpy.ndarray``): randomly generated candidate detector vector x with values between 0 and 1.
-**Returns:**
+**Returns:**
+
* ``False``: if the calculated radius is smaller than the minimum distance or exceeds the edge of the space, if this option is enabled.
* ``True`` and the distance minus the radius of the samples, if the radius is valid.`
@@ -218,4 +224,3 @@ The input parameters are ``u`` and ``v`` NDArrays, with the coordinates for the
**Returns:** the distance (``double``) between the two points.
---
-
diff --git a/docs/examples/Classification/csa.md b/docs/examples/Classification/csa.md
index 138193d6..aba99717 100644
--- a/docs/examples/Classification/csa.md
+++ b/docs/examples/Classification/csa.md
@@ -27,30 +27,34 @@ keywords:
- immune recognition
---
-# Clonal Selection Algorithm
-
This page presents a collection of practical examples showcasing how to use the Clonal Selection Algorithm.
## AIRS (Artificial Immune Recognition System)
-
Run notebooks online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclassification%2FAIRS)
---
### Binary Algorithm
-+ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/example_with_randomly_generated_dataset-en.ipynb)
++ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/example_with_randomly_generated_dataset-en.ipynb)
+
> In the example present in this notebook 1000 random samples were generated, arranged in two groups, one for each class.
+ [mushrooms_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/mushrooms_dataBase_example_en.ipynb)
-> It uses the [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), which contains information about edible and poisonous mushrooms.
+
+> It uses the [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), which contains information about edible and poisonous mushrooms.
### Real-Valued Algorithm
-+ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/example_with_randomly_generated_dataset-en.ipynb)
++ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/example_with_randomly_generated_dataset-en.ipynb)
+
> In the example present in this notebook 500 random samples were generated, arranged in two groups, one for each class, we can see the non-self detectors generated below
+
+ [iris_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/iris_dataBase_example_en.ipynb)
+
> Example using the NSA [iris database](https://archive.ics.uci.edu/ml/datasets/iris), which contains four-dimensional samples and three output classes (Setosa, Versicolor and Virginica).
+
+ [geyser_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/geyser_dataBase_example_en.ipynb)
-> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
\ No newline at end of file
+
+> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/docs/examples/Classification/nsa.md b/docs/examples/Classification/nsa.md
index bbafa10a..89981dd5 100644
--- a/docs/examples/Classification/nsa.md
+++ b/docs/examples/Classification/nsa.md
@@ -33,21 +33,28 @@ Run notebooks online via Binder: [
---
-+ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/BNSA/example_with_randomly_generated_dataset-en.ipynb)
++ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/BNSA/example_with_randomly_generated_dataset-en.ipynb)
+
> In the example present in this notebook 1000 random samples were generated, arranged in two groups, one for each class.
+ [mushrooms_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/BNSA/mushrooms_dataBase_example_en.ipynb)
-> It uses the [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), which contains information about edible and poisonous mushrooms.
-# RNSA (Real-Valued Negative Selection Algorithm)
+> It uses the [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), which contains information about edible and poisonous mushrooms.
+
+## RNSA (Real-Valued Negative Selection Algorithm)
Run notebooks online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclassification%2FRNSA)
---
-+ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/example_with_randomly_generated_dataset-en.ipynb)
++ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/example_with_randomly_generated_dataset-en.ipynb)
+
> In the example present in this notebook 500 random samples were generated, arranged in two groups, one for each class, we can see the non-self detectors generated below
+
+ [iris_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/iris_dataBase_example_en.ipynb)
+
> Example using the NSA [iris database](https://archive.ics.uci.edu/ml/datasets/iris), which contains four-dimensional samples and three output classes (Setosa, Versicolor and Virginica).
+
+ [geyser_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/geyser_dataBase_example_en.ipynb)
-> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
\ No newline at end of file
+
+> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/docs/examples/Clustering/ina.md b/docs/examples/Clustering/ina.md
index 7e98acdd..26ef03c8 100644
--- a/docs/examples/Clustering/ina.md
+++ b/docs/examples/Clustering/ina.md
@@ -18,23 +18,22 @@ keywords:
- geyser dataset
---
-# Immune Network Algorithms
-
On this page, you will find a collection of practical examples that demonstrate how to use the Immune Network Algorithm classes implemented in our package.
-
Run notebooks online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclustering%2FAiNet)
## AiNet (Artificial Immune Network)
-
---
+ [Random datasets](https://github.com/AIS-Package/aisp/blob/main/examples/en/clustering/AiNet/example_with_randomly_generated_dataset.ipynb)
+
> In this notebook AiNet is demonstrated on three synthetic datasets:
-> - **Blobs:** well-defined spherical clusters, easy to separate.
-> - **Moons:** non-linear clusters, illustrating more complex decision boundaries.
-> - **Circles:** two concentric circles, showing the capability of handling non-linear separation.
+>
+> + **Blobs:** well-defined spherical clusters, easy to separate.
+> + **Moons:** non-linear clusters, illustrating more complex decision boundaries.
+> + **Circles:** two concentric circles, showing the capability of handling non-linear separation.
+ [geyser_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/clustering/AiNet/geyser_dataBase_example.ipynb)
-> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
\ No newline at end of file
+
+> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/docs/examples/Optimization/csa.md b/docs/examples/Optimization/csa.md
index 5dbfe61d..21176f04 100644
--- a/docs/examples/Optimization/csa.md
+++ b/docs/examples/Optimization/csa.md
@@ -17,9 +17,6 @@ keywords:
- machine learning
---
-# Clonal Selection Algorithm
-
-
On this page, you will find a collection of practical examples that demonstrate how to use the Clonal Selection Algorithms classes implemented in our package.
Run notebooks online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Foptimization%2Fclonalg)
@@ -29,14 +26,15 @@ Run notebooks online via Binder: [
## Clonalg (Clonal Selection Algorithm)
+ [Traveling Salesman Problem](https://github.com/AIS-Package/aisp/blob/main/examples/en/optimization/clonalg/tsp_problem_example.ipynb)
-> In this notebook, apply **Clonalg** to the Knapsack Problem using optimization algorithms from the AISP package.
+> In this notebook, apply **Clonalg** to the Knapsack Problem using optimization algorithms from the AISP package.
+ [Rastrigin Function](https://github.com/AIS-Package/aisp/blob/main/examples/en/optimization/clonalg/rastrigin_function_example.ipynb)
-> In this notebook, we apply **Clonalg** to the **Rastrigin Function**, a classic continuous optimization problem using optimization algorithms from the **AISP** package.
+> In this notebook, we apply **Clonalg** to the **Rastrigin Function**, a classic continuous optimization problem using optimization algorithms from the **AISP** package.
+ [Knapsack Problem](https://github.com/AIS-Package/aisp/blob/main/examples/en/optimization/clonalg/knapsack_problem_example.ipynb)
+
> In this notebook, apply **Clonalg** to the Knapsack Problem using optimization algorithms from the AISP package.
---
diff --git a/docs/getting-started/basic-use/AIRS.md b/docs/getting-started/basic-use/AIRS.md
index b748b6f7..12e618b9 100644
--- a/docs/getting-started/basic-use/AIRS.md
+++ b/docs/getting-started/basic-use/AIRS.md
@@ -32,11 +32,12 @@ Access the Jupyter notebook with the code available [here](https://github.com/AI
Run notebook online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclassification%2FAIRS%2Fexample_with_randomly_generated_dataset-en.ipynb)
### Importing the Artificial Immune Recognition System
+
```python
from aisp.csa import AIRS
```
-### Generating dice bubbles for classes randomly.
+### Generating dice bubbles for classes randomly
Using the `make_blobs` function, two sets of data are generated in the form of bubbles, in the range between 0 and 1, representing each class x and y. Then this data is separated into test and training sets.
@@ -52,7 +53,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-### Testing the model AIRS:
+### Testing the model AIRS
Then, it presents the result of the forecast accuracy.
@@ -71,6 +72,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```bash
✔ Set of memory cells for classes (0, 1) successfully generated: ┇██████████┇ 400/400 memory cells for each aᵢ
The accuracy is 1.0
@@ -86,6 +88,6 @@ weighted avg 1.00 1.00 1.00 100
---
-### Memory cell and sample plotting:
+### Memory cell and sample plotting
-
\ No newline at end of file
+
diff --git a/docs/getting-started/basic-use/AiNet.mdx b/docs/getting-started/basic-use/AiNet.mdx
index a633063a..b770c3ea 100644
--- a/docs/getting-started/basic-use/AiNet.mdx
+++ b/docs/getting-started/basic-use/AiNet.mdx
@@ -263,4 +263,4 @@ Silhouette Coefficient: 0.112
plot_immune_network(samples, predict_y, model, title_prefix="Circles - ")
```
-
+
diff --git a/docs/getting-started/basic-use/BNSA.md b/docs/getting-started/basic-use/BNSA.md
index 0605f25d..4b58e8f7 100644
--- a/docs/getting-started/basic-use/BNSA.md
+++ b/docs/getting-started/basic-use/BNSA.md
@@ -27,12 +27,12 @@ Access the Jupyter notebook with the code available [here](https://github.com/AI
Run notebook online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclassification%2FBNSA%2Fexample_with_randomly_generated_dataset-en.ipynb)
-
## Importing the BNSA algorithm
```python
from aisp.nsa import BNSA
```
+
## Generating samples
Algorithm training and testing needs data samples. Thus, for the demonstration, two random classes were generated, using the following function:
@@ -104,6 +104,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```
✔ Non-self detectors for classes (x, y) successfully generated: ┇██████████┇ 500/500 detectors
The accuracy is 0.93
@@ -132,4 +133,4 @@ plt.ylabel('Estimated')
plt.show()
```
-
\ No newline at end of file
+
diff --git a/docs/getting-started/basic-use/Clonalg.md b/docs/getting-started/basic-use/Clonalg.md
index d70ff5e5..df75714e 100644
--- a/docs/getting-started/basic-use/Clonalg.md
+++ b/docs/getting-started/basic-use/Clonalg.md
@@ -30,6 +30,7 @@ The Rastrigin function is a multimodal, non-convex function with many local mini
$$ f(x) = 10n + \sum_{i=1}^{n} (x_i^{2} - 10\cos(2\pi x_i)) $$
Where:
+
* **n** is the problem dimension
* **xᵢ** ∈ \[−5.12, 5.12] for each dimension
* **Global minimum**: f(0,0) = 0
@@ -88,9 +89,11 @@ clonalg.register('affinity_function', rastrigin_fitness)
clonalg.optimize(100, 20)
if clonalg.best_cost is not None:
- print('Best cost:', abs(clonalg.best_cost))
+ print('Best cost:', abs(clonalg.best_cost))
```
+
Output:
+
```bash
┌───────────┬─────────────────────────┬────────────────────┬─────────────────┐
│ Iteration │ Best Affinity (min) │ Worse Affinity │ Stagnation │
@@ -147,10 +150,13 @@ Best cost: 0.020278270044883584
```
### Result
+
```python
print(clonalg.get_report())
```
+
Output:
+
```python
=============================================
Optimization Summary
@@ -213,4 +219,4 @@ Cost History per Iteration:
### Evolution of the best over generations
-
\ No newline at end of file
+
diff --git a/docs/getting-started/basic-use/RNSA.md b/docs/getting-started/basic-use/RNSA.md
index 2e4dad0f..3b3d6fe6 100644
--- a/docs/getting-started/basic-use/RNSA.md
+++ b/docs/getting-started/basic-use/RNSA.md
@@ -23,15 +23,15 @@ keywords:
Access the Jupyter notebook with the code available [here](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/example_with_randomly_generated_dataset-en.ipynb)!
-
Run notebook online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclassification%2FRNSA%2Fexample_with_randomly_generated_dataset-en.ipynb)
-### Importing the Real-Valued Negative Selection Algorithm.
+### Importing the Real-Valued Negative Selection Algorithm
+
```python
from aisp.nsa import RNSA
```
-### Generating dice bubbles for classes randomly.
+### Generating dice bubbles for classes randomly
Using the `make_blobs` function, two sets of data are generated in the form of bubbles, in the range between 0 and 1, representing each class x and y. Then this data is separated into test and training sets.
@@ -47,7 +47,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-### Testing the model `default-NSA`:
+### Testing the model `default-NSA`
Start the model with 500 detectors, each with a radius of 0.06. Then, it presents the result of the forecast accuracy.
@@ -66,6 +66,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```bash
✔ Non-self detectors for classes (0, 1) successfully generated: ┇██████████┇ 1000/1000 detectors
The accuracy is 1.0
@@ -81,13 +82,13 @@ weighted avg 1.00 1.00 1.00 100
---
-### Detector and sample plotting:
+### Detector and sample plotting
-
+
---
-### Testing the model `V-detector`:
+### Testing the model `V-detector`
Start the model with 50 detectors, where the minimum radius is 0.05 and the sample's own radius is 0.04. It then shows the forecast accuracy result.
@@ -106,6 +107,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```bash
✔ Non-self detectors for classes (0, 1) successfully generated: ┇██████████┇ 40/40 detectors
The accuracy is 1.0
@@ -121,5 +123,6 @@ weighted avg 1.00 1.00 1.00 100
---
-### Detector and sample plotting:
-
\ No newline at end of file
+### V-Detector and sample plotting
+
+
diff --git a/docs/intro.md b/docs/intro.md
index 32ce6082..178a8f7d 100644
--- a/docs/intro.md
+++ b/docs/intro.md
@@ -36,7 +36,7 @@ keywords:
### Algorithms implemented
-> - [x] [**Negative Selection.**](/docs/aisp-techniques/negative-selection/)
-> - [x] [**Clonal Selection Algorithms.**](/docs/aisp-techniques/clonal-selection-algorithms/)
-> - [x] [**Immune Network Theory.**](/docs/aisp-techniques/immune-network-theory/)
+> - [x] [**Negative Selection.**](./aisp-techniques/negative-selection/)
+> - [x] [**Clonal Selection Algorithms.**](./aisp-techniques/clonal-selection-algorithms/)
+> - [x] [**Immune Network Theory.**](./aisp-techniques/immune-network-theory/)
> - [ ] *Danger Theory*
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/about-us.mdx b/i18n/pt-br/docusaurus-plugin-content-docs/current/about-us.mdx
index a8a81fbf..fb136e1e 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/about-us.mdx
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/about-us.mdx
@@ -26,7 +26,7 @@ pertencentes à área de sistemas imunológicos artificiais.
name='Alison Zille Lopes'
date='2022'
githubUrl='https://github.com/alisonzille'
- lattesUrl='http://lattes.cnpq.br/3294097090760981'
+ lattesUrl='https://lattes.cnpq.br/3294097090760981'
/>
@@ -42,7 +42,7 @@ pertencentes à área de sistemas imunológicos artificiais.
date='2022-2023'
description="Fui encarregado de implementar a versão 0.1, que apresenta as classes de seleção negativa BNSA e RNSA, incluindo as versões de raio fixo e variável."
githubUrl='https://github.com/Joao-Paulo-Silva'
- lattesUrl='http://lattes.cnpq.br/2561057724411407'
+ lattesUrl='https://lattes.cnpq.br/2561057724411407'
/>
\ No newline at end of file
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Core/negative-selection.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Core/negative-selection.md
index 6777640c..9041d2b2 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Core/negative-selection.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Core/negative-selection.md
@@ -8,7 +8,7 @@ last_update:
As funções realizam verificações de detectores e utilizam decoradores Numba para compilação Just-In-Time.
-### Função check_detector_bnsa_validity(...):
+## Função check_detector_bnsa_validity(...)
```python
def check_detector_bnsa_validity(
@@ -20,19 +20,19 @@ def check_detector_bnsa_validity(
Verifica a validade de um candidato a detector (vector_x) contra amostras de uma classe (x_class) usando a distância de Hamming. Um detector é considerado INVÁLIDO se a sua distância para qualquer amostra em ``x_class`` for menor ou igual a ``aff_thresh``.
-
**Os parâmetros de entrada são:**
+
* x_class (``npt.NDArray``): Array contendo as amostras da classe. Formato esperado: (n_amostras, n_características).
* vector_x (``npt.NDArray``): Array representando o detector. Formato esperado: (n_características,).
* aff_thresh (``float``): Limiar de afinidade.
+**Retorna:**
-**Retorna:**
* True se o detector for válido, False caso contrário.
---
-### Função bnsa_class_prediction(...):
+## Função bnsa_class_prediction(...)
```python
def bnsa_class_prediction(
@@ -41,19 +41,22 @@ def bnsa_class_prediction(
aff_thresh: float
) -> int:
```
+
Define a classe de uma amostra a partir dos detectores não-próprios.
**Os parâmetros de entrada são:**
+
* features (``npt.NDArray``): amostra binária a ser classificada (shape: [n_features]).
-* class_detectors (``npt.NDArray``): Matriz contendo os detectores de todas as classes (shape: [n_classes, n_detectors, n_features]).
+* class_detectors (``npt.NDArray``): Matriz contendo os detectores de todas as classes (shape: [n_classes, n_detectors, n_features]).
* aff_thresh (``float``): Limiar de afinidade que determina se um detector reconhece a amostra como não-própria.
-**Retorna:**
+**Retorna:**
+
* int: Índice da classe predita. Retorna -1 se for não-própria para todas as classes.
---
-### Função check_detector_rnsa_validity(...):
+## Função check_detector_rnsa_validity(...)
```python
def check_detector_rnsa_validity(
@@ -64,18 +67,19 @@ def check_detector_rnsa_validity(
p: float
) -> bool:
```
-Verifica a validade de um candidato a detector (vector_x) contra amostras de uma classe (x_class) usando a distância de Hamming. Um detector é considerado INVÁLIDO se a sua distância para qualquer amostra em ``x_class`` for menor ou igual a ``aff_thresh``.
+Verifica a validade de um candidato a detector (vector_x) contra amostras de uma classe (x_class) usando a distância de Hamming. Um detector é considerado INVÁLIDO se a sua distância para qualquer amostra em ``x_class`` for menor ou igual a ``aff_thresh``.
**Os parâmetros de entrada são:**
+
* x_class (``npt.NDArray``): Array contendo as amostras da classe. Formato esperado: (n_amostras, n_características).
* vector_x (``npt.NDArray``): Array representando o detector. Formato esperado: (n_características,).
* threshold (``float``): Afinidade.
* metric (``int``): Métrica de distância a ser utilizada. Opções disponíveis: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)].
* p (``float``): Parâmetro da métrica de Minkowski (utilizado apenas se `metric` for "minkowski").
+**Retorna:**
-**Retorna:**
* True se o detector for válido, False caso contrário.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Distance.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Distance.md
index 3238ee07..4c4e896f 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Distance.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Distance.md
@@ -16,15 +16,15 @@ def hamming(u: npt.NDArray, v: npt.NDArray) -> np.float64:
Função para calcular a distância de Hamming normalizada entre dois pontos.
-
$((x₁ ≠ x₂) + (y₁ ≠ y₂) + ... + (y_n ≠ y_n)) / n$
-
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto
* v (``npt.NDArray``): Coordenadas do segundo ponto.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -39,13 +39,13 @@ Função para calcular a distância euclidiana normalizada entre dois pontos.
$√( (x₁ - x₂)² + (y₁ - y₂)² + ... + (y_n - y_n)²)$
-
-
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto
* v (``npt.NDArray``): Coordenadas do segundo ponto.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -57,15 +57,16 @@ def cityblock(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64]) -> np.floa
```
Função para calcular a distância Manhattan normalizada entre dois pontos.
-
-$(|x₁ - x₂| + |y₁ - y₂| + ... + |y_n - y_n|) / n$
+$(|x₁ - x₂| + |y₁ - y₂| + ... + |y_n - y_n|) / n$
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto
* v (``npt.NDArray``): Coordenadas do segundo ponto.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -77,19 +78,20 @@ def minkowski(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64], p: float =
```
Função para calcular a distância de Minkowski normalizada entre dois pontos.
-
-$(( |X₁ - Y₁|p + |X₂ - Y₂|p + ... + |X_n - Y_n|p) ¹/ₚ) / n$
+$(( |X₁ - Y₁|p + |X₂ - Y₂|p + ... + |X_n - Y_n|p) ¹/ₚ) / n$
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto.
* v (``npt.NDArray``): Coordenadas do segundo ponto.
* p (``float``): O parâmetro p define o tipo de distância a ser calculada:
- - p = 1: Distância **Manhattan** — soma das diferenças absolutas.
- - p = 2: Distância **Euclidiana** — soma das diferenças ao quadrado (raiz quadrada).
- - p > 2: Distância **Minkowski** com uma penalidade crescente à medida que p aumenta.
+ * p = 1: Distância **Manhattan** — soma das diferenças absolutas.
+ * p = 2: Distância **Euclidiana** — soma das diferenças ao quadrado (raiz quadrada).
+ * p > 2: Distância **Minkowski** com uma penalidade crescente à medida que p aumenta.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -107,15 +109,15 @@ def compute_metric_distance(
Função para calcular a distância entre dois pontos pela ``métrica`` escolhida.
-
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto.
* v (``npt.NDArray``): Coordenadas do segundo ponto.
* metric (``int``): Métrica de distância a ser utilizada. Opções disponíveis: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)].
* p (``float``): Parâmetro da métrica de Minkowski (utilizado apenas se `metric` for "minkowski").
-
**Returns:**
+
* Distância (``double``) entre os dois pontos com a métrica selecionada.
---
@@ -134,12 +136,14 @@ def min_distance_to_class_vectors(
Calcula a menor distância entre um vetor de entrada e os vetores de uma classe.
**Parameters:**
+
* x_class (``npt.NDArray``): Array contendo os vetores da classe com os quais o vetor de entrada será comparado. Formato esperado: (n_amostras, n_características).
* vector_x (``npt.NDArray``): Vetor a ser comparado com os vetores da classe. Formato esperado: (n_características,).
* metric (``int``): Métrica de distância a ser utilizada. Opções disponíveis: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)].
* p (``float``): Parâmetro da métrica de Minkowski (utilizado apenas se `metric` for "minkowski").
**Returns:**
+
* float: A menor distância calculada entre o vetor de entrada e os vetores da classe.
* Retorna -1.0 se as dimensões de entrada forem incompatíveis.
@@ -150,15 +154,17 @@ Calcula a menor distância entre um vetor de entrada e os vetores de uma classe.
```python
def get_metric_code(metric: str) -> int:
```
+
Retorna o código numérico associado a uma métrica de distância.
**Parameters:**
-* metric (``str``): Nome da métrica. Pode ser "euclidean", "manhattan", "minkowski" ou "hamming".
+* metric (``str``): Nome da métrica. Pode ser "euclidean", "manhattan", "minkowski" ou "hamming".
**Raises**
-----------
+
* ``ValueError``: Se a métrica informada não for suportada.
**Returns:**
-* ``int``: Código numérico correspondente à métrica.
\ No newline at end of file
+
+* ``int``: Código numérico correspondente à métrica.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Metrics.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Metrics.md
index dac82b80..1bef4601 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Metrics.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Metrics.md
@@ -8,7 +8,7 @@ author: João Paulo
O arquivo de métricas fornece utilitários para medir, analisar e comparar o desempenho dos algoritmos do pacote de forma padronizada.
-#### def accuracy_score(...)
+### def accuracy_score(...)
```python
def accuracy_score(
@@ -20,19 +20,19 @@ def accuracy_score(
Função para calcular a acurácia de precisão com base em listas de rótulos
verdadeiros e nos rótulos previstos.
-Parâmetros:
----
+**Parâmetros**
+
* y_true (``Union[npt.NDArray, list]``): Rótulos verdadeiros (corretos)..
* y_pred (``Union[npt.NDArray, list]``): Rótulos previstos.
-Retornos:
----
+**Retornos**
+
* Precisão (``float``): A proporção de previsões corretas em relação
ao número total de previsões.
-Lança:
----
+**Lança**
+
* ValueError: Se `y_true` ou `y_pred` estiverem vazios ou se não
tiverem o mesmo tamanho.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Multiclass.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Multiclass.md
index b05b1e60..8dc80f3b 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Multiclass.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Multiclass.md
@@ -18,12 +18,12 @@ A função ``slice_index_list_by_class(...)``, separa os índices das linhas con
classe de saída, para percorrer o array de amostra, apenas nas posições que a saída for \
a classe que está sendo treinada.
-Parameters:
----
- * classes (``list or npt.NDArray``): lista com classes únicas.
- * y (npt.NDArray): Recebe um array ``y``[``N amostra``] com as classes de saída do \
- array de amostra ``X``.
-
- Returns:
- ---
- * dict: Um dicionário com a lista de posições do array(``y``), com as classes como chave.
+**Parameters:**
+
+* classes (``list or npt.NDArray``): lista com classes únicas.
+* y (npt.NDArray): Recebe um array ``y``[``N amostra``] com as classes de saída do \
+ array de amostra ``X``.
+
+**Returns:**
+
+* dict: Um dicionário com a lista de posições do array(``y``), com as classes como chave.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Sanitizers.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Sanitizers.md
index 8cc8e741..56be3c29 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Sanitizers.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Sanitizers.md
@@ -15,12 +15,13 @@ def sanitize_choice(value: T, valid_choices: Iterable[T], default: T) -> T
A função ``sanitize_choice(...)``, retorna o valor se estiver presente no conjunto de opções válidas; caso contrário, retorna o valor padrão.
**Parameters:**
+
* ***value*** (``T``): O valor a ser verificado.
* ***valid_choices*** (``Iterable[T]``): Uma coleção de opções válidas.
* ***default***: O valor padrão a ser retornado se ``value`` não estiver em ``valid_choices``.
-
**Returns:**
+
* `T`: O valor original, se válido, ou o valor padrão, se não.
---
@@ -34,12 +35,13 @@ def sanitize_param(value: T, default: T, condition: Callable[[T], bool]) -> T:
A função ``sanitize_param(...)``, retorna o valor se ele satisfizer a condição especificada; caso contrário, retorna o valor padrão.
**Parameters:**
+
* value (``T``): O valor a ser verificado.
* default (``T``): O valor padrão a ser retornado se a condição não for satisfeita.
* condition (``Callable[[T], bool]``): Uma função que recebe um valor e retorna um booleano, determinando se o valor é válido.
-
**Returns:**
+
* `T`: O valor original se a condição for satisfeita, ou o valor padrão se não for.
---
@@ -53,9 +55,11 @@ def sanitize_seed(seed: Any) -> Optional[int]:
A função ``sanitize_param(...)``, retorna a semente se for um inteiro não negativo; caso contrário, retorna Nenhum.
**Parameters:**
+
* seed (``Any``): O valor da seed a ser validado.
**Returns:**
+
* ``Optional[int]``: A seed original se for um inteiro não negativo, ou ``None`` se for inválido.
---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Validation.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Validation.md
index 9d6c23ed..711e2392 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Validation.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/Utils/Validation.md
@@ -7,6 +7,7 @@ def detect_vector_data_type(
vector: npt.NDArray
) -> FeatureType:
```
+
Detecta o tipo de dado em um determinado vetor.
Esta função analisa o vetor de entrada e classifica seus dados como um dos tipos suportados:
@@ -25,4 +26,4 @@ Esta função analisa o vetor de entrada e classifica seus dados como um dos tip
**Lança**
-* `UnsupportedDataTypeError`: Gerado se o vetor contiver um tipo de dado não suportado.
\ No newline at end of file
+* `UnsupportedDataTypeError`: Gerado se o vetor contiver um tipo de dado não suportado.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-classes-reference/csa/airs.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-classes-reference/csa/airs.md
index 73337fa7..0e2c5d23 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-classes-reference/csa/airs.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-classes-reference/csa/airs.md
@@ -25,7 +25,7 @@ A classe base contém funções que são utilizadas por mais de uma classe no pa
---
-### def _check_and_raise_exceptions_fit(...):
+### def _check_and_raise_exceptions_fit(...)
Verifica os parâmetros de ajuste (*fit*) e lança exceções caso a verificação não seja bem-sucedida.
@@ -42,8 +42,8 @@ def _check_and_raise_exceptions_fit(
**Parâmetros**:
-* ***X*** (`npt.NDArray`): Array de treinamento, contendo as amostras e suas características, com formato [`N amostras` (linhas)][`N características` (colunas)].
-* ***y*** (`npt.NDArray`): Array das classes alvo de `X` com [`N amostras` (linhas)].
+* ***X*** (`npt.NDArray`): Array de treinamento, contendo as amostras e suas características, com formato \[`N amostras` (linhas)]\[`N características` (colunas)].
+* ***y*** (`npt.NDArray`): Array das classes alvo de `X` com \[`N amostras` (linhas)].
* ***algorithm*** (`Literal["continuous-features", "binary-features"], opcional`): Especifica o tipo de algoritmo a ser usado, dependendo se os dados de entrada possuem características contínuas ou binárias.
**Exceções**:
@@ -55,7 +55,7 @@ def _check_and_raise_exceptions_fit(
---
-### def _check_and_raise_exceptions_predict(...):
+### def _check_and_raise_exceptions_predict(...)
Verifica os parâmetros de predição e lança exceções caso a verificação não seja bem-sucedida.
@@ -72,7 +72,7 @@ def _check_and_raise_exceptions_predict(
**Parâmetros**:
-* ***X*** (`npt.NDArray`): Array de entrada, contendo as amostras e suas características, com formato [`N amostras` (linhas)][`N características` (colunas)].
+* ***X*** (`npt.NDArray`): Array de entrada, contendo as amostras e suas características, com formato \[`N amostras` (linhas)]\[`N características` (colunas)].
* ***expected*** (`int`): Número esperado de características por amostra (colunas de X).
* ***algorithm*** (`Literal["continuous-features", "binary-features"], opcional`): Especifica o tipo de algoritmo a ser usado, dependendo se os dados de entrada possuem características contínuas ou binárias.
@@ -85,4 +85,4 @@ def _check_and_raise_exceptions_predict(
* `ValueError`:
Se o algoritmo for "binary-features" e X contiver valores que não sejam compostos apenas por 0 e 1.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-classes-reference/ina/ainet.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-classes-reference/ina/ainet.md
index 4814456b..7f6abe70 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-classes-reference/ina/ainet.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-classes-reference/ina/ainet.md
@@ -33,7 +33,7 @@ def _check_and_raise_exceptions_fit(X: npt.NDArray)
**Parâmetros**:
-* ***X*** (`npt.NDArray`): Matriz de treinamento contendo as amostras e suas características, [`N amostras` (linhas)][`N atributos` (colunas)].
+* ***X*** (`npt.NDArray`): Matriz de treinamento contendo as amostras e suas características, \[`N amostras` (linhas)]\[`N atributos` (colunas)].
**Exceções**:
@@ -56,7 +56,7 @@ def _check_and_raise_exceptions_predict(
**Parâmetros**:
-* ***X*** (`npt.NDArray`): Matriz de entrada para predição, contendo as amostras e suas características, [`N amostras` (linhas)][`N atributos` (colunas)].
+* ***X*** (`npt.NDArray`): Matriz de entrada para predição, contendo as amostras e suas características, \[`N amostras` (linhas)]\[`N atributos` (colunas)].
* ***expected*** (`int`, default=0): Número esperado de atributos por amostra (colunas em X).
* ***feature_type*** (`FeatureType`, default="continuous-features"): Especifica o tipo de atributos: `"continuous-features"`, `"binary-features"` ou `"ranged-features"`.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-classes-reference/nsa.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-classes-reference/nsa.md
index 2c2ce233..0d2fc458 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-classes-reference/nsa.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-classes-reference/nsa.md
@@ -21,12 +21,11 @@ keywords:
## ``class BaseNSA(BaseClassifier, ABC)``
-
A classe ``BaseNSA`` contém funções utilitárias com o modificador ``protected`` que podem ser herdadas por várias classes para facilitar o uso. Ela inclui funções para calcular distância, separar dados para melhorar a eficiência de treinamento e previsão, medir precisão e outras funções.
---
-### Funções Protegidas:
+### Funções Protegidas
---
@@ -39,20 +38,21 @@ def _check_and_raise_exceptions_fit(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Função responsável por verificar os parâmetros da função fit e lançar exceções se a verificação não for bem-sucedida.
**Parâmetros**:
-* **X** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, [``N samples`` (linhas)][``N features`` (colunas)].
-* ***y*** (``npt.NDArray``): Array de classes alvo de ``X`` com [``N samples`` (linhas)].
-* ***_class_*** (Literal[RNSA, BNSA], opcional): Classe atual. O padrão é 'RNSA'.
+* **X** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, \[``N samples`` (linhas)\]\[``N features`` (colunas)].
+* ***y*** (``npt.NDArray``): Array de classes alvo de ``X`` com \[``N samples`` (linhas)].
+* ****class**** (Literal[RNSA, BNSA], opcional): Classe atual. O padrão é 'RNSA'.
**Lança:**
+
* ``TypeError``: Se X ou y não forem ndarrays ou tiverem formas incompatíveis.
* ``MaxDiscardsReachedError``: O número máximo de descartes do detector foi atingido durante
a maturação. Verifique o valor do raio definido e considere reduzi-lo.
-
#### def _check_and_raise_exceptions_predict(...)
```python
@@ -62,19 +62,20 @@ def _check_and_raise_exceptions_predict(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Função responsável por verificar os parâmetros da função predict e lançar exceções caso a verificação não seja bem-sucedida.
**Parâmetros**:
-* ***X*** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, [``N samples`` (linhas)][``N features`` (colunas)].
+
+* ***X*** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, \[``N samples`` (linhas)\]\[``N features`` (colunas)].
* ***expected*** (``int``): Número esperado de características por amostra (colunas em X).
-* ***_class_*** (``Literal[RNSA, BNSA], opcional``): Classe atual. O padrão é 'RNSA'.
+* ****class**** (``Literal[RNSA, BNSA], opcional``): Classe atual. O padrão é 'RNSA'.
**Lança:**
+
* ``TypeError``: Se X ou y não forem ndarrays ou tiverem formas incompatíveis.
* ``MaxDiscardsReachedError``: O número máximo de descartes do detector foi atingido durante
a maturação. Verifique o valor do raio definido e considere reduzi-lo.
-
-
---
## ``Class Detector``
@@ -84,4 +85,4 @@ Representa um detector não-próprio do class RNSA.
**Atributos:**
* ***position*** (``np.ndarray``): Vetor de características do detector.
-* ***radius*** (``float, opcional``): Raio do detector, utilizado no algoritmo V-detector.
\ No newline at end of file
+* ***radius*** (``float, opcional``): Raio do detector, utilizado no algoritmo V-detector.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-module/Base.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-module/Base.md
index d5bbb313..dc887ed5 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-module/Base.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-module/Base.md
@@ -67,4 +67,4 @@ Define a semente para números aleatórios usados por funções compiladas com N
**Parâmetros**:
-* **seed**: `int` - Valor inteiro usado para inicializar o gerador de números aleatórios do Numba.
\ No newline at end of file
+* **seed**: `int` - Valor inteiro usado para inicializar o gerador de números aleatórios do Numba.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-module/Classifier.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-module/Classifier.md
index 43198b20..eef99a11 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-module/Classifier.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-module/Classifier.md
@@ -1,21 +1,19 @@
---
sidebar_position: 1
-title: Classification
sidebar_label: BaseClassifier
last_update:
date: 2025/05/17
author: João Paulo
---
-# Classe base para algoritmo de classificação.
+# Classe base para algoritmo de classificação
-## ``class BaseClassifier(ABC)``:
+## ``class BaseClassifier(ABC)``
Classe base para algoritmos de classificação, definindo os métodos abstratos ``fit`` e ``predict``, e implementando o método ``get_params``.
## Abstract methods
-
### def fit(...)
```python
@@ -26,9 +24,9 @@ Ajusta o modelo aos dados de treinamento.
Implementação:
-- [RNSA](/docs/aisp-techniques/negative-selection/rnsa#Função-fit)
-- [BNSA](/docs/aisp-techniques/negative-selection/bnsa#Função-fit)
-- [AIRS](/docs/aisp-techniques/clonal-selection-algorithms/airs/#Método-fit)
+- [RNSA](../../aisp-techniques/negative-selection/RNSA.md#Função-fit)
+- [BNSA](../../aisp-techniques/negative-selection/BNSA.md#Função-fit)
+- [AIRS](../../aisp-techniques/clonal-selection-algorithms/airs/#Método-fit)
### def predict(...)
@@ -40,9 +38,9 @@ Realiza a previsão dos rótulos para os dados fornecidos.
Implementação:
-- [RNSA](/docs/aisp-techniques/negative-selection/rnsa#Função-predict)
-- [BNSA](/docs/aisp-techniques/negative-selection/bnsa#Função-predict)
-- [AIRS](/docs/aisp-techniques/clonal-selection-algorithms/airs/#Método-predict)
+- [RNSA](../../aisp-techniques/negative-selection/RNSA.md#Função-predict)
+- [BNSA](../../aisp-techniques/negative-selection/BNSA.md#Função-predict)
+- [AIRS](../../aisp-techniques/clonal-selection-algorithms/airs/#Método-predict)
---
@@ -56,23 +54,24 @@ def score(self, X: npt.NDArray, y: list) -> float
A função de pontuação (score) calcula a precisão da previsão.
-Esta função realiza a previsão de X e verifica quantos elementos são iguais entre o vetor y e y_predicted.
+Esta função realiza a previsão de X e verifica quantos elementos são iguais entre o vetor y e y_predicted.
Esta função foi adicionada para compatibilidade com algumas funções do scikit-learn.
**Parâmetros**:
-+ ***X***: np.ndarray
+
+- ***X***: np.ndarray
Conjunto de características com formato (n_amostras, n_características).
-+ ***y***: np.ndarray
+- ***y***: np.ndarray
Valores verdadeiros com formato (n_amostras,).
**Retorna**:
-+ precisão: float
+- precisão: float
A precisão do modelo.
---
-### Método _slice_index_list_by_class(...):
+### Método _slice_index_list_by_class(...)
A função ``_slice_index_list_by_class(...)``, separa os índices das linhas conforme a classe de saída, para percorrer o array de amostra, apenas nas posições que a saída for a classe que está sendo treinada:
@@ -89,6 +88,7 @@ Retorna um dicionário com as classes como chave e os índices em ``X`` das amos
```python
def get_params(self, deep: bool = True) -> dict:
```
+
A função get_params retorna um dicionário com os parâmetros principais do objeto.
Esta função é necessária para garantir a compatibilidade com as funções do scikit-learn.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-module/Clusterer.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-module/Clusterer.md
index 08294154..ced74add 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-module/Clusterer.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-module/Clusterer.md
@@ -19,6 +19,7 @@ keywords:
---
## ``BaseClusterer(ABC, Base)``
+
Classe base abstrata para algoritmos de clustering.
Esta classe define a interface central para modelos de agrupamento. Ela exige
@@ -47,7 +48,7 @@ Este método abstrato deve ser implementado pelas subclasses.
**Implementação**:
-* [AiNet](/docs/aisp-techniques/immune-network-theory/ainet#Função-fit)
+* [AiNet](../../aisp-techniques/immune-network-theory/AiNet.md#Função-fit)
---
@@ -70,7 +71,7 @@ Este método abstrato deve ser implementado pelas subclasses.
**Implementação**:
-* [AiNet](/docs/aisp-techniques/immune-network-theory/ainet#Função-predict)
+* [AiNet](../../aisp-techniques/immune-network-theory/AiNet.md#Função-predict)
---
@@ -89,4 +90,4 @@ Método de conveniência que combina `fit` e `predict` em uma única chamada.
**Retorna**:
-* ***predictions***: `Optional[npt.NDArray]` - Rótulos previstos dos clusters para cada amostra de entrada, ou `None` caso a previsão não seja possível.
\ No newline at end of file
+* ***predictions***: `Optional[npt.NDArray]` - Rótulos previstos dos clusters para cada amostra de entrada, ou `None` caso a previsão não seja possível.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-module/Mutation.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-module/Mutation.md
index 470b73e9..4eaef904 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-module/Mutation.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/advanced-guides/base-module/Mutation.md
@@ -17,8 +17,6 @@ keywords:
- Mutação Vetorial
---
-# Mutation
-
Contém funções que geram conjuntos de clones mutados a partir de vetores contínuos ou binários, simulando o processo de expansão clonal em sistemas imunológicos artificiais.
## clone_and_mutate_continuous
@@ -69,7 +67,6 @@ Esta função cria `n` clones do vetor binário de entrada e aplica mutações a
* `clone_set` (`npt.NDArray[np.bool_]`): Array com forma `(n, len(vector))` contendo os `n` clones mutados do vetor original.
-
---
## clone_and_mutate_ranged
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/clonal-selection-algorithms/Cell.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/clonal-selection-algorithms/Cell.md
index 0b6cfa6c..61d70cf4 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/clonal-selection-algorithms/Cell.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/clonal-selection-algorithms/Cell.md
@@ -1,6 +1,5 @@
---
id: cell
-title: Célula-B de Memória
sidebar_label: Célula-B de Memória
sidebar_position: 2
pagination_next: null
@@ -21,16 +20,15 @@ author: João Paulo
Representa uma célula-B de memória.
-### Construtor:
+## Construtor
Parâmetros:
* **vector** (`npt.NDArray`): Vetor de características da célula. Padrão é None.
-
---
-### Função hyper_clonal_mutate(...):
+## Função hyper_clonal_mutate(...)
Parâmetros:
@@ -51,4 +49,4 @@ def hyper_clonal_mutate(
) -> npt.NDArray
```
-Retorna um array contendo N vetores mutados a partir da célula original.
\ No newline at end of file
+Retorna um array contendo N vetores mutados a partir da célula original.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/clonal-selection-algorithms/airs/README.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/clonal-selection-algorithms/airs/README.md
index 4fa2e67f..02a88ed2 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/clonal-selection-algorithms/airs/README.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/clonal-selection-algorithms/airs/README.md
@@ -16,7 +16,6 @@ author: João Paulo
O ``AIRS`` é um algoritmo de classificação inspirado no processo de seleção clonal. A versão implementada nesta classe é inspirada na sua versão simplificada, o AIRS2, descrito em[Brabazon, O'Neill, and McGarraghy (2015)](#1)
-
Esta implementação é inspirada no AIRS2, uma versão simplificada do algoritmo AIRS original, introduzindo adaptações para lidar com conjuntos de dados contínuos e binários.
Com base no algoritmo 16.5 de Brabazon et al. [1](#1).
@@ -33,46 +32,46 @@ Com base no algoritmo 16.5 de Brabazon et al. [1](#1).
:::
-## Construtor AIRS:
+## Construtor AIRS
A classe `AIRS` tem como objetivo realizar classificação utilizando metáforas de seleção e expansão clonal.
**Atributos:**
-* **n_resources** (`float`): Quantidade total de recursos disponíveis. O padrão é 10.
+- **n_resources** (`float`): Quantidade total de recursos disponíveis. O padrão é 10.
-* **rate_clonal** (`float`): Número máximo de clones possíveis de uma classe. Esta quantidade é multiplicada por (estímulo da célula * taxa de hipermutação) para definir o número de clones. O padrão é 10.
+- **rate_clonal** (`float`): Número máximo de clones possíveis de uma classe. Esta quantidade é multiplicada por (estímulo da célula * taxa de hipermutação) para definir o número de clones. O padrão é 10.
-* **rate_hypermutation** (`int`): Taxa de clones mutados derivada de rate_clonal como um fator escalar. O padrão é 0,75.
+- **rate_hypermutation** (`int`): Taxa de clones mutados derivada de rate_clonal como um fator escalar. O padrão é 0,75.
-* **affinity_threshold_scalar** (`float`): Limiar de afinidade normalizado. O padrão é 0,75.
+- **affinity_threshold_scalar** (`float`): Limiar de afinidade normalizado. O padrão é 0,75.
-* **k** (`int`): Número de vizinhos mais próximos (k-NN) que será usado para escolher um rótulo na predição. O padrão é 10.
+- **k** (`int`): Número de vizinhos mais próximos (k-NN) que será usado para escolher um rótulo na predição. O padrão é 10.
-* **max_iters** (`int`): Número máximo de interações no processo de refinamento do conjunto ARB exposto a aᵢ. O padrão é 100.
+- **max_iters** (`int`): Número máximo de interações no processo de refinamento do conjunto ARB exposto a aᵢ. O padrão é 100.
-* **resource_amplified** (`float`): Amplificador de consumo de recursos, multiplicado com o estímulo para subtrair recursos. O padrão é 1.0 (sem amplificação).
+- **resource_amplified** (`float`): Amplificador de consumo de recursos, multiplicado com o estímulo para subtrair recursos. O padrão é 1.0 (sem amplificação).
-* **metric** (Literal["manhattan", "minkowski", "euclidean"]): Forma de calcular a distância entre o detector e a amostra:
+- **metric** (Literal["manhattan", "minkowski", "euclidean"]): Forma de calcular a distância entre o detector e a amostra:
- * ``'euclidiana'`` ➜ O cálculo da distância dá-se pela expressão: $$\sqrt{(X_1 - X_1)^2 + (Y_2 - Y_2)^2 + ... + (Y_n - Y_n)^2}$$.
- * ``'minkowski'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - Y_1|^p + |X_2 - Y_2|^p + ... |X_n - Y_n|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - X_1| + |Y_2 - Y_2| + ... + |Y_n - Y_n|)$$.
+ - ``'euclidiana'`` ➜ O cálculo da distância dá-se pela expressão: $$\sqrt{(X_1 - X_1)^2 + (Y_2 - Y_2)^2 + ... + (Y_n - Y_n)^2}$$.
+ - ``'minkowski'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - Y_1|^p + |X_2 - Y_2|^p + ... |X_n - Y_n|^p)^\frac{1}{p}$$.
+ - ``'manhattan'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - X_1| + |Y_2 - Y_2| + ... + |Y_n - Y_n|)$$.
Defaults to ``'euclidean'``.
-* **seed** (``Optional[int]``): Semente para geração aleatória de valores dos detectores. O padrão é None.
+- **seed** (``Optional[int]``): Semente para geração aleatória de valores dos detectores. O padrão é None.
- `**kwargs`:
- * **p** (`float`): Este parâmetro armazena o valor de `p` usado na distância de Minkowski.
+ - **p** (`float`): Este parâmetro armazena o valor de `p` usado na distância de Minkowski.
O padrão é `2`, que corresponde à distância euclidiana normalizada. Diferentes valores de p resultam em variantes distintas da distância de Minkowski. [Saiba mais](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
**Outras variáveis inicializadas:**
-* **cells_memory** (`dict`): Armazena uma lista de células de memória por classe.
-* **affinity_threshold** (`dict`): Define o limiar de afinidade entre antígenos.
-* **classes** (`npt.NDArray`): Lista de classes de saída.
+- **cells_memory** (`dict`): Armazena uma lista de células de memória por classe.
+- **affinity_threshold** (`dict`): Define o limiar de afinidade entre antígenos.
+- **classes** (`npt.NDArray`): Lista de classes de saída.
---
@@ -90,9 +89,9 @@ Realiza o treinamento conforme `X` e `y`, utilizando o método Sistema de Reconh
**Parâmetros de entrada:**
-* **X**: Array com as características das amostras, com **N** amostras (linhas) e **N** características (colunas), normalizado para valores entre [0, 1].
-* **y**: Array com as classes de saída correspondentes às **N** amostras relacionadas a `X`.
-* **verbose**: Booleano, padrão `True`, determina se o feedback da geração dos detectores será impresso.
+- **X**: Array com as características das amostras, com **N** amostras (linhas) e **N** características (colunas), normalizado para valores entre [0, 1].
+- **y**: Array com as classes de saída correspondentes às **N** amostras relacionadas a `X`.
+- **verbose**: Booleano, padrão `True`, determina se o feedback da geração dos detectores será impresso.
*Retorna a instância da classe.*
@@ -108,16 +107,16 @@ def predict(self, X: npt.NDArray) -> npt.NDArray:
**Parâmetro de entrada:**
-* **X**: Array com as características para predição, com **N** amostras (linhas) e **N** colunas.
+- **X**: Array com as características para predição, com **N** amostras (linhas) e **N** colunas.
**Retorna:**
-* **C**: Um array de predições com as classes de saída para as características fornecidas.
-* **None**: Se não houver detectores.
+- **C**: Um array de predições com as classes de saída para as características fornecidas.
+- **None**: Se não houver detectores.
---
-### Método score(...):
+### Método score(...)
A função `score(...)` calcula a acurácia do modelo treinado realizando predições e calculando a precisão.
@@ -131,14 +130,14 @@ Retorna a acurácia como um `float`.
## Métodos Privados
-### Método _refinement_arb(...):
+### Método _refinement_arb(...)
A função "_refinement_arb(...)" refina o conjunto ARB até que o valor médio de estímulo ultrapasse o limiar definido (`affinity_threshold_scalar`).
Parâmetros:
-* **c_match** (`Cell`): Célula com o maior estímulo em relação a aᵢ.
-* **arb_list** (`List[_ARB]`): Conjunto ARB.
+- **c_match** (`Cell`): Célula com o maior estímulo em relação a aᵢ.
+- **arb_list** (`List[_ARB]`): Conjunto ARB.
```python
def _refinement_arb(self, ai: npt.NDArray, c_match: Cell, arb_list: List[_ARB]) -> _ARB:
@@ -148,7 +147,7 @@ Retorna a célula (_ARB) com o maior estímulo ARB.
---
-### Método _cells_affinity_threshold(...):
+### Método _cells_affinity_threshold(...)
A função "_cells_affinity_threshold(...)" calcula o limiar de afinidade com base na afinidade média entre instâncias de treinamento, onde aᵢ e aⱼ são um par de antígenos, e a afinidade é medida pela distância (Euclidiana, Manhattan, Minkowski, Hamming).
**Seguindo a fórmula:**
@@ -160,7 +159,7 @@ $$
Parâmetros:
-* **antigens_list** (`NDArray`): Lista de antígenos de treinamento.
+- **antigens_list** (`NDArray`): Lista de antígenos de treinamento.
```python
def _cells_affinity_threshold(self, antigens_list: npt.NDArray):
@@ -168,14 +167,14 @@ def _cells_affinity_threshold(self, antigens_list: npt.NDArray):
---
-### Método _affinity(...):
+### Método _affinity(...)
A função "_affinity(...)" calcula o estímulo entre dois vetores usando métricas.
Parâmetros:
-* **u** (`npt.NDArray`): Coordenadas do primeiro ponto.
-* **v** (`npt.NDArray`): Coordenadas do segundo ponto.
+- **u** (`npt.NDArray`): Coordenadas do primeiro ponto.
+- **v** (`npt.NDArray`): Coordenadas do segundo ponto.
```python
def _affinity(self, u: npt.NDArray, v: npt.NDArray) -> float:
@@ -185,13 +184,13 @@ Retorna a taxa de estímulo entre os vetores.
---
-### Método _init_memory_c(...):
+### Método _init_memory_c(...)
A função "_init_memory_c(...)" inicializa células de memória selecionando aleatoriamente `n_antigens_selected` da lista de antígenos de treinamento.
Parâmetros:
-* **antigens_list** (`NDArray`): Lista de antígenos de treinamento.
+- **antigens_list** (`NDArray`): Lista de antígenos de treinamento.
```python
def _init_memory_c(self, antigens_list: npt.NDArray) -> List[Cell]:
@@ -199,10 +198,10 @@ def _init_memory_c(self, antigens_list: npt.NDArray) -> List[Cell]:
---
-
-# Referências
+## Referências
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
\ No newline at end of file
+### 1
+>
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/clonal-selection-algorithms/airs/abr.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/clonal-selection-algorithms/airs/abr.md
index 86b9ce7e..949c9a47 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/clonal-selection-algorithms/airs/abr.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/clonal-selection-algorithms/airs/abr.md
@@ -25,16 +25,18 @@ Individuo do conjunto de células reconhecedoras (ABR), herda características d
:::
-### Constructor:
+### Constructor
Parameters:
+
* vector (``npt.NDArray``): A feature vector of the cell. Defaults to None.
---
-### Function consume_resource(...):
+### Function consume_resource(...)
Parameters:
+
* n_resource (```float```) : The initial amount of resources.
* amplified (``float``): Amplifier for resource consumption by the cell. It is multiplied by the cell's stimulus. The default value is 1.
@@ -43,4 +45,3 @@ def consume_resource(self, n_resource: float, amplified: float = 1) -> float:
```
Returns the remaining amount of resources after consumption.
-
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/clonal-selection-algorithms/clonalg.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/clonal-selection-algorithms/clonalg.md
index 6415eb11..94e2ee23 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/clonal-selection-algorithms/clonalg.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/clonal-selection-algorithms/clonalg.md
@@ -17,11 +17,10 @@ keywords:
A classe `Clonalg` é um **algoritmo de otimização** inspirado no processo biológico de seleção clonal do sistema imunológico. Esta implementação é projetada para minimizar ou maximizar funções de custo em diversos tipos de problemas, incluindo problemas binários, contínuos, com valores limitados (ranged) e de permutação.
-:::info
+:::tip
A implementação do CLONALG foi inspirada na descrição apresentada em [1](#1).
:::
-
:::info
Esta implementação do CLONALG contém algumas alterações baseadas no contexto do AISP, para aplicação geral
a diversos problemas, que podem produzir resultados diferentes da implementação padrão ou
@@ -178,9 +177,10 @@ Clona e aplica hipermutação a uma população de anticorpos. Retorna uma lista
---
-# Referências
+## Referências
---
-##### 1
-> BROWNLEE, Jason. Clonal Selection Algorithm. Clever Algorithms: Nature-inspired Programming Recipes., 2011. Available at: https://cleveralgorithms.com/nature-inspired/immune/clonal_selection_algorithm.html
\ No newline at end of file
+### 1
+>
+> BROWNLEE, Jason. Clonal Selection Algorithm. Clever Algorithms: Nature-inspired Programming Recipes., 2011. Available at: [https://cleveralgorithms.com/nature-inspired/immune/clonal_selection_algorithm.html](https://cleveralgorithms.com/nature-inspired/immune/clonal_selection_algorithm.html)
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/immune-network-theory/AiNet.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/immune-network-theory/AiNet.md
index eb81833b..19be65a0 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/immune-network-theory/AiNet.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/immune-network-theory/AiNet.md
@@ -1,6 +1,5 @@
---
id: ainet
-title: AiNet
sidebar_label: AiNet - Agrupamento e Compressão
sidebar_position: 1
pagination_next: null
@@ -28,24 +27,23 @@ lastUpdatedAt: 2025/08/19
author: João Paulo
---
-# AiNet - Rede Imunológica Artificial para Agrupamento e Compressão.
+# AiNet - Rede Imunológica Artificial para Agrupamento e Compressão
A classe AiNet tem como objetivo realizar agrupamento utilizando metáforas inspiradas na teoria da rede imunológica.
-A classe AiNet implementa o algoritmo de Rede Imune Artificial para compressão e clustering. Ela utiliza princípios da teoria de redes imunes,
-seleção clonal e maturação por afinidade para comprimir conjuntos de dados e encontrar clusters [1](#1).
+A classe AiNet implementa o algoritmo de Rede Imune Artificial para compressão e clustering. Ela utiliza princípios da teoria de redes imunes,
+seleção clonal e maturação por afinidade para comprimir conjuntos de dados e encontrar clusters [1](#1).
Para clustering, pode opcionalmente utilizar uma [**Árvore Geradora Mínima**
(MST)](#2) para separar nós distantes em grupos.
:::info
-**``AiNet``** estende a **[classe ``BaseAiNet``](/docs/advanced-guides/base-classes-reference/ina/ainet)**, herdando sua funcionalidade básica.
+**``AiNet``** estende a **[classe ``BaseAiNet``](../../advanced-guides/base-classes-reference/ina/ainet.md)**, herdando sua funcionalidade básica.
:::
## Constructor
-
```python
class AiNet(
self,
@@ -78,18 +76,17 @@ class AiNet(
* **k** (`int`): Número de vizinhos mais próximos usados para predição de rótulos. Padrão: 3.
* **metric** (Literal["manhattan", "minkowski", "euclidean"]): Forma de calcular a distância entre o detector e a amostra:
- * `'euclidean'` ➜ Distância dada pela expressão:
- $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + ... + (Y_{n} - Y_{n})^2}$$
- * ``'minkowski'`` ➜ Distância dada pela expressão:
- $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + ... |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ Distância dada pela expressão: $$( |X_{1} - X_{1}| + |Y_{2} - Y_{2}| + ... + |Y_{n} - Y_{n}|)$$.
+ * `'euclidean'` ➜ Distância dada pela expressão:
+ $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$
+ * ``'minkowski'`` ➜ Distância dada pela expressão:
+ $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
+ * ``'manhattan'`` ➜ Distância dada pela expressão: $$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$.
Padrão: **"Euclidean"**.
* **seed** (`Optional[int]`): Semente para geração de números aleatórios. Padrão: None.
* **use_mst_clustering** (`bool`): Define se o clustering baseado em MST deve ser utilizado. Padrão: True.
* **kwargs**:
-
* **p** (`float`): Parâmetro para distância de Minkowski. Padrão: 2.
**Outras variáveis inicializadas:**
@@ -310,12 +307,14 @@ def _build_mst(self):
---
-# Referências
+## Referências
-##### 1
+### 1
+>
> 1. De Castro, Leandro & José, Fernando & von Zuben, Antonio Augusto. (2001). aiNet: An Artificial Immune Network for Data Analysis.
> Disponível em: [https://www.researchgate.net/publication/228378350_aiNet_An_Artificial_Immune_Network_for_Data_Analysis](https://www.researchgate.net/publication/228378350_aiNet_An_Artificial_Immune_Network_for_Data_Analysis)
-##### 2
+### 2
+>
> 2. SciPy Documentation. *Minimum Spanning Tree*.
-> Disponível em: [https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree)
\ No newline at end of file
+> Disponível em: [https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree)
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/immune-network-theory/README.mdx b/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/immune-network-theory/README.mdx
index 66359b3c..cfa989ea 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/immune-network-theory/README.mdx
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/immune-network-theory/README.mdx
@@ -31,9 +31,9 @@ A Rede Imunológica Artificial pode ser aplicada em diferentes contextos, tais c
-# References
+## References
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
+### 1
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/negative-selection/BNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/negative-selection/BNSA.md
index 7bfa36a9..803f1022 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/negative-selection/BNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/negative-selection/BNSA.md
@@ -1,6 +1,5 @@
---
id: bnsa
-title: BNSA
sidebar_label: BNSA - Algoritmo de Seleção Negativa Binária
sidebar_position: 2
pagination_next: null
@@ -20,9 +19,9 @@ keywords:
- Computação Natural
---
-# BNSA (Algoritmo de Seleção Negativa Binária).
+# BNSA (Algoritmo de Seleção Negativa Binária)
-A classe ``BNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
+A classe ``BNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
```python
class BNSA(
@@ -36,18 +35,20 @@ class BNSA(
```
**Attributes:**
+
* *N* (``int``): Quantidade de detectores. Defaults to ``100``.
* *aff_thresh* (``float``): A variável ('affinity threshold') representa a porcentagem de não similaridade entre a célula T e as amostras próprias. O valor padrão é de 10% (0,1), enquanto que o valor de 1,0 representa 100% de não similaridade.
+
:::note
Definir uma porcentagem de diferença muito alta pode resultar na incapacidade de gerar detectores para não-próprio.
:::
-* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
+* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
possível loop infinito caso seja definido um raio que não seja possível gerar detectores do não-próprio. Defaults to ``1000``.
* *seed* (``int``): Semente para a geração randômica dos valores nos detectores. Defaults to ``None``.
* no_label_sample_selection (``str``): Método para a seleção de rótulos para amostras designadas como não pertencentes por todos os detectores não pertencentes. **Tipos de métodos disponíveis:**
- - (``max_average_difference``): Seleciona a classe com a maior diferença média entre os detectores.
- - (``max_nearest_difference``): Seleciona a classe com a maior diferença entre o detector mais próximo e mais distante da amostra.
+ * (``max_average_difference``): Seleciona a classe com a maior diferença média entre os detectores.
+ * (``max_nearest_difference``): Seleciona a classe com a maior diferença entre o detector mais próximo e mais distante da amostra.
**Outras variáveis iniciadas:**
@@ -57,17 +58,19 @@ possível loop infinito caso seja definido um raio que não seja possível gerar
---
-### Função fit(...)
+## Função fit(...)
A função ``fit(...)`` gera os detectores para os não próprios com relação às amostras:
```python
def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
```
+
Nela é realizado o treinamento de acordo com ``X`` e ``y``, usando o método de seleção negativa(``NegativeSelect``).
**Os parâmetros de entrada são:**
-* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
+
+* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
* ``y``: array com as classes de saídas disposto em **N** amostras que são relacionadas ao ``X``.
* ``verbose``: boolean com valor padrão ``True``, determina se o feedback da geração dos detectores será impresso.
@@ -75,7 +78,7 @@ Nela é realizado o treinamento de acordo com ``X`` e ``y``, usando o método de
---
-### Função predict(...)
+## Função predict(...)
A função ``predict(...)`` realiza a previsão das classes utilizando os detectores gerados:
@@ -84,16 +87,17 @@ def predict(self, X: npt.NDArray) -> npt.NDArray:
```
**O parâmetro de entrada:**
-
+
* ``X``: array com as características para a previsão, com **N** amostras (Linhas) e **N** colunas.
-**Retorna:**
-* ``C``: Um array de previsão com as classes de saída para as características informadas.
+**Retorna:**
+
+* ``C``: Um array de previsão com as classes de saída para as características informadas.
* ``None``: se não houver detectores.
---
-### Função score(...)
+## Função score(...)
A função "score(...)" calcula a precisão do modelo treinado por meio da realização de previsões e do cálculo da acurácia.
@@ -109,7 +113,7 @@ retorna a acurácia, do tipo ``float``.
---
-### Função __slice_index_list_by_class(...)
+## Função __slice_index_list_by_class(...)
A função ``__slice_index_list_by_class(...)``, separa os índices das linhas conforme a classe de saída, para percorrer o array de amostra, apenas nas posições que a saída for a classe que está sendo treinada:
@@ -119,4 +123,4 @@ def __slice_index_list_by_class(self, y: npt.NDArray) -> dict:
Retorna um dicionario com as classes como chave e os índices em ``X`` das amostras.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/negative-selection/README.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/negative-selection/README.md
index 4e2d9448..610f032b 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/negative-selection/README.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/negative-selection/README.md
@@ -8,30 +8,37 @@ A **seleção negativa** é o processo em que o sistema imunológico faz a matur
---
-# classes
+## classes
> 1. **[Binary version:](BNSA.md)**
+>
>> O algoritmo binário adaptado para múltiplas classes neste projeto tem como base a versão proposta por [Forrest et al. (1994)](#2), originalmente desenvolvida para segurança computacional.
>>> **Exemplo:**
+>>>
>>> + [Base de dados Mushrooms](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/BNSA/mushrooms_dataBase_example_pt-br.ipynb)
> 2. **[Real-Valued version:](RNSA.md)**
+>
>>Este algoritmo possui duas versões diferentes: uma baseada na versão canônica [[1]](#1) e outra com detectores de raio variável [[3]](#3). Ambas estão adaptadas para trabalhar com múltiplas classes e possuem métodos para previsão de dados presentes na região não-self de todos os detectores e classes.
>>> **Exemplos:**
->>> + [Base de dados Iris](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/iris_dataBase_example_pt-br.ipynb)
->>> + [Base de dados Geyser](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/geyser_dataBase_example_pt-br.ipynb)
+>>>
+>>> + [Base de dados Iris](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/iris_dataBase_example_pt-br.ipynb)
+>>> + [Base de dados Geyser](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/geyser_dataBase_example_pt-br.ipynb)
-# References
+## References
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
+### 1
+>
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
-##### 2
-> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: http://dx.doi.org/10.1109/RISP.1994.296580.
+### 2
+>
+> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: [https://dx.doi.org/10.1109/RISP.1994.296580](https://dx.doi.org/10.1109/RISP.1994.296580).
-##### 3
-> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: http://dx.doi.org/10.1007/978-3-540-24854-5_30.
+### 3
+>
+> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: [https://dx.doi.org/10.1007/978-3-540-24854-5_30](https://dx.doi.org/10.1007/978-3-540-24854-5_30).
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/negative-selection/RNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/negative-selection/RNSA.md
index b98833aa..8d97e90a 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/negative-selection/RNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/aisp-techniques/negative-selection/RNSA.md
@@ -1,6 +1,5 @@
---
id: rnsa
-title: RNSA
sidebar_label: RNSA - Algoritmo de Seleção Negativa de Valor Real
sidebar_position: 1
last_update:
@@ -21,9 +20,9 @@ keywords:
# RNSA (Algoritmo de Seleção Negativa de Valor Real)
-## Construtor RNSA:
+## Construtor RNSA
-A classe ``RNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
+A classe ``RNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
```python
class RNSA(
@@ -44,39 +43,39 @@ class RNSA(
* *N* (``int``): Quantidade de detectores. Defaults to ``100``.
* *r* (``float``): Raio do detector. Defaults to ``0.05``.
+
:::note
É importante considerar que definir um raio muito baixo para o detector pode reduzir significativamente a taxa de detecção. Por outro lado, um raio muito grande pode inviabilizar a incorporação do detector no espaço de busca, o que também pode comprometer o desempenho da detecção. É fundamental encontrar um equilíbrio entre o tamanho do raio e a eficiência da detecção para obter os melhores resultados possíveis.
:::
-
* *k* (``int``): Quantidade de vizinhos próximos dos detectores gerados aleatoriamente para efetuar o cálculo da média da distância. Defaults to ``1``.
-* *metric* (``str``): Forma para se calcular a distância entre o detector e a amostra:
-
- * ``'euclidiana'`` ➜ O cálculo da distância dá-se pela expressão: $$\sqrt{(X_1 - X_1)^2 + (Y_2 - Y_2)^2 + ... + (Y_n - Y_n)^2}$$.
- * ``'minkowski'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - Y_1|^p + |X_2 - Y_2|^p + ... |X_n - Y_n|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - X_1| + |Y_2 - Y_2| + ... + |Y_n - Y_n|)$$.
+* *metric* (``str``): Forma para se calcular a distância entre o detector e a amostra:
+
+ * ``'euclidiana'`` ➜ O cálculo da distância dá-se pela expressão: $$\sqrt{(X_1 - X_1)^2 + (Y_2 - Y_2)^2 + ... + (Y_n - Y_n)^2}$$.
+ * ``'minkowski'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - Y_1|^p + |X_2 - Y_2|^p + ... |X_n - Y_n|^p)^\frac{1}{p}$$.
+ * ``'manhattan'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - X_1| + |Y_2 - Y_2| + ... + |Y_n - Y_n|)$$.
Defaults to ``'euclidean'``.
-* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
+* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
possível loop infinito caso seja definido um raio que não seja possível gerar detectores do não-próprio. Defaults to ``1000``.
* *seed* (``int``): Semente para a geração randômica dos valores nos detectores. Defaults to ``None``.
* *algorithm* (``str``), Definir a versão do algoritmo:
- * ``'default-NSA'``: Algoritmo padrão com raio fixo.
- * ``'V-detector'``: Este algoritmo é baseado no artigo "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", de autoria de Ji, Z., Dasgupta, D. (2004), e utiliza um raio variável para a detecção de anomalias em espaços de características.
+ * ``'default-NSA'``: Algoritmo padrão com raio fixo.
+ * ``'V-detector'``: Este algoritmo é baseado no artigo "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", de autoria de Ji, Z., Dasgupta, D. (2004), e utiliza um raio variável para a detecção de anomalias em espaços de características.
Defaults to ``'default-NSA'``.
* *r_s* (``float``): O valor de ``rₛ`` é o raio das amostras próprias da matriz ``X``.
-- ``**kwargs``:
- - *non_self_label* (``str``): Esta variável armazena o rótulo que será atribuído quando os dados possuírem
+
+* ``**kwargs``:
+ * *non_self_label* (``str``): Esta variável armazena o rótulo que será atribuído quando os dados possuírem
apenas uma classe de saída, e a amostra for classificada como não pertencente a essa classe. Defaults to ``'non-self'``.
-
- - *cell_bounds* (``bool``): Se definido como ``True``, esta opção limita a geração dos detectores ao espaço do plano compreendido entre 0 e 1. Isso significa que qualquer detector cujo raio ultrapasse esse limite é descartado, e esta variável é usada exclusivamente no algoritmo ``V-detector``.
- - p (``float``): Este parâmetro armazena o valor de ``p`` utilizada na distância de Minkowski. O padrão é ``2``, o que significa distância euclidiana normalizada. Diferentes valores de p levam a diferentes variantes da distância de Minkowski [saiba mais](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
-
+
+ * *cell_bounds* (``bool``): Se definido como ``True``, esta opção limita a geração dos detectores ao espaço do plano compreendido entre 0 e 1. Isso significa que qualquer detector cujo raio ultrapasse esse limite é descartado, e esta variável é usada exclusivamente no algoritmo ``V-detector``.
+ * p (``float``): Este parâmetro armazena o valor de ``p`` utilizada na distância de Minkowski. O padrão é ``2``, o que significa distância euclidiana normalizada. Diferentes valores de p levam a diferentes variantes da distância de Minkowski [saiba mais](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
**Outras variáveis iniciadas:**
@@ -93,10 +92,12 @@ A função ``fit(...)`` gera os detectores para os não próprios com relação
```python
def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
```
+
Nela é realizado o treinamento de acordo com ``X`` e ``y``, usando o método de seleção negativa(``NegativeSelect``).
**Os parâmetros de entrada são:**
-* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
+
+* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
* ``y``: array com as classes de saídas disposto em **N** amostras que são relacionadas ao ``X``.
* ``verbose``: boolean com valor padrão ``True``, determina se o feedback da geração dos detectores será impresso.
@@ -113,11 +114,12 @@ def predict(self, X: npt.NDArray) -> npt.NDArray:
```
**O parâmetro de entrada:**
-
+
* ``X``: array com as características para a previsão, com **N** amostras (Linhas) e **N** colunas.
-**Retorna:**
-* ``C``: Um array de previsão com as classes de saída para as características informadas.
+**Retorna:**
+
+* ``C``: Um array de previsão com as classes de saída para as características informadas.
* ``None``: se não houver detectores.
---
@@ -147,9 +149,10 @@ def __checks_valid_detector(self, X: npt.NDArray, vector_x: npt.NDArray, samples
```
**Os parâmetros de entrada são:**
+
* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
-* ``vector_x``: Detector candidato gerado aleatoriamente.
+* ``vector_x``: Detector candidato gerado aleatoriamente.
* ``samplesIndexClass``: Array com os indexes de uma classe.
@@ -173,14 +176,14 @@ def __compare_KnearestNeighbors_List(self, knn: npt.NDArray, distance: float) ->
Função para comparar uma amostra com os detectores, verificando se a amostra é própria.
-
Nesta função, quando possui ambiguidade de classes, retorna a classe que possuir a média de distância maior entre os detectores.
**Os parâmetros de entrada são:**
+
* line: vetor com N-características
**Retorna:** A classe prevista com os detectores ou None se a amostra não se qualificar a nenhuma classe.
-
+
---
### Função __detector_is_valid_to_Vdetector(...)
@@ -227,4 +230,4 @@ def __slice_index_list_by_class(self, y: npt.NDArray) -> dict:
Retorna um dicionario com as classes como chave e os índices em ``X`` das amostras.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/examples/Classification/csa.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/examples/Classification/csa.md
index 6549d751..3e622c8f 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/examples/Classification/csa.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/examples/Classification/csa.md
@@ -26,30 +26,34 @@ keywords:
- reconhecimpt-brto imune
---
-# Algoritmo de Seleção Clonal
-
Esta página apresenta uma coleção de exemplos práticos demonstrando como usar o Algoritmo de Seleção Clonal.
## AIRS (Sistema Imunológico Artificial de Reconhecimento)
-
Run online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fpt%2Dbr%2Fclassification%2FAIRS)
---
### Algoritmo Binário
-+ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/example_with_randomly_gpt-brerated_dataset-pt-br.ipynb)
++ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/example_with_randomly_gpt-brerated_dataset-pt-br.ipynb)
+
> No exemplo apresentado neste notebook, foram geradas 1000 amostras aleatórias, organizadas em dois grupos, um para cada classe.
+ [Exemplo com banco de dados de cogumelos](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/mushrooms_dataBase_example_pt-br.ipynb)
+
> Utiliza o [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), que contém informações sobre cogumelos comestíveis e venenosos.
### Algoritmo com Valores Reais
-+ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/example_with_randomly_gpt-brerated_dataset-pt-br.ipynb)
++ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/example_with_randomly_gpt-brerated_dataset-pt-br.ipynb)
+
> No exemplo apresentado neste notebook, foram geradas 500 amostras aleatórias, organizadas em dois grupos, um para cada classe. Podemos ver abaixo os detectores "não-próprio" gerados.
+
+ [Exemplo com banco de dados Iris](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/iris_dataBase_example_pt-br.ipynb)
+
> Exemplo usando o NSA com o [iris database](https://archive.ics.uci.edu/ml/datasets/iris), que contém amostras com quatro dimensões e três classes de saída (Setosa, Versicolor e Virginica).
+
+ [Exemplo com banco de dados Geyser](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/geyser_dataBase_example_pt-br.ipynb)
-> Para classificar erupções de gêiseres no Parque Nacional de Yellowstone, este notebook utiliza o [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
\ No newline at end of file
+
+> Para classificar erupções de gêiseres no Parque Nacional de Yellowstone, este notebook utiliza o [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/examples/Classification/nsa.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/examples/Classification/nsa.md
index 3a12e3d5..946c60c6 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/examples/Classification/nsa.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/examples/Classification/nsa.md
@@ -35,9 +35,11 @@ Execute on-line via Binder: [](htt
---
+ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/BNSA/example_with_randomly_generated_dataset-pt.ipynb)
+
> No exemplo presente neste notebook, foram geradas 1000 amostras aleatórias, organizadas em dois grupos, um para cada classe.
+ [Exemplo de Base de Dados de Cogumelos](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/BNSA/mushrooms_dataBase_example_pt.ipynb)
+
> Ele usa a [base de dados de cogumelos](https://archive.ics.uci.edu/dataset/73/mushroom), que contém informações sobre cogumelos comestíveis e venenosos.
## RNSA (Algoritmo de Seleção Negativa de Valores Reais)
@@ -47,10 +49,13 @@ Execute on-line via Binder: [](htt
---
+ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/example_with_randomly_generated_dataset-pt.ipynb)
+
> No exemplo presente neste notebook, foram geradas 500 amostras aleatórias, organizadas em dois grupos, um para cada classe.
+ [Exemplo de Base de Dados Iris](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/iris_dataBase_example_pt.ipynb)
+
> Exemplo usando a base de dados [íris](https://archive.ics.uci.edu/ml/datasets/iris), que contém amostras de quatro dimensões e três classes de saída (Setosa, Versicolor e Virginica).
+ [Exemplo de Base de Dados Geyser](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/geyser_dataBase_example_pt.ipynb)
+
> Para classificar erupções de geysers no Parque Nacional de Yellowstone, este notebook usa a [base de dados Old Faithful](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/examples/Clustering/ina.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/examples/Clustering/ina.md
index 23334dcf..fb3f1087 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/examples/Clustering/ina.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/examples/Clustering/ina.md
@@ -18,8 +18,6 @@ keywords:
- conjunto de dados geyser
---
-# Algoritmos de Rede Imunológica
-
Nesta página, você encontrará uma coleção de exemplos práticos que demonstram como usar as classes do Algoritmo de Rede Imunológica implementadas em nosso pacote.
Execute os notebooks online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fpt-br%2Fclustering%2FAiNet)
@@ -29,10 +27,13 @@ Execute os notebooks online via Binder: [
+
> Neste notebook, o AiNet é demonstrado em três conjuntos de dados sintéticos:
-> - **Blobs:** clusters esféricos bem definidos, fáceis de separar.
-> - **Moons:** clusters não-lineares, ilustrando fronteiras de decisão mais complexas.
-> - **Circles:** dois círculos concêntricos, mostrando a capacidade de lidar com separações não-lineares.
+>
+> + **Blobs:** clusters esféricos bem definidos, fáceis de separar.
+> + **Moons:** clusters não-lineares, ilustrando fronteiras de decisão mais complexas.
+> + **Circles:** dois círculos concêntricos, mostrando a capacidade de lidar com separações não-lineares.
+ [Exemplo com base de dados do geyser](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/clustering/AiNet/geyser_dataBase_example.ipynb)
-> Para classificar erupções de geysers no Parque Nacional de Yellowstone, este notebook usa a [base de dados Old Faithful](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
\ No newline at end of file
+
+> Para classificar erupções de geysers no Parque Nacional de Yellowstone, este notebook usa a [base de dados Old Faithful](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/examples/Optimization/csa.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/examples/Optimization/csa.md
index eeea8a92..ea9b0171 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/examples/Optimization/csa.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/examples/Optimization/csa.md
@@ -17,8 +17,6 @@ palavras-chave:
- aprendizado de máquina
---
-# Algoritmo de Seleção Clonal
-
Nesta página, você encontrará uma coleção de exemplos práticos que demonstram como usar as classes do Algoritmo de Seleção Clonal implementadas em nosso pacote.
Execute notebooks online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fpt-br%2Foptimization%2Fclonalg)
@@ -28,10 +26,13 @@ Execute notebooks online via Binder: [
+
> Neste notebook, aplique o **Clonalg** ao Problema da Mochila usando algoritmos de otimização do pacote AISP.
+ [Função Rastrigin](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/optimization/clonalg/rastrigin_function_example.ipynb)
+
> Neste notebook, aplicamos o **Clonalg** à Função Rastrigin, um problema clássico de otimização contínua usando algoritmos de otimização do pacote AISP.
+ [Problema da Mochila](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/optimization/clonalg/knapsack_problem_example.ipynb)
-> Neste notebook, aplicamos o **Clonalg** ao Problema da Mochila usando algoritmos de otimização do pacote AISP.
\ No newline at end of file
+
+> Neste notebook, aplicamos o **Clonalg** ao Problema da Mochila usando algoritmos de otimização do pacote AISP.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/getting-started/basic-use/AiNet.mdx b/i18n/pt-br/docusaurus-plugin-content-docs/current/getting-started/basic-use/AiNet.mdx
index d63e5d5d..48544600 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/getting-started/basic-use/AiNet.mdx
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/getting-started/basic-use/AiNet.mdx
@@ -260,4 +260,4 @@ Coeficiente de Silhueta: 0.112
plot_immune_network(samples, predict_y, model, title_prefix="Circles - ")
```
-
+
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/getting-started/basic-use/BNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/getting-started/basic-use/BNSA.md
index c05fb33a..8ceda585 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/getting-started/basic-use/BNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/getting-started/basic-use/BNSA.md
@@ -22,12 +22,10 @@ keywords:
# Usando o BNSA
-O presente exemplo, disponível aqui, visa demonstrar a aplicação do algoritmo de seleção negativa binária. Esse algoritmo é empregado na classificação de amostras com características discretas.
-
+O presente exemplo, disponível aqui, visa demonstrar a aplicação do algoritmo de seleção negativa binária. Esse algoritmo é empregado na classificação de amostras com características discretas.
Acesse o notebook Jupyter disponível [aqui](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/BNSA/example_with_randomly_generated_dataset-pt.ipynb)!
-
Executar o notebook online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fpt-br%2Fclassification%2FBNSA%2Fexample_with_randomly_generated_dataset-pt.ipynb)
## Importando o algoritmo BNSA
@@ -63,7 +61,7 @@ def generate_samples(n_samples: int, n_features: int, s: float, x: None):
---
-Cada classe contará com 500 amostras, sendo a similaridade mínima entre amostras de 80% (s = 0.2). Essas classes serão separadas em conjunto de treinamento (800 amostras) e de teste (200 amostras).
+Cada classe contará com 500 amostras, sendo a similaridade mínima entre amostras de 80% (s = 0.2). Essas classes serão separadas em conjunto de treinamento (800 amostras) e de teste (200 amostras).
```python
# Configurando a seed para 121 para garantir a reprodutibilidade dos dados gerados.
@@ -89,7 +87,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-## Treinamento:
+## Treinamento
O modelo é ajustado através dos padrões de treinamento. Nessa aplicação, a seleção negativa distribuirá, com taxa de diferenciação de 30%, 250 detectores pelo espaço de entradas.
@@ -106,7 +104,8 @@ print(classification_report(test_y, prev))
```
Output:
-```
+
+```bash
✔ Non-self detectors for classes (x, y) successfully generated: ┇██████████┇ 500/500 detectors
A acurácia é 0.93
precision recall f1-score support
@@ -125,4 +124,4 @@ weighted avg 0.93 0.93 0.93 200
O modelo obteve 0,93 de acurácia para o conjunto teste. A precisão na classificação, tanto para x quanto para y, também foi de 0,93. Isso pode ser observado pela matriz de confusão na Figura 1.
-
\ No newline at end of file
+
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/getting-started/basic-use/Clonalg.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/getting-started/basic-use/Clonalg.md
index 60cc6a6a..3f10be4a 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/getting-started/basic-use/Clonalg.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/getting-started/basic-use/Clonalg.md
@@ -23,14 +23,15 @@ Acesse o notebook Jupyter com o código disponível [here](https://github.com/AI
Executar o notebook online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?urlpath=%2Fdoc%2Ftree%2F%2Fexamples%2Fpt-br%2Foptimization%2Fclonalg%2Frastrigin_function_example.ipynb)
-### Aplicamos o Clonalg à Função Rastrigin.
+### Aplicamos o Clonalg à Função Rastrigin
-A função Rastrigin é uma função multimodal não-convexa que possui muitos mínimos locais,
+A função Rastrigin é uma função multimodal não-convexa que possui muitos mínimos locais,
tornando-a um excelente teste para algoritmos de otimização, [saiba mais](https://en.wikipedia.org/wiki/Rastrigin_function). A função é definida como:
$$ f(x) = 10n + \sum_{i=1}^{n} (x_i^{2} - 10\cos(2\pi x_i)) $$
Onde:
+
* **n** é a dimensão do problema
* **x_i** ∈ [-5.12, 5.12] para cada dimensão
* **Mínimo global**: f(0,0) = 0
@@ -91,7 +92,9 @@ clonalg.optimize(100, 20)
if clonalg.best_cost is not None:
print('Best cost:', abs(clonalg.best_cost))
```
+
Output:
+
```bash
┌───────────┬─────────────────────────┬────────────────────┬─────────────────┐
│ Iteration │ Best Affinity (min) │ Worse Affinity │ Stagnation │
@@ -152,7 +155,9 @@ Best cost: 0.020278270044883584
```python
print(clonalg.get_report())
```
+
Output:
+
```python
=============================================
Optimization Summary
@@ -215,4 +220,4 @@ Cost History per Iteration:
### Evolução do melhor ao longo das gerações
-
\ No newline at end of file
+
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/current/getting-started/basic-use/RNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/current/getting-started/basic-use/RNSA.md
index e743dcd5..27a5fba4 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/getting-started/basic-use/RNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/getting-started/basic-use/RNSA.md
@@ -24,16 +24,15 @@ keywords:
Acesse o notebook Jupyter com o código disponível [aqui](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/example_with_randomly_generated_dataset-pt.ipynb)!
-
Executar o notebook online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fpt-br%2Fclassification%2FRNSA%2Fexample_with_randomly_generated_dataset-pt.ipynb)
+## Importando o Algoritmo de seleção negativa de valor real
-## Importando o Algoritmo de seleção negativa de valor real.
```python
from aisp.nsa import RNSA
```
-## Gerando bolhas de dados para as classe aleatoriamente.
+## Gerando bolhas de dados para as classe aleatoriamente
Utilizando a função make_blobs, são gerados dois conjuntos de dados em forma de bolhas, no intervalo entre 0 e 1, representando cada classe x e y. Em seguida, esses dados são separados em conjuntos de teste e treinamento.
@@ -49,7 +48,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-## Testando o modelo `default-NSA`:
+## Testando o modelo `default-NSA`
Inicia o modelo com 500 detectores, cada um com um raio de 0.06. Em seguida, apresenta o resultado da acurácia da previsão.
@@ -68,6 +67,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```bash
✔ Non-self detectors for classes (0, 1) successfully generated: ┇██████████┇ 1000/1000 detectors
The accuracy is 1.0
@@ -83,13 +83,13 @@ weighted avg 1.00 1.00 1.00 100
---
-## Plotagem dos detector e amostras:
+## Plotagem dos detector e amostras
-
+
---
-## Testando o modelo `V-detector`:
+## Testando o modelo `V-detector`
Inicia o modelo com 50 detectores, onde o raio mínimo é de 0.05 e o raio próprio das amostras é de 0.04. Em seguida, mostra o resultado da acurácia da previsão.
@@ -108,6 +108,7 @@ print(classification_report(test_y, prev))
```
Output:
+
```bash
✔ Non-self detectors for classes (0, 1) successfully generated: ┇██████████┇ 100/100 detectors
A acuracia é 1.0
@@ -123,6 +124,6 @@ weighted avg 1.00 1.00 1.00 100
---
-## Plotagem dos detector e amostras:
+## Plotagem dos v-detector e amostras
-
\ No newline at end of file
+
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 4fe3eb6d..faccfdbc 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/current/intro.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/current/intro.md
@@ -24,10 +24,11 @@ keywords:
- Immune-inspired Algorithms
---
-# Pacote de Sistemas Imunológicos Artificiais.
+# Pacote de Sistemas Imunológicos Artificiais
+
-
+
@@ -37,9 +38,9 @@ keywords:
**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).
-### Algoritmos implementados:
+### Algoritmos implementados
-> - [x] [**Seleção Negativa.**](/docs/aisp-techniques/negative-selection/)
-> - [x] [**Algoritmos de Seleção Clonal.**](/docs/aisp-techniques/clonal-selection-algorithms/)
-> - [x] [**Teoria da Rede Imune.**](/docs/aisp-techniques/immune-network-theory/)
+> - [x] [**Seleção Negativa.**](./aisp-techniques/negative-selection/)
+> - [x] [**Algoritmos de Seleção Clonal.**](./aisp-techniques/clonal-selection-algorithms/)
+> - [x] [**Teoria da Rede Imune.**](./aisp-techniques/immune-network-theory/)
> - [ ] *Teoria do Perigo.*
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/About us.mdx b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/About us.mdx
index a8a81fbf..fb136e1e 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/About us.mdx
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/About us.mdx
@@ -26,7 +26,7 @@ pertencentes à área de sistemas imunológicos artificiais.
name='Alison Zille Lopes'
date='2022'
githubUrl='https://github.com/alisonzille'
- lattesUrl='http://lattes.cnpq.br/3294097090760981'
+ lattesUrl='https://lattes.cnpq.br/3294097090760981'
/>
@@ -42,7 +42,7 @@ pertencentes à área de sistemas imunológicos artificiais.
date='2022-2023'
description="Fui encarregado de implementar a versão 0.1, que apresenta as classes de seleção negativa BNSA e RNSA, incluindo as versões de raio fixo e variável."
githubUrl='https://github.com/Joao-Paulo-Silva'
- lattesUrl='http://lattes.cnpq.br/2561057724411407'
+ lattesUrl='https://lattes.cnpq.br/2561057724411407'
/>
\ No newline at end of file
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/Examples/nsa.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/Examples/nsa.md
index b9d3703e..c568304f 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/Examples/nsa.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/Examples/nsa.md
@@ -26,15 +26,18 @@ keywords:
Nesta página, você encontrará uma coleção de exemplos práticos que demonstram como usar as classes de seleção negativa implementadas em nosso pacote.
-## Os exemplos estão organizados da seguinte forma:
+## Os exemplos estão organizados da seguinte forma
-### Normalização de Dados:
+### Normalização de Dados
+>
> Mostra como normalizar dados usando as classes de seleção negativa. Na versão de valores reais, os dados são normalizados entre 0 e 1. Na versão binária, eles são normalizados em um vetor de bits.
-### Validação Cruzada K-fold com 50 Interações:
+### Validação Cruzada K-fold com 50 Interações
+>
> Neste exemplo, os dados são divididos em conjuntos de treinamento e teste, e o desempenho do modelo é avaliado por meio de validação cruzada. Portanto, dividimos os dados de treinamento em k partes. Em cada iteração, 10% dos dados de treinamento são reservados para teste.
-### Treinamento:
+### Treinamento
+>
> O modelo treinado é testado neste exemplo com todos os dados de treinamento disponíveis.
Os exemplos a seguir mostram várias funcionalidades das classes de seleção negativa para que você saiba como usá-las em seu projeto. Sinta-se à vontade para explorar esses exemplos e adaptá-los conforme necessário para atender às suas necessidades específicas.
@@ -44,19 +47,25 @@ Os exemplos a seguir mostram várias funcionalidades das classes de seleção ne
Acesse os notebooks com a possibilidade de execução online pelo Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples)
## BNSA (Algoritmo de Seleção Negativa Binária)
+
+ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/0.1.x/examples/BNSA/example_with_randomly_generated_dataset-pt.ipynb)
+
> No exemplo presente neste notebook, foram geradas 1000 amostras aleatórias, organizadas em dois grupos, um para cada classe.
+ [Exemplo de Base de Dados de Cogumelos](https://github.com/AIS-Package/aisp/blob/0.1.x/examples/BNSA/mushrooms_dataBase_example_pt.ipynb)
+
> Ele usa a [base de dados de cogumelos](https://archive.ics.uci.edu/dataset/73/mushroom), que contém informações sobre cogumelos comestíveis e venenosos.
## RNSA (Algoritmo de Seleção Negativa de Valores Reais)
+ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/0.1.x/examples/RNSA/example_with_randomly_generated_dataset-pt.ipynb)
+
> No exemplo presente neste notebook, foram geradas 500 amostras aleatórias, organizadas em dois grupos, um para cada classe.
+ [Exemplo de Base de Dados Iris](https://github.com/AIS-Package/aisp/blob/0.1.x/examples/RNSA/iris_dataBase_example_pt.ipynb)
+
> Exemplo usando a base de dados [íris](https://archive.ics.uci.edu/ml/datasets/iris), que contém amostras de quatro dimensões e três classes de saída (Setosa, Versicolor e Virginica).
+ [Exemplo de Base de Dados Geyser](https://github.com/AIS-Package/aisp/blob/0.1.x/examples/RNSA/geyser_dataBase_example_pt.ipynb)
+
> Para classificar erupções de geysers no Parque Nacional de Yellowstone, este notebook usa a [base de dados Old Faithful](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/Getting Started/basic use/BNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/Getting Started/basic use/BNSA.md
index 43ed2f37..9d29db09 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/Getting Started/basic use/BNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/Getting Started/basic use/BNSA.md
@@ -22,10 +22,7 @@ keywords:
- Computação Natural
---
-# Aplicando o BNSA
-
-O presente exemplo, disponível aqui, visa demonstrar a aplicação do algoritmo de seleção negativa binária. Esse algoritmo é empregado na classificação de amostras com características discretas.
-
+O presente exemplo, disponível aqui, visa demonstrar a aplicação do algoritmo de seleção negativa binária. Esse algoritmo é empregado na classificação de amostras com características discretas.
Acesse o notebook Jupyter disponível [aqui](https://github.com/AIS-Package/aisp/blob/0.1.x/examples/BNSA/example_with_randomly_generated_dataset-pt.ipynb)!
@@ -62,7 +59,7 @@ def generate_samples(n_samples: int, n_features: int, s: float, x: None):
---
-Cada classe contará com 500 amostras, sendo a similaridade mínima entre amostras de 80% (s = 0.2). Essas classes serão separadas em conjunto de treinamento (800 amostras) e de teste (200 amostras).
+Cada classe contará com 500 amostras, sendo a similaridade mínima entre amostras de 80% (s = 0.2). Essas classes serão separadas em conjunto de treinamento (800 amostras) e de teste (200 amostras).
```python
# Configurando a seed para 121 para garantir a reprodutibilidade dos dados gerados.
@@ -88,7 +85,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-## Treinamento:
+## Treinamento
O modelo é ajustado através dos padrões de treinamento. Nessa aplicação, a seleção negativa distribuirá, com taxa de diferenciação de 30%, 250 detectores pelo espaço de entradas.
@@ -105,7 +102,8 @@ print(classification_report(test_y, prev))
```
Output:
-```
+
+```bash
✔ Non-self detectors for classes (x, y) successfully generated: ┇██████████┇ 500/500 detectors
A acurácia é 0.93
precision recall f1-score support
@@ -121,6 +119,7 @@ weighted avg 0.93 0.93 0.93 200
---
## Avaliação
+
O modelo obteve 0,93 de acurácia para o conjunto teste. A precisão na classificação, tanto para x quanto para y, também foi de 0,93. Isso pode ser observado pela matriz de confusão na Figura 1.
-
\ No newline at end of file
+
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/Getting Started/basic use/RNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/Getting Started/basic use/RNSA.md
index eb7298e2..95f9d1b9 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/Getting Started/basic use/RNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/Getting Started/basic use/RNSA.md
@@ -22,16 +22,15 @@ keywords:
- Computação Natural
---
-# Usando o RNSA
-
Acesse o notebook Jupyter com o código disponível [aqui](https://github.com/AIS-Package/aisp/blob/0.1.x/examples/RNSA/example_with_randomly_generated_dataset-pt.ipynb)!
-## Importando o Algoritmo de seleção negativa de valor real.
+## Importando o Algoritmo de seleção negativa de valor real
+
```python
from aisp.nsa import RNSA
```
-## Gerando bolhas de dados para as classe aleatoriamente.
+## Gerando bolhas de dados para as classe aleatoriamente
Utilizando a função make_blobs, são gerados dois conjuntos de dados em forma de bolhas, no intervalo entre 0 e 1, representando cada classe x e y. Em seguida, esses dados são separados em conjuntos de teste e treinamento.
@@ -47,7 +46,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-## Testando o modelo `default-NSA`:
+## Testando o modelo `default-NSA`
Inicia o modelo com 500 detectores, cada um com um raio de 0.06. Em seguida, apresenta o resultado da acurácia da previsão.
@@ -66,6 +65,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```bash
✔ Non-self detectors for classes (0, 1) successfully generated: ┇██████████┇ 1000/1000 detectors
The accuracy is 1.0
@@ -81,13 +81,13 @@ weighted avg 1.00 1.00 1.00 100
---
-## Plotagem dos detector e amostras:
+## Plotagem dos detector e amostras
-
+
---
-## Testando o modelo `V-detector`:
+## Testando o modelo `V-detector`
Inicia o modelo com 50 detectores, onde o raio mínimo é de 0.05 e o raio próprio das amostras é de 0.04. Em seguida, mostra o resultado da acurácia da previsão.
@@ -106,6 +106,7 @@ print(classification_report(test_y, prev))
```
Output:
+
```bash
✔ Non-self detectors for classes (0, 1) successfully generated: ┇██████████┇ 100/100 detectors
A acuracia é 1.0
@@ -121,6 +122,6 @@ weighted avg 1.00 1.00 1.00 100
---
-## Plotagem dos detector e amostras:
+## Plotagem dos v-detector e amostras
-
\ No newline at end of file
+
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/Getting Started/instalation.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/Getting Started/instalation.md
index 169128c3..bd64dab0 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/Getting Started/instalation.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/Getting Started/instalation.md
@@ -11,11 +11,9 @@ last_update:
author: João Paulo
---
-# **Instalação**
-
Esta página contém informações sobre as dependências do pacote, como instalá-lo e como importar os módulos.
-### **Dependências:**
+### Dependências
O módulo requer [python 3.10](https://www.python.org/downloads/) ou superior.
@@ -30,7 +28,7 @@ O módulo requer [python 3.10](https://www.python.org/downloads/) ou superior.
-### **Procedimento de instalação**
+### Procedimento de instalação
A maneira mais simples de instalação é através do ``pip``:
@@ -38,11 +36,11 @@ A maneira mais simples de instalação é através do ``pip``:
pip install aisp
```
-### **Importando módulos**
+### Importando módulos
``` python
from aisp.nsa import RNSA, BNSA
nsa = RNSA(N=300, r=0.05)
-```
\ No newline at end of file
+```
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Base Classes Reference/nsa.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Base Classes Reference/nsa.md
index 8cc04381..467bb59c 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Base Classes Reference/nsa.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Base Classes Reference/nsa.md
@@ -6,14 +6,13 @@ lastUpdatedAt: 2025/04/04
author: João Paulo
---
-# ``class BaseNSA(BaseClassifier, ABC)``
-
+## ``class BaseNSA(BaseClassifier, ABC)``
A classe ``BaseNSA`` contém funções utilitárias com o modificador ``protected`` que podem ser herdadas por várias classes para facilitar o uso. Ela inclui funções para calcular distância, separar dados para melhorar a eficiência de treinamento e previsão, medir precisão e outras funções.
---
-## Funções Protegidas:
+## Funções Protegidas
---
@@ -26,20 +25,21 @@ def _check_and_raise_exceptions_fit(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Função responsável por verificar os parâmetros da função fit e lançar exceções se a verificação não for bem-sucedida.
**Parâmetros**:
-* **X** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, [``N samples`` (linhas)][``N features`` (colunas)].
-* ***y*** (``npt.NDArray``): Array de classes alvo de ``X`` com [``N samples`` (linhas)].
-* ***_class_*** (Literal[RNSA, BNSA], opcional): Classe atual. O padrão é 'RNSA'.
+* **X** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, \[``N samples`` (linhas)\]\[``N features`` (colunas)].
+* ***y*** (``npt.NDArray``): Array de classes alvo de ``X`` com \[``N samples`` (linhas)].
+* ****class**** (Literal[RNSA, BNSA], opcional): Classe atual. O padrão é 'RNSA'.
**Lança:**
+
* ``TypeError``: Se X ou y não forem ndarrays ou tiverem formas incompatíveis.
* ``MaxDiscardsReachedError``: O número máximo de descartes do detector foi atingido durante
a maturação. Verifique o valor do raio definido e considere reduzi-lo.
-
### def _check_and_raise_exceptions_predict(...)
```python
@@ -49,13 +49,16 @@ def _check_and_raise_exceptions_predict(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Função responsável por verificar os parâmetros da função predict e lançar exceções caso a verificação não seja bem-sucedida.
**Parâmetros**:
-* ***X*** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, [``N samples`` (linhas)][``N features`` (colunas)].
+
+* ***X*** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, \[``N samples`` (linhas)\]\[``N features`` (colunas)].
* ***expected*** (``int``): Número esperado de características por amostra (colunas em X).
-* ***_class_*** (``Literal[RNSA, BNSA], opcional``): Classe atual. O padrão é 'RNSA'.
+* ****class**** (``Literal[RNSA, BNSA], opcional``): Classe atual. O padrão é 'RNSA'.
**Lança:**
+
* ``TypeError``: Se X ou y não forem ndarrays ou tiverem formas incompatíveis.
* ``MaxDiscardsReachedError``: O número máximo de descartes do detector foi atingido durante
a maturação. Verifique o valor do raio definido e considere reduzi-lo.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Base module/Classifier.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Base module/Classifier.md
index 925a41c9..859b9c2d 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Base module/Classifier.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Base module/Classifier.md
@@ -1,21 +1,19 @@
---
sidebar_position: 1
-title: Classification
sidebar_label: BaseClassifier
last_update:
date: 2025/05/17
author: João Paulo
---
-# Classe base para algoritmo de classificação.
+# Classe base para algoritmo de classificação
-## ``class BaseClassifier(ABC)``:
+## ``class BaseClassifier(ABC)``
Classe base para algoritmos de classificação, definindo os métodos abstratos ``fit`` e ``predict``, e implementando o método ``get_params``.
## Abstract methods
-
### def fit(...)
```python
@@ -26,10 +24,8 @@ Ajusta o modelo aos dados de treinamento.
Implementação:
-- [RNSA](/docs/0.1.x/aisp-techniques/Negative%20Selection/rnsa#Função-fit)
-- [BNSA](/docs/0.1.x/aisp-techniques/Negative%20Selection/bnsa#Função-fit)
-
-
+- [RNSA](../../aisp-techniques/Negative%20Selection/RNSA.md#Função-fit)
+- [BNSA](../../aisp-techniques/Negative%20Selection/BNSA.md#Função-fit)
### def predict(...)
@@ -41,8 +37,8 @@ Realiza a previsão dos rótulos para os dados fornecidos.
Implementação:
-- [RNSA](/docs/0.1.x/aisp-techniques/Negative%20Selection/rnsa#Função-predict)
-- [BNSA](/docs/0.1.x/aisp-techniques/Negative%20Selection/bnsa#Função-predict)
+- [RNSA](../../aisp-techniques/Negative%20Selection/RNSA.md#Função-predict)
+- [BNSA](../../aisp-techniques/Negative%20Selection/BNSA.md#Função-predict)
---
@@ -56,23 +52,24 @@ def score(self, X: npt.NDArray, y: list) -> float
A função de pontuação (score) calcula a precisão da previsão.
-Esta função realiza a previsão de X e verifica quantos elementos são iguais entre o vetor y e y_predicted.
+Esta função realiza a previsão de X e verifica quantos elementos são iguais entre o vetor y e y_predicted.
Esta função foi adicionada para compatibilidade com algumas funções do scikit-learn.
**Parâmetros**:
-+ ***X***: np.ndarray
+
+- ***X***: np.ndarray
Conjunto de características com formato (n_amostras, n_características).
-+ ***y***: np.ndarray
+- ***y***: np.ndarray
Valores verdadeiros com formato (n_amostras,).
**Retorna**:
-+ precisão: float
+- precisão: float
A precisão do modelo.
---
-### Método _slice_index_list_by_class(...):
+### Método _slice_index_list_by_class(...)
A função ``_slice_index_list_by_class(...)``, separa os índices das linhas conforme a classe de saída, para percorrer o array de amostra, apenas nas posições que a saída for a classe que está sendo treinada:
@@ -89,6 +86,7 @@ Retorna um dicionário com as classes como chave e os índices em ``X`` das amos
```python
def get_params(self, deep: bool = True) -> dict:
```
+
A função get_params retorna um dicionário com os parâmetros principais do objeto.
Esta função é necessária para garantir a compatibilidade com as funções do scikit-learn.
@@ -101,5 +99,5 @@ Representa um detector não-próprio do class RNSA.
**Atributos:**
-* ***position*** (``np.ndarray``): Vetor de características do detector.
-* ***radius*** (``float, opcional``): Raio do detector, utilizado no algoritmo V-detector.
\ No newline at end of file
+- ***position*** (``np.ndarray``): Vetor de características do detector.
+- ***radius*** (``float, opcional``): Raio do detector, utilizado no algoritmo V-detector.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Core/Negative Selection.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Core/Negative Selection.md
index 6777640c..9041d2b2 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Core/Negative Selection.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Core/Negative Selection.md
@@ -8,7 +8,7 @@ last_update:
As funções realizam verificações de detectores e utilizam decoradores Numba para compilação Just-In-Time.
-### Função check_detector_bnsa_validity(...):
+## Função check_detector_bnsa_validity(...)
```python
def check_detector_bnsa_validity(
@@ -20,19 +20,19 @@ def check_detector_bnsa_validity(
Verifica a validade de um candidato a detector (vector_x) contra amostras de uma classe (x_class) usando a distância de Hamming. Um detector é considerado INVÁLIDO se a sua distância para qualquer amostra em ``x_class`` for menor ou igual a ``aff_thresh``.
-
**Os parâmetros de entrada são:**
+
* x_class (``npt.NDArray``): Array contendo as amostras da classe. Formato esperado: (n_amostras, n_características).
* vector_x (``npt.NDArray``): Array representando o detector. Formato esperado: (n_características,).
* aff_thresh (``float``): Limiar de afinidade.
+**Retorna:**
-**Retorna:**
* True se o detector for válido, False caso contrário.
---
-### Função bnsa_class_prediction(...):
+## Função bnsa_class_prediction(...)
```python
def bnsa_class_prediction(
@@ -41,19 +41,22 @@ def bnsa_class_prediction(
aff_thresh: float
) -> int:
```
+
Define a classe de uma amostra a partir dos detectores não-próprios.
**Os parâmetros de entrada são:**
+
* features (``npt.NDArray``): amostra binária a ser classificada (shape: [n_features]).
-* class_detectors (``npt.NDArray``): Matriz contendo os detectores de todas as classes (shape: [n_classes, n_detectors, n_features]).
+* class_detectors (``npt.NDArray``): Matriz contendo os detectores de todas as classes (shape: [n_classes, n_detectors, n_features]).
* aff_thresh (``float``): Limiar de afinidade que determina se um detector reconhece a amostra como não-própria.
-**Retorna:**
+**Retorna:**
+
* int: Índice da classe predita. Retorna -1 se for não-própria para todas as classes.
---
-### Função check_detector_rnsa_validity(...):
+## Função check_detector_rnsa_validity(...)
```python
def check_detector_rnsa_validity(
@@ -64,18 +67,19 @@ def check_detector_rnsa_validity(
p: float
) -> bool:
```
-Verifica a validade de um candidato a detector (vector_x) contra amostras de uma classe (x_class) usando a distância de Hamming. Um detector é considerado INVÁLIDO se a sua distância para qualquer amostra em ``x_class`` for menor ou igual a ``aff_thresh``.
+Verifica a validade de um candidato a detector (vector_x) contra amostras de uma classe (x_class) usando a distância de Hamming. Um detector é considerado INVÁLIDO se a sua distância para qualquer amostra em ``x_class`` for menor ou igual a ``aff_thresh``.
**Os parâmetros de entrada são:**
+
* x_class (``npt.NDArray``): Array contendo as amostras da classe. Formato esperado: (n_amostras, n_características).
* vector_x (``npt.NDArray``): Array representando o detector. Formato esperado: (n_características,).
* threshold (``float``): Afinidade.
* metric (``int``): Métrica de distância a ser utilizada. Opções disponíveis: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)].
* p (``float``): Parâmetro da métrica de Minkowski (utilizado apenas se `metric` for "minkowski").
+**Retorna:**
-**Retorna:**
* True se o detector for válido, False caso contrário.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Utils/Distance.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Utils/Distance.md
index 3238ee07..4c4e896f 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Utils/Distance.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Utils/Distance.md
@@ -16,15 +16,15 @@ def hamming(u: npt.NDArray, v: npt.NDArray) -> np.float64:
Função para calcular a distância de Hamming normalizada entre dois pontos.
-
$((x₁ ≠ x₂) + (y₁ ≠ y₂) + ... + (y_n ≠ y_n)) / n$
-
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto
* v (``npt.NDArray``): Coordenadas do segundo ponto.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -39,13 +39,13 @@ Função para calcular a distância euclidiana normalizada entre dois pontos.
$√( (x₁ - x₂)² + (y₁ - y₂)² + ... + (y_n - y_n)²)$
-
-
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto
* v (``npt.NDArray``): Coordenadas do segundo ponto.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -57,15 +57,16 @@ def cityblock(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64]) -> np.floa
```
Função para calcular a distância Manhattan normalizada entre dois pontos.
-
-$(|x₁ - x₂| + |y₁ - y₂| + ... + |y_n - y_n|) / n$
+$(|x₁ - x₂| + |y₁ - y₂| + ... + |y_n - y_n|) / n$
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto
* v (``npt.NDArray``): Coordenadas do segundo ponto.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -77,19 +78,20 @@ def minkowski(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64], p: float =
```
Função para calcular a distância de Minkowski normalizada entre dois pontos.
-
-$(( |X₁ - Y₁|p + |X₂ - Y₂|p + ... + |X_n - Y_n|p) ¹/ₚ) / n$
+$(( |X₁ - Y₁|p + |X₂ - Y₂|p + ... + |X_n - Y_n|p) ¹/ₚ) / n$
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto.
* v (``npt.NDArray``): Coordenadas do segundo ponto.
* p (``float``): O parâmetro p define o tipo de distância a ser calculada:
- - p = 1: Distância **Manhattan** — soma das diferenças absolutas.
- - p = 2: Distância **Euclidiana** — soma das diferenças ao quadrado (raiz quadrada).
- - p > 2: Distância **Minkowski** com uma penalidade crescente à medida que p aumenta.
+ * p = 1: Distância **Manhattan** — soma das diferenças absolutas.
+ * p = 2: Distância **Euclidiana** — soma das diferenças ao quadrado (raiz quadrada).
+ * p > 2: Distância **Minkowski** com uma penalidade crescente à medida que p aumenta.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -107,15 +109,15 @@ def compute_metric_distance(
Função para calcular a distância entre dois pontos pela ``métrica`` escolhida.
-
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto.
* v (``npt.NDArray``): Coordenadas do segundo ponto.
* metric (``int``): Métrica de distância a ser utilizada. Opções disponíveis: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)].
* p (``float``): Parâmetro da métrica de Minkowski (utilizado apenas se `metric` for "minkowski").
-
**Returns:**
+
* Distância (``double``) entre os dois pontos com a métrica selecionada.
---
@@ -134,12 +136,14 @@ def min_distance_to_class_vectors(
Calcula a menor distância entre um vetor de entrada e os vetores de uma classe.
**Parameters:**
+
* x_class (``npt.NDArray``): Array contendo os vetores da classe com os quais o vetor de entrada será comparado. Formato esperado: (n_amostras, n_características).
* vector_x (``npt.NDArray``): Vetor a ser comparado com os vetores da classe. Formato esperado: (n_características,).
* metric (``int``): Métrica de distância a ser utilizada. Opções disponíveis: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)].
* p (``float``): Parâmetro da métrica de Minkowski (utilizado apenas se `metric` for "minkowski").
**Returns:**
+
* float: A menor distância calculada entre o vetor de entrada e os vetores da classe.
* Retorna -1.0 se as dimensões de entrada forem incompatíveis.
@@ -150,15 +154,17 @@ Calcula a menor distância entre um vetor de entrada e os vetores de uma classe.
```python
def get_metric_code(metric: str) -> int:
```
+
Retorna o código numérico associado a uma métrica de distância.
**Parameters:**
-* metric (``str``): Nome da métrica. Pode ser "euclidean", "manhattan", "minkowski" ou "hamming".
+* metric (``str``): Nome da métrica. Pode ser "euclidean", "manhattan", "minkowski" ou "hamming".
**Raises**
-----------
+
* ``ValueError``: Se a métrica informada não for suportada.
**Returns:**
-* ``int``: Código numérico correspondente à métrica.
\ No newline at end of file
+
+* ``int``: Código numérico correspondente à métrica.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Utils/Metrics.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Utils/Metrics.md
index dac82b80..3a546b44 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Utils/Metrics.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Utils/Metrics.md
@@ -8,7 +8,7 @@ author: João Paulo
O arquivo de métricas fornece utilitários para medir, analisar e comparar o desempenho dos algoritmos do pacote de forma padronizada.
-#### def accuracy_score(...)
+### def accuracy_score(...)
```python
def accuracy_score(
@@ -20,19 +20,19 @@ def accuracy_score(
Função para calcular a acurácia de precisão com base em listas de rótulos
verdadeiros e nos rótulos previstos.
-Parâmetros:
----
+**Parâmetros:**
+
* y_true (``Union[npt.NDArray, list]``): Rótulos verdadeiros (corretos)..
* y_pred (``Union[npt.NDArray, list]``): Rótulos previstos.
-Retornos:
----
+**Retornos:**
+
* Precisão (``float``): A proporção de previsões corretas em relação
ao número total de previsões.
-Lança:
----
+**Lança:**
+
* ValueError: Se `y_true` ou `y_pred` estiverem vazios ou se não
tiverem o mesmo tamanho.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Utils/Multiclass.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Utils/Multiclass.md
index b05b1e60..cc2f7bec 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Utils/Multiclass.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Utils/Multiclass.md
@@ -18,12 +18,12 @@ A função ``slice_index_list_by_class(...)``, separa os índices das linhas con
classe de saída, para percorrer o array de amostra, apenas nas posições que a saída for \
a classe que está sendo treinada.
-Parameters:
----
- * classes (``list or npt.NDArray``): lista com classes únicas.
- * y (npt.NDArray): Recebe um array ``y``[``N amostra``] com as classes de saída do \
- array de amostra ``X``.
-
- Returns:
- ---
- * dict: Um dicionário com a lista de posições do array(``y``), com as classes como chave.
+**Parameters**
+
+* classes (``list or npt.NDArray``): lista com classes únicas.
+* y (npt.NDArray): Recebe um array ``y``[``N amostra``] com as classes de saída do \
+ array de amostra ``X``.
+
+**Returns**
+
+* dict: Um dicionário com a lista de posições do array(``y``), com as classes como chave.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Utils/Sanitizers.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Utils/Sanitizers.md
index 27d1ca40..13ede0db 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Utils/Sanitizers.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/advanced-guides/Utils/Sanitizers.md
@@ -15,12 +15,13 @@ def sanitize_choice(value: T, valid_choices: Iterable[T], default: T) -> T
A função ``sanitize_choice(...)``, retorna o valor se estiver presente no conjunto de opções válidas; caso contrário, retorna o valor padrão.
**Parameters:**
+
* ***value*** (``T``): O valor a ser verificado.
* ***valid_choices*** (``Iterable[T]``): Uma coleção de opções válidas.
* ***default***: O valor padrão a ser retornado se ``value`` não estiver em ``valid_choices``.
-
**Returns:**
+
* `T`: O valor original, se válido, ou o valor padrão, se não.
---
@@ -34,12 +35,13 @@ def sanitize_param(value: T, default: T, condition: Callable[[T], bool]) -> T:
A função ``sanitize_param(...)``, retorna o valor se ele satisfizer a condição especificada; caso contrário, retorna o valor padrão.
**Parameters:**
+
* value (``T``): O valor a ser verificado.
* default (``T``): O valor padrão a ser retornado se a condição não for satisfeita.
* condition (``Callable[[T], bool]``): Uma função que recebe um valor e retorna um booleano, determinando se o valor é válido.
-
**Returns:**
+
* `T`: O valor original se a condição for satisfeita, ou o valor padrão se não for.
---
@@ -53,8 +55,9 @@ def sanitize_seed(seed: Any) -> Optional[int]:
A função ``sanitize_param(...)``, retorna a semente se for um inteiro não negativo; caso contrário, retorna Nenhum.
**Parameters:**
+
* seed (``Any``): O valor da seed a ser validado.
**Returns:**
-* ``Optional[int]``: A seed original se for um inteiro não negativo, ou ``None`` se for inválido.
+* ``Optional[int]``: A seed original se for um inteiro não negativo, ou ``None`` se for inválido.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/aisp-techniques/Negative Selection/BNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/aisp-techniques/Negative Selection/BNSA.md
index 7bfa36a9..803f1022 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/aisp-techniques/Negative Selection/BNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/aisp-techniques/Negative Selection/BNSA.md
@@ -1,6 +1,5 @@
---
id: bnsa
-title: BNSA
sidebar_label: BNSA - Algoritmo de Seleção Negativa Binária
sidebar_position: 2
pagination_next: null
@@ -20,9 +19,9 @@ keywords:
- Computação Natural
---
-# BNSA (Algoritmo de Seleção Negativa Binária).
+# BNSA (Algoritmo de Seleção Negativa Binária)
-A classe ``BNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
+A classe ``BNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
```python
class BNSA(
@@ -36,18 +35,20 @@ class BNSA(
```
**Attributes:**
+
* *N* (``int``): Quantidade de detectores. Defaults to ``100``.
* *aff_thresh* (``float``): A variável ('affinity threshold') representa a porcentagem de não similaridade entre a célula T e as amostras próprias. O valor padrão é de 10% (0,1), enquanto que o valor de 1,0 representa 100% de não similaridade.
+
:::note
Definir uma porcentagem de diferença muito alta pode resultar na incapacidade de gerar detectores para não-próprio.
:::
-* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
+* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
possível loop infinito caso seja definido um raio que não seja possível gerar detectores do não-próprio. Defaults to ``1000``.
* *seed* (``int``): Semente para a geração randômica dos valores nos detectores. Defaults to ``None``.
* no_label_sample_selection (``str``): Método para a seleção de rótulos para amostras designadas como não pertencentes por todos os detectores não pertencentes. **Tipos de métodos disponíveis:**
- - (``max_average_difference``): Seleciona a classe com a maior diferença média entre os detectores.
- - (``max_nearest_difference``): Seleciona a classe com a maior diferença entre o detector mais próximo e mais distante da amostra.
+ * (``max_average_difference``): Seleciona a classe com a maior diferença média entre os detectores.
+ * (``max_nearest_difference``): Seleciona a classe com a maior diferença entre o detector mais próximo e mais distante da amostra.
**Outras variáveis iniciadas:**
@@ -57,17 +58,19 @@ possível loop infinito caso seja definido um raio que não seja possível gerar
---
-### Função fit(...)
+## Função fit(...)
A função ``fit(...)`` gera os detectores para os não próprios com relação às amostras:
```python
def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
```
+
Nela é realizado o treinamento de acordo com ``X`` e ``y``, usando o método de seleção negativa(``NegativeSelect``).
**Os parâmetros de entrada são:**
-* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
+
+* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
* ``y``: array com as classes de saídas disposto em **N** amostras que são relacionadas ao ``X``.
* ``verbose``: boolean com valor padrão ``True``, determina se o feedback da geração dos detectores será impresso.
@@ -75,7 +78,7 @@ Nela é realizado o treinamento de acordo com ``X`` e ``y``, usando o método de
---
-### Função predict(...)
+## Função predict(...)
A função ``predict(...)`` realiza a previsão das classes utilizando os detectores gerados:
@@ -84,16 +87,17 @@ def predict(self, X: npt.NDArray) -> npt.NDArray:
```
**O parâmetro de entrada:**
-
+
* ``X``: array com as características para a previsão, com **N** amostras (Linhas) e **N** colunas.
-**Retorna:**
-* ``C``: Um array de previsão com as classes de saída para as características informadas.
+**Retorna:**
+
+* ``C``: Um array de previsão com as classes de saída para as características informadas.
* ``None``: se não houver detectores.
---
-### Função score(...)
+## Função score(...)
A função "score(...)" calcula a precisão do modelo treinado por meio da realização de previsões e do cálculo da acurácia.
@@ -109,7 +113,7 @@ retorna a acurácia, do tipo ``float``.
---
-### Função __slice_index_list_by_class(...)
+## Função __slice_index_list_by_class(...)
A função ``__slice_index_list_by_class(...)``, separa os índices das linhas conforme a classe de saída, para percorrer o array de amostra, apenas nas posições que a saída for a classe que está sendo treinada:
@@ -119,4 +123,4 @@ def __slice_index_list_by_class(self, y: npt.NDArray) -> dict:
Retorna um dicionario com as classes como chave e os índices em ``X`` das amostras.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/aisp-techniques/Negative Selection/README.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/aisp-techniques/Negative Selection/README.md
index 84973455..e8f13992 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/aisp-techniques/Negative Selection/README.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/aisp-techniques/Negative Selection/README.md
@@ -4,30 +4,37 @@ A **seleção negativa** é o processo em que o sistema imunológico faz a matur
---
-# classes
+## classes
> 1. **[Binary version:](BNSA.md)**
+>
>> O algoritmo binário adaptado para múltiplas classes neste projeto tem como base a versão proposta por [Forrest et al. (1994)](#2), originalmente desenvolvida para segurança computacional.
>>> **Exemplo:**
+>>>
>>> + [Base de dados Mushrooms](https://github.com/AIS-Package/aisp/blob/main/examples/BNSA/mushrooms_dataBase_example_pt-br.ipynb)
> 2. **[Real-Valued version:](RNSA.md)**
+>
>>Este algoritmo possui duas versões diferentes: uma baseada na versão canônica [[1]](#1) e outra com detectores de raio variável [[3]](#3). Ambas estão adaptadas para trabalhar com múltiplas classes e possuem métodos para previsão de dados presentes na região não-self de todos os detectores e classes.
>>> **Exemplos:**
->>> + [Base de dados Iris](https://github.com/AIS-Package/aisp/blob/main/examples/RNSA/iris_dataBase_example_pt-br.ipynb)
->>> + [Base de dados Geyser](https://github.com/AIS-Package/aisp/blob/main/examples/RNSA/geyser_dataBase_example_pt-br.ipynb)
+>>>
+>>> + [Base de dados Iris](https://github.com/AIS-Package/aisp/blob/main/examples/RNSA/iris_dataBase_example_pt-br.ipynb)
+>>> + [Base de dados Geyser](https://github.com/AIS-Package/aisp/blob/main/examples/RNSA/geyser_dataBase_example_pt-br.ipynb)
-# References
+## References
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
+### 1
+>
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
-##### 2
-> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: http://dx.doi.org/10.1109/RISP.1994.296580.
+### 2
+>
+> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: [https://dx.doi.org/10.1109/RISP.1994.296580](https://dx.doi.org/10.1109/RISP.1994.296580).
-##### 3
-> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: http://dx.doi.org/10.1007/978-3-540-24854-5_30.
+### 3
+>
+> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: [https://dx.doi.org/10.1007/978-3-540-24854-5_30](https://dx.doi.org/10.1007/978-3-540-24854-5_30).
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/aisp-techniques/Negative Selection/RNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/aisp-techniques/Negative Selection/RNSA.md
index b98833aa..8d97e90a 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/aisp-techniques/Negative Selection/RNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/aisp-techniques/Negative Selection/RNSA.md
@@ -1,6 +1,5 @@
---
id: rnsa
-title: RNSA
sidebar_label: RNSA - Algoritmo de Seleção Negativa de Valor Real
sidebar_position: 1
last_update:
@@ -21,9 +20,9 @@ keywords:
# RNSA (Algoritmo de Seleção Negativa de Valor Real)
-## Construtor RNSA:
+## Construtor RNSA
-A classe ``RNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
+A classe ``RNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
```python
class RNSA(
@@ -44,39 +43,39 @@ class RNSA(
* *N* (``int``): Quantidade de detectores. Defaults to ``100``.
* *r* (``float``): Raio do detector. Defaults to ``0.05``.
+
:::note
É importante considerar que definir um raio muito baixo para o detector pode reduzir significativamente a taxa de detecção. Por outro lado, um raio muito grande pode inviabilizar a incorporação do detector no espaço de busca, o que também pode comprometer o desempenho da detecção. É fundamental encontrar um equilíbrio entre o tamanho do raio e a eficiência da detecção para obter os melhores resultados possíveis.
:::
-
* *k* (``int``): Quantidade de vizinhos próximos dos detectores gerados aleatoriamente para efetuar o cálculo da média da distância. Defaults to ``1``.
-* *metric* (``str``): Forma para se calcular a distância entre o detector e a amostra:
-
- * ``'euclidiana'`` ➜ O cálculo da distância dá-se pela expressão: $$\sqrt{(X_1 - X_1)^2 + (Y_2 - Y_2)^2 + ... + (Y_n - Y_n)^2}$$.
- * ``'minkowski'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - Y_1|^p + |X_2 - Y_2|^p + ... |X_n - Y_n|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - X_1| + |Y_2 - Y_2| + ... + |Y_n - Y_n|)$$.
+* *metric* (``str``): Forma para se calcular a distância entre o detector e a amostra:
+
+ * ``'euclidiana'`` ➜ O cálculo da distância dá-se pela expressão: $$\sqrt{(X_1 - X_1)^2 + (Y_2 - Y_2)^2 + ... + (Y_n - Y_n)^2}$$.
+ * ``'minkowski'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - Y_1|^p + |X_2 - Y_2|^p + ... |X_n - Y_n|^p)^\frac{1}{p}$$.
+ * ``'manhattan'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - X_1| + |Y_2 - Y_2| + ... + |Y_n - Y_n|)$$.
Defaults to ``'euclidean'``.
-* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
+* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
possível loop infinito caso seja definido um raio que não seja possível gerar detectores do não-próprio. Defaults to ``1000``.
* *seed* (``int``): Semente para a geração randômica dos valores nos detectores. Defaults to ``None``.
* *algorithm* (``str``), Definir a versão do algoritmo:
- * ``'default-NSA'``: Algoritmo padrão com raio fixo.
- * ``'V-detector'``: Este algoritmo é baseado no artigo "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", de autoria de Ji, Z., Dasgupta, D. (2004), e utiliza um raio variável para a detecção de anomalias em espaços de características.
+ * ``'default-NSA'``: Algoritmo padrão com raio fixo.
+ * ``'V-detector'``: Este algoritmo é baseado no artigo "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", de autoria de Ji, Z., Dasgupta, D. (2004), e utiliza um raio variável para a detecção de anomalias em espaços de características.
Defaults to ``'default-NSA'``.
* *r_s* (``float``): O valor de ``rₛ`` é o raio das amostras próprias da matriz ``X``.
-- ``**kwargs``:
- - *non_self_label* (``str``): Esta variável armazena o rótulo que será atribuído quando os dados possuírem
+
+* ``**kwargs``:
+ * *non_self_label* (``str``): Esta variável armazena o rótulo que será atribuído quando os dados possuírem
apenas uma classe de saída, e a amostra for classificada como não pertencente a essa classe. Defaults to ``'non-self'``.
-
- - *cell_bounds* (``bool``): Se definido como ``True``, esta opção limita a geração dos detectores ao espaço do plano compreendido entre 0 e 1. Isso significa que qualquer detector cujo raio ultrapasse esse limite é descartado, e esta variável é usada exclusivamente no algoritmo ``V-detector``.
- - p (``float``): Este parâmetro armazena o valor de ``p`` utilizada na distância de Minkowski. O padrão é ``2``, o que significa distância euclidiana normalizada. Diferentes valores de p levam a diferentes variantes da distância de Minkowski [saiba mais](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
-
+
+ * *cell_bounds* (``bool``): Se definido como ``True``, esta opção limita a geração dos detectores ao espaço do plano compreendido entre 0 e 1. Isso significa que qualquer detector cujo raio ultrapasse esse limite é descartado, e esta variável é usada exclusivamente no algoritmo ``V-detector``.
+ * p (``float``): Este parâmetro armazena o valor de ``p`` utilizada na distância de Minkowski. O padrão é ``2``, o que significa distância euclidiana normalizada. Diferentes valores de p levam a diferentes variantes da distância de Minkowski [saiba mais](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
**Outras variáveis iniciadas:**
@@ -93,10 +92,12 @@ A função ``fit(...)`` gera os detectores para os não próprios com relação
```python
def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
```
+
Nela é realizado o treinamento de acordo com ``X`` e ``y``, usando o método de seleção negativa(``NegativeSelect``).
**Os parâmetros de entrada são:**
-* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
+
+* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
* ``y``: array com as classes de saídas disposto em **N** amostras que são relacionadas ao ``X``.
* ``verbose``: boolean com valor padrão ``True``, determina se o feedback da geração dos detectores será impresso.
@@ -113,11 +114,12 @@ def predict(self, X: npt.NDArray) -> npt.NDArray:
```
**O parâmetro de entrada:**
-
+
* ``X``: array com as características para a previsão, com **N** amostras (Linhas) e **N** colunas.
-**Retorna:**
-* ``C``: Um array de previsão com as classes de saída para as características informadas.
+**Retorna:**
+
+* ``C``: Um array de previsão com as classes de saída para as características informadas.
* ``None``: se não houver detectores.
---
@@ -147,9 +149,10 @@ def __checks_valid_detector(self, X: npt.NDArray, vector_x: npt.NDArray, samples
```
**Os parâmetros de entrada são:**
+
* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
-* ``vector_x``: Detector candidato gerado aleatoriamente.
+* ``vector_x``: Detector candidato gerado aleatoriamente.
* ``samplesIndexClass``: Array com os indexes de uma classe.
@@ -173,14 +176,14 @@ def __compare_KnearestNeighbors_List(self, knn: npt.NDArray, distance: float) ->
Função para comparar uma amostra com os detectores, verificando se a amostra é própria.
-
Nesta função, quando possui ambiguidade de classes, retorna a classe que possuir a média de distância maior entre os detectores.
**Os parâmetros de entrada são:**
+
* line: vetor com N-características
**Retorna:** A classe prevista com os detectores ou None se a amostra não se qualificar a nenhuma classe.
-
+
---
### Função __detector_is_valid_to_Vdetector(...)
@@ -227,4 +230,4 @@ def __slice_index_list_by_class(self, y: npt.NDArray) -> dict:
Retorna um dicionario com as classes como chave e os índices em ``X`` das amostras.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/aisp-techniques/README.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/aisp-techniques/README.md
index ed70c568..2425b41c 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/aisp-techniques/README.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/aisp-techniques/README.md
@@ -4,15 +4,15 @@ sidebar_position: 2
# Técnicas implementadas
-# Classes AISP
+## Classes AISP
Classes implementadas utilizando as metáforas do sistemas imunológicos artificiais.
---
-## Classe do módulo:
+## Classe do módulo
> 1. [**Seleção negativa**](./Negative%20Selection/)
> 2. **Algoritmos de Seleção Clonal**
> 3. **Células dendríticas**
-> 4. **Teoria da Rede Imune**
\ No newline at end of file
+> 4. **Teoria da Rede Imune**
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/intro.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/intro.md
index 5e1209f6..d4a73f07 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/intro.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.1.x/intro.md
@@ -24,10 +24,11 @@ keywords:
- Immune-inspired Algorithms
---
-# Pacote de Sistemas Imunológicos Artificiais.
+# Pacote de Sistemas Imunológicos Artificiais
+
-
+
@@ -37,9 +38,9 @@ keywords:
**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).
-### Algoritmos implementados:
+### Algoritmos implementados
-> - [x] [**Seleção Negativa.**](/docs/0.1.x/aisp-techniques/Negative%20Selection/)
+> - [x] [**Seleção Negativa.**](./aisp-techniques/Negative%20Selection/)
> - [ ] *Algoritmos de Seleção Clonal.*
> - [ ] *Células Dendríticas.*
> - [ ] *Teoria da Rede Imune.*
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/About us.mdx b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/About us.mdx
index a8a81fbf..fb136e1e 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/About us.mdx
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/About us.mdx
@@ -26,7 +26,7 @@ pertencentes à área de sistemas imunológicos artificiais.
name='Alison Zille Lopes'
date='2022'
githubUrl='https://github.com/alisonzille'
- lattesUrl='http://lattes.cnpq.br/3294097090760981'
+ lattesUrl='https://lattes.cnpq.br/3294097090760981'
/>
@@ -42,7 +42,7 @@ pertencentes à área de sistemas imunológicos artificiais.
date='2022-2023'
description="Fui encarregado de implementar a versão 0.1, que apresenta as classes de seleção negativa BNSA e RNSA, incluindo as versões de raio fixo e variável."
githubUrl='https://github.com/Joao-Paulo-Silva'
- lattesUrl='http://lattes.cnpq.br/2561057724411407'
+ lattesUrl='https://lattes.cnpq.br/2561057724411407'
/>
\ No newline at end of file
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Examples/Classification/csa.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Examples/Classification/csa.md
index 6549d751..3e622c8f 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Examples/Classification/csa.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Examples/Classification/csa.md
@@ -26,30 +26,34 @@ keywords:
- reconhecimpt-brto imune
---
-# Algoritmo de Seleção Clonal
-
Esta página apresenta uma coleção de exemplos práticos demonstrando como usar o Algoritmo de Seleção Clonal.
## AIRS (Sistema Imunológico Artificial de Reconhecimento)
-
Run online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fpt%2Dbr%2Fclassification%2FAIRS)
---
### Algoritmo Binário
-+ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/example_with_randomly_gpt-brerated_dataset-pt-br.ipynb)
++ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/example_with_randomly_gpt-brerated_dataset-pt-br.ipynb)
+
> No exemplo apresentado neste notebook, foram geradas 1000 amostras aleatórias, organizadas em dois grupos, um para cada classe.
+ [Exemplo com banco de dados de cogumelos](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/mushrooms_dataBase_example_pt-br.ipynb)
+
> Utiliza o [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), que contém informações sobre cogumelos comestíveis e venenosos.
### Algoritmo com Valores Reais
-+ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/example_with_randomly_gpt-brerated_dataset-pt-br.ipynb)
++ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/example_with_randomly_gpt-brerated_dataset-pt-br.ipynb)
+
> No exemplo apresentado neste notebook, foram geradas 500 amostras aleatórias, organizadas em dois grupos, um para cada classe. Podemos ver abaixo os detectores "não-próprio" gerados.
+
+ [Exemplo com banco de dados Iris](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/iris_dataBase_example_pt-br.ipynb)
+
> Exemplo usando o NSA com o [iris database](https://archive.ics.uci.edu/ml/datasets/iris), que contém amostras com quatro dimensões e três classes de saída (Setosa, Versicolor e Virginica).
+
+ [Exemplo com banco de dados Geyser](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/geyser_dataBase_example_pt-br.ipynb)
-> Para classificar erupções de gêiseres no Parque Nacional de Yellowstone, este notebook utiliza o [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
\ No newline at end of file
+
+> Para classificar erupções de gêiseres no Parque Nacional de Yellowstone, este notebook utiliza o [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Examples/Classification/nsa.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Examples/Classification/nsa.md
index 3a12e3d5..946c60c6 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Examples/Classification/nsa.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Examples/Classification/nsa.md
@@ -35,9 +35,11 @@ Execute on-line via Binder: [](htt
---
+ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/BNSA/example_with_randomly_generated_dataset-pt.ipynb)
+
> No exemplo presente neste notebook, foram geradas 1000 amostras aleatórias, organizadas em dois grupos, um para cada classe.
+ [Exemplo de Base de Dados de Cogumelos](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/BNSA/mushrooms_dataBase_example_pt.ipynb)
+
> Ele usa a [base de dados de cogumelos](https://archive.ics.uci.edu/dataset/73/mushroom), que contém informações sobre cogumelos comestíveis e venenosos.
## RNSA (Algoritmo de Seleção Negativa de Valores Reais)
@@ -47,10 +49,13 @@ Execute on-line via Binder: [](htt
---
+ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/example_with_randomly_generated_dataset-pt.ipynb)
+
> No exemplo presente neste notebook, foram geradas 500 amostras aleatórias, organizadas em dois grupos, um para cada classe.
+ [Exemplo de Base de Dados Iris](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/iris_dataBase_example_pt.ipynb)
+
> Exemplo usando a base de dados [íris](https://archive.ics.uci.edu/ml/datasets/iris), que contém amostras de quatro dimensões e três classes de saída (Setosa, Versicolor e Virginica).
+ [Exemplo de Base de Dados Geyser](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/geyser_dataBase_example_pt.ipynb)
+
> Para classificar erupções de geysers no Parque Nacional de Yellowstone, este notebook usa a [base de dados Old Faithful](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Getting Started/basic use/AIRS.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Getting Started/basic use/AIRS.md
index c6aadffc..06ebeb01 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Getting Started/basic use/AIRS.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Getting Started/basic use/AIRS.md
@@ -28,16 +28,15 @@ keywords:
- immune recognition
---
-# Usando o AIRS
-
Acesse o notebook Jupyter com o código disponível [aqui](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/example_with_randomly_generated_dataset-pt.ipynb)!
### Importação do Sistema de Reconhecimento Imunológico Artificial
+
```python
from aisp.csa import AIRS
```
-### Gerando bolhas de dados para as classe aleatoriamente.
+### Gerando bolhas de dados para as classe aleatoriamente
Utilizando a função make_blobs, são gerados dois conjuntos de dados em forma de bolhas, no intervalo entre 0 e 1, representando cada classe x e y. Em seguida, esses dados são separados em conjuntos de teste e treinamento.
@@ -59,7 +58,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-### Testing the model AIRS:
+### Testing the model AIRS
Em seguida, apresenta o resultado da acurácia da previsão.
@@ -79,6 +78,7 @@ print(classification_report(test_y, prev))
```
Output:
+
```bash
✔ Set of memory cells for classes (0, 1) successfully generated: ┇██████████┇ 400/400 memory cells for each aᵢ
A acurácia é 1.0
@@ -94,6 +94,6 @@ weighted avg 1.00 1.00 1.00 100
---
-### Célula de memória e plotagem de amostra:
+### Célula de memória e plotagem de amostra
-
\ No newline at end of file
+
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Getting Started/basic use/BNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Getting Started/basic use/BNSA.md
index 234230e3..a2498bab 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Getting Started/basic use/BNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Getting Started/basic use/BNSA.md
@@ -22,10 +22,7 @@ keywords:
- Computação Natural
---
-# Aplicando o BNSA
-
-O presente exemplo, disponível aqui, visa demonstrar a aplicação do algoritmo de seleção negativa binária. Esse algoritmo é empregado na classificação de amostras com características discretas.
-
+O presente exemplo, disponível aqui, visa demonstrar a aplicação do algoritmo de seleção negativa binária. Esse algoritmo é empregado na classificação de amostras com características discretas.
Acesse o notebook Jupyter disponível [aqui](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/BNSA/example_with_randomly_generated_dataset-pt.ipynb)!
@@ -62,7 +59,7 @@ def generate_samples(n_samples: int, n_features: int, s: float, x: None):
---
-Cada classe contará com 500 amostras, sendo a similaridade mínima entre amostras de 80% (s = 0.2). Essas classes serão separadas em conjunto de treinamento (800 amostras) e de teste (200 amostras).
+Cada classe contará com 500 amostras, sendo a similaridade mínima entre amostras de 80% (s = 0.2). Essas classes serão separadas em conjunto de treinamento (800 amostras) e de teste (200 amostras).
```python
# Configurando a seed para 121 para garantir a reprodutibilidade dos dados gerados.
@@ -88,7 +85,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-## Treinamento:
+## Treinamento
O modelo é ajustado através dos padrões de treinamento. Nessa aplicação, a seleção negativa distribuirá, com taxa de diferenciação de 30%, 250 detectores pelo espaço de entradas.
@@ -105,7 +102,8 @@ print(classification_report(test_y, prev))
```
Output:
-```
+
+```bash
✔ Non-self detectors for classes (x, y) successfully generated: ┇██████████┇ 500/500 detectors
A acurácia é 0.93
precision recall f1-score support
@@ -121,6 +119,7 @@ weighted avg 0.93 0.93 0.93 200
---
## Avaliação
+
O modelo obteve 0,93 de acurácia para o conjunto teste. A precisão na classificação, tanto para x quanto para y, também foi de 0,93. Isso pode ser observado pela matriz de confusão na Figura 1.
-
\ No newline at end of file
+
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Getting Started/basic use/RNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Getting Started/basic use/RNSA.md
index 581946be..43307802 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Getting Started/basic use/RNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Getting Started/basic use/RNSA.md
@@ -22,16 +22,16 @@ keywords:
- Computação Natural
---
-# Usando o RNSA
Acesse o notebook Jupyter com o código disponível [aqui](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/example_with_randomly_generated_dataset-pt.ipynb)!
-## Importando o Algoritmo de seleção negativa de valor real.
+## Importando o Algoritmo de seleção negativa de valor real
+
```python
from aisp.nsa import RNSA
```
-## Gerando bolhas de dados para as classe aleatoriamente.
+## Gerando bolhas de dados para as classe aleatoriamente
Utilizando a função make_blobs, são gerados dois conjuntos de dados em forma de bolhas, no intervalo entre 0 e 1, representando cada classe x e y. Em seguida, esses dados são separados em conjuntos de teste e treinamento.
@@ -47,7 +47,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-## Testando o modelo `default-NSA`:
+## Testando o modelo `default-NSA`
Inicia o modelo com 500 detectores, cada um com um raio de 0.06. Em seguida, apresenta o resultado da acurácia da previsão.
@@ -66,6 +66,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```bash
✔ Non-self detectors for classes (0, 1) successfully generated: ┇██████████┇ 1000/1000 detectors
The accuracy is 1.0
@@ -81,13 +82,13 @@ weighted avg 1.00 1.00 1.00 100
---
-## Plotagem dos detector e amostras:
+## Plotagem dos detector e amostras
-
+
---
-## Testando o modelo `V-detector`:
+## Testando o modelo `V-detector`
Inicia o modelo com 50 detectores, onde o raio mínimo é de 0.05 e o raio próprio das amostras é de 0.04. Em seguida, mostra o resultado da acurácia da previsão.
@@ -106,6 +107,7 @@ print(classification_report(test_y, prev))
```
Output:
+
```bash
✔ Non-self detectors for classes (0, 1) successfully generated: ┇██████████┇ 100/100 detectors
A acuracia é 1.0
@@ -121,6 +123,6 @@ weighted avg 1.00 1.00 1.00 100
---
-## Plotagem dos detector e amostras:
+## Plotagem dos v-detector e amostras
-
\ No newline at end of file
+
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Getting Started/instalation.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Getting Started/instalation.md
index 169128c3..332103b7 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Getting Started/instalation.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/Getting Started/instalation.md
@@ -11,8 +11,6 @@ last_update:
author: João Paulo
---
-# **Instalação**
-
Esta página contém informações sobre as dependências do pacote, como instalá-lo e como importar os módulos.
### **Dependências:**
@@ -45,4 +43,4 @@ from aisp.nsa import RNSA, BNSA
nsa = RNSA(N=300, r=0.05)
-```
\ No newline at end of file
+```
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Base Classes Reference/csa/airs.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Base Classes Reference/csa/airs.md
index 391b66f4..14365cbb 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Base Classes Reference/csa/airs.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Base Classes Reference/csa/airs.md
@@ -6,7 +6,7 @@ lastUpdatedAt: 2025/05/25
author: João Paulo
---
-# BaseAIRS(BaseClassifier, ABC)
+## BaseAIRS(BaseClassifier, ABC)
Classe base para o algoritmo **AIRS**.
@@ -14,7 +14,7 @@ A classe base contém funções que são utilizadas por mais de uma classe no pa
---
-### def _check_and_raise_exceptions_fit(...):
+### def _check_and_raise_exceptions_fit(...)
Verifica os parâmetros de ajuste (*fit*) e lança exceções caso a verificação não seja bem-sucedida.
@@ -31,8 +31,8 @@ def _check_and_raise_exceptions_fit(
**Parâmetros**:
-* ***X*** (`npt.NDArray`): Array de treinamento, contendo as amostras e suas características, com formato [`N amostras` (linhas)][`N características` (colunas)].
-* ***y*** (`npt.NDArray`): Array das classes alvo de `X` com [`N amostras` (linhas)].
+* ***X*** (`npt.NDArray`): Array de treinamento, contendo as amostras e suas características, com formato \[`N amostras` (linhas)]\[`N características` (colunas)].
+* ***y*** (`npt.NDArray`): Array das classes alvo de `X` com \[`N amostras` (linhas)].
* ***algorithm*** (`Literal["continuous-features", "binary-features"], opcional`): Especifica o tipo de algoritmo a ser usado, dependendo se os dados de entrada possuem características contínuas ou binárias.
**Exceções**:
@@ -44,7 +44,7 @@ def _check_and_raise_exceptions_fit(
---
-### def _check_and_raise_exceptions_predict(...):
+### def _check_and_raise_exceptions_predict(...)
Verifica os parâmetros de predição e lança exceções caso a verificação não seja bem-sucedida.
@@ -61,7 +61,7 @@ def _check_and_raise_exceptions_predict(
**Parâmetros**:
-* ***X*** (`npt.NDArray`): Array de entrada, contendo as amostras e suas características, com formato [`N amostras` (linhas)][`N características` (colunas)].
+* ***X*** (`npt.NDArray`): Array de entrada, contendo as amostras e suas características, com formato \[`N amostras` (linhas)]\[`N características` (colunas)].
* ***expected*** (`int`): Número esperado de características por amostra (colunas de X).
* ***algorithm*** (`Literal["continuous-features", "binary-features"], opcional`): Especifica o tipo de algoritmo a ser usado, dependendo se os dados de entrada possuem características contínuas ou binárias.
@@ -74,4 +74,4 @@ def _check_and_raise_exceptions_predict(
* `ValueError`:
Se o algoritmo for "binary-features" e X contiver valores que não sejam compostos apenas por 0 e 1.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Base Classes Reference/nsa.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Base Classes Reference/nsa.md
index 8cc04381..467bb59c 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Base Classes Reference/nsa.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Base Classes Reference/nsa.md
@@ -6,14 +6,13 @@ lastUpdatedAt: 2025/04/04
author: João Paulo
---
-# ``class BaseNSA(BaseClassifier, ABC)``
-
+## ``class BaseNSA(BaseClassifier, ABC)``
A classe ``BaseNSA`` contém funções utilitárias com o modificador ``protected`` que podem ser herdadas por várias classes para facilitar o uso. Ela inclui funções para calcular distância, separar dados para melhorar a eficiência de treinamento e previsão, medir precisão e outras funções.
---
-## Funções Protegidas:
+## Funções Protegidas
---
@@ -26,20 +25,21 @@ def _check_and_raise_exceptions_fit(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Função responsável por verificar os parâmetros da função fit e lançar exceções se a verificação não for bem-sucedida.
**Parâmetros**:
-* **X** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, [``N samples`` (linhas)][``N features`` (colunas)].
-* ***y*** (``npt.NDArray``): Array de classes alvo de ``X`` com [``N samples`` (linhas)].
-* ***_class_*** (Literal[RNSA, BNSA], opcional): Classe atual. O padrão é 'RNSA'.
+* **X** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, \[``N samples`` (linhas)\]\[``N features`` (colunas)].
+* ***y*** (``npt.NDArray``): Array de classes alvo de ``X`` com \[``N samples`` (linhas)].
+* ****class**** (Literal[RNSA, BNSA], opcional): Classe atual. O padrão é 'RNSA'.
**Lança:**
+
* ``TypeError``: Se X ou y não forem ndarrays ou tiverem formas incompatíveis.
* ``MaxDiscardsReachedError``: O número máximo de descartes do detector foi atingido durante
a maturação. Verifique o valor do raio definido e considere reduzi-lo.
-
### def _check_and_raise_exceptions_predict(...)
```python
@@ -49,13 +49,16 @@ def _check_and_raise_exceptions_predict(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Função responsável por verificar os parâmetros da função predict e lançar exceções caso a verificação não seja bem-sucedida.
**Parâmetros**:
-* ***X*** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, [``N samples`` (linhas)][``N features`` (colunas)].
+
+* ***X*** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, \[``N samples`` (linhas)\]\[``N features`` (colunas)].
* ***expected*** (``int``): Número esperado de características por amostra (colunas em X).
-* ***_class_*** (``Literal[RNSA, BNSA], opcional``): Classe atual. O padrão é 'RNSA'.
+* ****class**** (``Literal[RNSA, BNSA], opcional``): Classe atual. O padrão é 'RNSA'.
**Lança:**
+
* ``TypeError``: Se X ou y não forem ndarrays ou tiverem formas incompatíveis.
* ``MaxDiscardsReachedError``: O número máximo de descartes do detector foi atingido durante
a maturação. Verifique o valor do raio definido e considere reduzi-lo.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Base module/Classifier.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Base module/Classifier.md
index 48624519..859b9c2d 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Base module/Classifier.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Base module/Classifier.md
@@ -1,21 +1,19 @@
---
sidebar_position: 1
-title: Classification
sidebar_label: BaseClassifier
last_update:
date: 2025/05/17
author: João Paulo
---
-# Classe base para algoritmo de classificação.
+# Classe base para algoritmo de classificação
-## ``class BaseClassifier(ABC)``:
+## ``class BaseClassifier(ABC)``
Classe base para algoritmos de classificação, definindo os métodos abstratos ``fit`` e ``predict``, e implementando o método ``get_params``.
## Abstract methods
-
### def fit(...)
```python
@@ -26,10 +24,8 @@ Ajusta o modelo aos dados de treinamento.
Implementação:
-- [RNSA](/docs/0.2.x/aisp-techniques/Negative%20Selection/rnsa#Função-fit)
-- [BNSA](/docs/0.2.x/aisp-techniques/Negative%20Selection/bnsa#Função-fit)
-
-
+- [RNSA](../../aisp-techniques/Negative%20Selection/RNSA.md#Função-fit)
+- [BNSA](../../aisp-techniques/Negative%20Selection/BNSA.md#Função-fit)
### def predict(...)
@@ -41,8 +37,8 @@ Realiza a previsão dos rótulos para os dados fornecidos.
Implementação:
-- [RNSA](/docs/0.2.x/aisp-techniques/Negative%20Selection/rnsa#Função-predict)
-- [BNSA](/docs/0.2.x/aisp-techniques/Negative%20Selection/bnsa#Função-predict)
+- [RNSA](../../aisp-techniques/Negative%20Selection/RNSA.md#Função-predict)
+- [BNSA](../../aisp-techniques/Negative%20Selection/BNSA.md#Função-predict)
---
@@ -56,23 +52,24 @@ def score(self, X: npt.NDArray, y: list) -> float
A função de pontuação (score) calcula a precisão da previsão.
-Esta função realiza a previsão de X e verifica quantos elementos são iguais entre o vetor y e y_predicted.
+Esta função realiza a previsão de X e verifica quantos elementos são iguais entre o vetor y e y_predicted.
Esta função foi adicionada para compatibilidade com algumas funções do scikit-learn.
**Parâmetros**:
-+ ***X***: np.ndarray
+
+- ***X***: np.ndarray
Conjunto de características com formato (n_amostras, n_características).
-+ ***y***: np.ndarray
+- ***y***: np.ndarray
Valores verdadeiros com formato (n_amostras,).
**Retorna**:
-+ precisão: float
+- precisão: float
A precisão do modelo.
---
-### Método _slice_index_list_by_class(...):
+### Método _slice_index_list_by_class(...)
A função ``_slice_index_list_by_class(...)``, separa os índices das linhas conforme a classe de saída, para percorrer o array de amostra, apenas nas posições que a saída for a classe que está sendo treinada:
@@ -89,6 +86,7 @@ Retorna um dicionário com as classes como chave e os índices em ``X`` das amos
```python
def get_params(self, deep: bool = True) -> dict:
```
+
A função get_params retorna um dicionário com os parâmetros principais do objeto.
Esta função é necessária para garantir a compatibilidade com as funções do scikit-learn.
@@ -101,5 +99,5 @@ Representa um detector não-próprio do class RNSA.
**Atributos:**
-* ***position*** (``np.ndarray``): Vetor de características do detector.
-* ***radius*** (``float, opcional``): Raio do detector, utilizado no algoritmo V-detector.
\ No newline at end of file
+- ***position*** (``np.ndarray``): Vetor de características do detector.
+- ***radius*** (``float, opcional``): Raio do detector, utilizado no algoritmo V-detector.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Base module/Mutation.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Base module/Mutation.md
index d52dd8fd..e3590818 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Base module/Mutation.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Base module/Mutation.md
@@ -50,7 +50,6 @@ Esta função cria `n` clones do vetor binário de entrada e aplica mutações a
* `clone_set` (`npt.NDArray[np.bool_]`): Array com forma `(n, len(vector))` contendo os `n` clones mutados do vetor original.
-
---
## clone_and_mutate_ranged
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Core/Negative Selection.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Core/Negative Selection.md
index 6777640c..9041d2b2 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Core/Negative Selection.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Core/Negative Selection.md
@@ -8,7 +8,7 @@ last_update:
As funções realizam verificações de detectores e utilizam decoradores Numba para compilação Just-In-Time.
-### Função check_detector_bnsa_validity(...):
+## Função check_detector_bnsa_validity(...)
```python
def check_detector_bnsa_validity(
@@ -20,19 +20,19 @@ def check_detector_bnsa_validity(
Verifica a validade de um candidato a detector (vector_x) contra amostras de uma classe (x_class) usando a distância de Hamming. Um detector é considerado INVÁLIDO se a sua distância para qualquer amostra em ``x_class`` for menor ou igual a ``aff_thresh``.
-
**Os parâmetros de entrada são:**
+
* x_class (``npt.NDArray``): Array contendo as amostras da classe. Formato esperado: (n_amostras, n_características).
* vector_x (``npt.NDArray``): Array representando o detector. Formato esperado: (n_características,).
* aff_thresh (``float``): Limiar de afinidade.
+**Retorna:**
-**Retorna:**
* True se o detector for válido, False caso contrário.
---
-### Função bnsa_class_prediction(...):
+## Função bnsa_class_prediction(...)
```python
def bnsa_class_prediction(
@@ -41,19 +41,22 @@ def bnsa_class_prediction(
aff_thresh: float
) -> int:
```
+
Define a classe de uma amostra a partir dos detectores não-próprios.
**Os parâmetros de entrada são:**
+
* features (``npt.NDArray``): amostra binária a ser classificada (shape: [n_features]).
-* class_detectors (``npt.NDArray``): Matriz contendo os detectores de todas as classes (shape: [n_classes, n_detectors, n_features]).
+* class_detectors (``npt.NDArray``): Matriz contendo os detectores de todas as classes (shape: [n_classes, n_detectors, n_features]).
* aff_thresh (``float``): Limiar de afinidade que determina se um detector reconhece a amostra como não-própria.
-**Retorna:**
+**Retorna:**
+
* int: Índice da classe predita. Retorna -1 se for não-própria para todas as classes.
---
-### Função check_detector_rnsa_validity(...):
+## Função check_detector_rnsa_validity(...)
```python
def check_detector_rnsa_validity(
@@ -64,18 +67,19 @@ def check_detector_rnsa_validity(
p: float
) -> bool:
```
-Verifica a validade de um candidato a detector (vector_x) contra amostras de uma classe (x_class) usando a distância de Hamming. Um detector é considerado INVÁLIDO se a sua distância para qualquer amostra em ``x_class`` for menor ou igual a ``aff_thresh``.
+Verifica a validade de um candidato a detector (vector_x) contra amostras de uma classe (x_class) usando a distância de Hamming. Um detector é considerado INVÁLIDO se a sua distância para qualquer amostra em ``x_class`` for menor ou igual a ``aff_thresh``.
**Os parâmetros de entrada são:**
+
* x_class (``npt.NDArray``): Array contendo as amostras da classe. Formato esperado: (n_amostras, n_características).
* vector_x (``npt.NDArray``): Array representando o detector. Formato esperado: (n_características,).
* threshold (``float``): Afinidade.
* metric (``int``): Métrica de distância a ser utilizada. Opções disponíveis: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)].
* p (``float``): Parâmetro da métrica de Minkowski (utilizado apenas se `metric` for "minkowski").
+**Retorna:**
-**Retorna:**
* True se o detector for válido, False caso contrário.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Distance.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Distance.md
index 3238ee07..4c4e896f 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Distance.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Distance.md
@@ -16,15 +16,15 @@ def hamming(u: npt.NDArray, v: npt.NDArray) -> np.float64:
Função para calcular a distância de Hamming normalizada entre dois pontos.
-
$((x₁ ≠ x₂) + (y₁ ≠ y₂) + ... + (y_n ≠ y_n)) / n$
-
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto
* v (``npt.NDArray``): Coordenadas do segundo ponto.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -39,13 +39,13 @@ Função para calcular a distância euclidiana normalizada entre dois pontos.
$√( (x₁ - x₂)² + (y₁ - y₂)² + ... + (y_n - y_n)²)$
-
-
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto
* v (``npt.NDArray``): Coordenadas do segundo ponto.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -57,15 +57,16 @@ def cityblock(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64]) -> np.floa
```
Função para calcular a distância Manhattan normalizada entre dois pontos.
-
-$(|x₁ - x₂| + |y₁ - y₂| + ... + |y_n - y_n|) / n$
+$(|x₁ - x₂| + |y₁ - y₂| + ... + |y_n - y_n|) / n$
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto
* v (``npt.NDArray``): Coordenadas do segundo ponto.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -77,19 +78,20 @@ def minkowski(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64], p: float =
```
Função para calcular a distância de Minkowski normalizada entre dois pontos.
-
-$(( |X₁ - Y₁|p + |X₂ - Y₂|p + ... + |X_n - Y_n|p) ¹/ₚ) / n$
+$(( |X₁ - Y₁|p + |X₂ - Y₂|p + ... + |X_n - Y_n|p) ¹/ₚ) / n$
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto.
* v (``npt.NDArray``): Coordenadas do segundo ponto.
* p (``float``): O parâmetro p define o tipo de distância a ser calculada:
- - p = 1: Distância **Manhattan** — soma das diferenças absolutas.
- - p = 2: Distância **Euclidiana** — soma das diferenças ao quadrado (raiz quadrada).
- - p > 2: Distância **Minkowski** com uma penalidade crescente à medida que p aumenta.
+ * p = 1: Distância **Manhattan** — soma das diferenças absolutas.
+ * p = 2: Distância **Euclidiana** — soma das diferenças ao quadrado (raiz quadrada).
+ * p > 2: Distância **Minkowski** com uma penalidade crescente à medida que p aumenta.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -107,15 +109,15 @@ def compute_metric_distance(
Função para calcular a distância entre dois pontos pela ``métrica`` escolhida.
-
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto.
* v (``npt.NDArray``): Coordenadas do segundo ponto.
* metric (``int``): Métrica de distância a ser utilizada. Opções disponíveis: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)].
* p (``float``): Parâmetro da métrica de Minkowski (utilizado apenas se `metric` for "minkowski").
-
**Returns:**
+
* Distância (``double``) entre os dois pontos com a métrica selecionada.
---
@@ -134,12 +136,14 @@ def min_distance_to_class_vectors(
Calcula a menor distância entre um vetor de entrada e os vetores de uma classe.
**Parameters:**
+
* x_class (``npt.NDArray``): Array contendo os vetores da classe com os quais o vetor de entrada será comparado. Formato esperado: (n_amostras, n_características).
* vector_x (``npt.NDArray``): Vetor a ser comparado com os vetores da classe. Formato esperado: (n_características,).
* metric (``int``): Métrica de distância a ser utilizada. Opções disponíveis: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)].
* p (``float``): Parâmetro da métrica de Minkowski (utilizado apenas se `metric` for "minkowski").
**Returns:**
+
* float: A menor distância calculada entre o vetor de entrada e os vetores da classe.
* Retorna -1.0 se as dimensões de entrada forem incompatíveis.
@@ -150,15 +154,17 @@ Calcula a menor distância entre um vetor de entrada e os vetores de uma classe.
```python
def get_metric_code(metric: str) -> int:
```
+
Retorna o código numérico associado a uma métrica de distância.
**Parameters:**
-* metric (``str``): Nome da métrica. Pode ser "euclidean", "manhattan", "minkowski" ou "hamming".
+* metric (``str``): Nome da métrica. Pode ser "euclidean", "manhattan", "minkowski" ou "hamming".
**Raises**
-----------
+
* ``ValueError``: Se a métrica informada não for suportada.
**Returns:**
-* ``int``: Código numérico correspondente à métrica.
\ No newline at end of file
+
+* ``int``: Código numérico correspondente à métrica.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Metrics.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Metrics.md
index dac82b80..087cd9e8 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Metrics.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Metrics.md
@@ -8,7 +8,7 @@ author: João Paulo
O arquivo de métricas fornece utilitários para medir, analisar e comparar o desempenho dos algoritmos do pacote de forma padronizada.
-#### def accuracy_score(...)
+### def accuracy_score(...)
```python
def accuracy_score(
@@ -20,19 +20,22 @@ def accuracy_score(
Função para calcular a acurácia de precisão com base em listas de rótulos
verdadeiros e nos rótulos previstos.
-Parâmetros:
+Parâmetros
---
+
* y_true (``Union[npt.NDArray, list]``): Rótulos verdadeiros (corretos)..
* y_pred (``Union[npt.NDArray, list]``): Rótulos previstos.
-Retornos:
+Retornos
---
+
* Precisão (``float``): A proporção de previsões corretas em relação
ao número total de previsões.
-Lança:
+Lança
---
+
* ValueError: Se `y_true` ou `y_pred` estiverem vazios ou se não
tiverem o mesmo tamanho.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Multiclass.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Multiclass.md
index b05b1e60..96d2640a 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Multiclass.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Multiclass.md
@@ -18,12 +18,14 @@ A função ``slice_index_list_by_class(...)``, separa os índices das linhas con
classe de saída, para percorrer o array de amostra, apenas nas posições que a saída for \
a classe que está sendo treinada.
-Parameters:
+Parameters
---
- * classes (``list or npt.NDArray``): lista com classes únicas.
- * y (npt.NDArray): Recebe um array ``y``[``N amostra``] com as classes de saída do \
- array de amostra ``X``.
-
- Returns:
- ---
- * dict: Um dicionário com a lista de posições do array(``y``), com as classes como chave.
+
+* classes (``list or npt.NDArray``): lista com classes únicas.
+* y (npt.NDArray): Recebe um array ``y``[``N amostra``] com as classes de saída do \
+ array de amostra ``X``.
+
+Returns
+---
+
+* dict: Um dicionário com a lista de posições do array(``y``), com as classes como chave.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Sanitizers.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Sanitizers.md
index 27d1ca40..13ede0db 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Sanitizers.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Sanitizers.md
@@ -15,12 +15,13 @@ def sanitize_choice(value: T, valid_choices: Iterable[T], default: T) -> T
A função ``sanitize_choice(...)``, retorna o valor se estiver presente no conjunto de opções válidas; caso contrário, retorna o valor padrão.
**Parameters:**
+
* ***value*** (``T``): O valor a ser verificado.
* ***valid_choices*** (``Iterable[T]``): Uma coleção de opções válidas.
* ***default***: O valor padrão a ser retornado se ``value`` não estiver em ``valid_choices``.
-
**Returns:**
+
* `T`: O valor original, se válido, ou o valor padrão, se não.
---
@@ -34,12 +35,13 @@ def sanitize_param(value: T, default: T, condition: Callable[[T], bool]) -> T:
A função ``sanitize_param(...)``, retorna o valor se ele satisfizer a condição especificada; caso contrário, retorna o valor padrão.
**Parameters:**
+
* value (``T``): O valor a ser verificado.
* default (``T``): O valor padrão a ser retornado se a condição não for satisfeita.
* condition (``Callable[[T], bool]``): Uma função que recebe um valor e retorna um booleano, determinando se o valor é válido.
-
**Returns:**
+
* `T`: O valor original se a condição for satisfeita, ou o valor padrão se não for.
---
@@ -53,8 +55,9 @@ def sanitize_seed(seed: Any) -> Optional[int]:
A função ``sanitize_param(...)``, retorna a semente se for um inteiro não negativo; caso contrário, retorna Nenhum.
**Parameters:**
+
* seed (``Any``): O valor da seed a ser validado.
**Returns:**
-* ``Optional[int]``: A seed original se for um inteiro não negativo, ou ``None`` se for inválido.
+* ``Optional[int]``: A seed original se for um inteiro não negativo, ou ``None`` se for inválido.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Validation.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Validation.md
index 9d6c23ed..711e2392 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Validation.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/advanced-guides/Utils/Validation.md
@@ -7,6 +7,7 @@ def detect_vector_data_type(
vector: npt.NDArray
) -> FeatureType:
```
+
Detecta o tipo de dado em um determinado vetor.
Esta função analisa o vetor de entrada e classifica seus dados como um dos tipos suportados:
@@ -25,4 +26,4 @@ Esta função analisa o vetor de entrada e classifica seus dados como um dos tip
**Lança**
-* `UnsupportedDataTypeError`: Gerado se o vetor contiver um tipo de dado não suportado.
\ No newline at end of file
+* `UnsupportedDataTypeError`: Gerado se o vetor contiver um tipo de dado não suportado.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/Cell.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/Cell.md
index 0b6cfa6c..0c3944e3 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/Cell.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/Cell.md
@@ -17,20 +17,17 @@ lastUpdatedAt: 2025/05/25
author: João Paulo
---
-# Célula-B de memória
-
Representa uma célula-B de memória.
-### Construtor:
+### Construtor
Parâmetros:
* **vector** (`npt.NDArray`): Vetor de características da célula. Padrão é None.
-
---
-### Função hyper_clonal_mutate(...):
+### Função hyper_clonal_mutate(...)
Parâmetros:
@@ -51,4 +48,4 @@ def hyper_clonal_mutate(
) -> npt.NDArray
```
-Retorna um array contendo N vetores mutados a partir da célula original.
\ No newline at end of file
+Retorna um array contendo N vetores mutados a partir da célula original.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/airs/README.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/airs/README.md
index 7256681a..7cab8820 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/airs/README.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/airs/README.md
@@ -17,7 +17,6 @@ author: João Paulo
O ``AIRS`` é um algoritmo de classificação inspirado no processo de seleção clonal. A versão implementada nesta classe é inspirada na sua versão simplificada, o AIRS2, descrito em[Brabazon, O'Neill, and McGarraghy (2015)](#1)
-
Esta implementação é inspirada no AIRS2, uma versão simplificada do algoritmo AIRS original, introduzindo adaptações para lidar com conjuntos de dados contínuos e binários.
Com base no algoritmo 16.5 de Brabazon et al. [1](#1).
@@ -34,46 +33,46 @@ Com base no algoritmo 16.5 de Brabazon et al. [1](#1).
:::
-## Construtor AIRS:
+## Construtor AIRS
A classe `AIRS` tem como objetivo realizar classificação utilizando metáforas de seleção e expansão clonal.
**Atributos:**
-* **n_resources** (`float`): Quantidade total de recursos disponíveis. O padrão é 10.
+- **n_resources** (`float`): Quantidade total de recursos disponíveis. O padrão é 10.
-* **rate_clonal** (`float`): Número máximo de clones possíveis de uma classe. Esta quantidade é multiplicada por (estímulo da célula * taxa de hipermutação) para definir o número de clones. O padrão é 10.
+- **rate_clonal** (`float`): Número máximo de clones possíveis de uma classe. Esta quantidade é multiplicada por (estímulo da célula * taxa de hipermutação) para definir o número de clones. O padrão é 10.
-* **rate_hypermutation** (`int`): Taxa de clones mutados derivada de rate_clonal como um fator escalar. O padrão é 0,75.
+- **rate_hypermutation** (`int`): Taxa de clones mutados derivada de rate_clonal como um fator escalar. O padrão é 0,75.
-* **affinity_threshold_scalar** (`float`): Limiar de afinidade normalizado. O padrão é 0,75.
+- **affinity_threshold_scalar** (`float`): Limiar de afinidade normalizado. O padrão é 0,75.
-* **k** (`int`): Número de vizinhos mais próximos (k-NN) que será usado para escolher um rótulo na predição. O padrão é 10.
+- **k** (`int`): Número de vizinhos mais próximos (k-NN) que será usado para escolher um rótulo na predição. O padrão é 10.
-* **max_iters** (`int`): Número máximo de interações no processo de refinamento do conjunto ARB exposto a aᵢ. O padrão é 100.
+- **max_iters** (`int`): Número máximo de interações no processo de refinamento do conjunto ARB exposto a aᵢ. O padrão é 100.
-* **resource_amplified** (`float`): Amplificador de consumo de recursos, multiplicado com o estímulo para subtrair recursos. O padrão é 1.0 (sem amplificação).
+- **resource_amplified** (`float`): Amplificador de consumo de recursos, multiplicado com o estímulo para subtrair recursos. O padrão é 1.0 (sem amplificação).
-* **metric** (Literal["manhattan", "minkowski", "euclidean"]): Forma de calcular a distância entre o detector e a amostra:
+- **metric** (Literal["manhattan", "minkowski", "euclidean"]): Forma de calcular a distância entre o detector e a amostra:
- * ``'euclidiana'`` ➜ O cálculo da distância dá-se pela expressão: $$\sqrt{(X_1 - X_1)^2 + (Y_2 - Y_2)^2 + ... + (Y_n - Y_n)^2}$$.
- * ``'minkowski'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - Y_1|^p + |X_2 - Y_2|^p + ... |X_n - Y_n|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - X_1| + |Y_2 - Y_2| + ... + |Y_n - Y_n|)$$.
+ - ``'euclidiana'`` ➜ O cálculo da distância dá-se pela expressão: $$\sqrt{(X_1 - X_1)^2 + (Y_2 - Y_2)^2 + ... + (Y_n - Y_n)^2}$$.
+ - ``'minkowski'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - Y_1|^p + |X_2 - Y_2|^p + ... |X_n - Y_n|^p)^\frac{1}{p}$$.
+ - ``'manhattan'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - X_1| + |Y_2 - Y_2| + ... + |Y_n - Y_n|)$$.
Defaults to ``'euclidean'``.
-* **seed** (``Optional[int]``): Semente para geração aleatória de valores dos detectores. O padrão é None.
+- **seed** (``Optional[int]``): Semente para geração aleatória de valores dos detectores. O padrão é None.
- `**kwargs`:
- * **p** (`float`): Este parâmetro armazena o valor de `p` usado na distância de Minkowski.
+ - **p** (`float`): Este parâmetro armazena o valor de `p` usado na distância de Minkowski.
O padrão é `2`, que corresponde à distância euclidiana normalizada. Diferentes valores de p resultam em variantes distintas da distância de Minkowski. [Saiba mais](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
**Outras variáveis inicializadas:**
-* **cells_memory** (`dict`): Armazena uma lista de células de memória por classe.
-* **affinity_threshold** (`dict`): Define o limiar de afinidade entre antígenos.
-* **classes** (`npt.NDArray`): Lista de classes de saída.
+- **cells_memory** (`dict`): Armazena uma lista de células de memória por classe.
+- **affinity_threshold** (`dict`): Define o limiar de afinidade entre antígenos.
+- **classes** (`npt.NDArray`): Lista de classes de saída.
---
@@ -91,9 +90,9 @@ Realiza o treinamento conforme `X` e `y`, utilizando o método Sistema de Reconh
**Parâmetros de entrada:**
-* **X**: Array com as características das amostras, com **N** amostras (linhas) e **N** características (colunas), normalizado para valores entre [0, 1].
-* **y**: Array com as classes de saída correspondentes às **N** amostras relacionadas a `X`.
-* **verbose**: Booleano, padrão `True`, determina se o feedback da geração dos detectores será impresso.
+- **X**: Array com as características das amostras, com **N** amostras (linhas) e **N** características (colunas), normalizado para valores entre [0, 1].
+- **y**: Array com as classes de saída correspondentes às **N** amostras relacionadas a `X`.
+- **verbose**: Booleano, padrão `True`, determina se o feedback da geração dos detectores será impresso.
*Retorna a instância da classe.*
@@ -109,16 +108,16 @@ def predict(self, X: npt.NDArray) -> npt.NDArray:
**Parâmetro de entrada:**
-* **X**: Array com as características para predição, com **N** amostras (linhas) e **N** colunas.
+- **X**: Array com as características para predição, com **N** amostras (linhas) e **N** colunas.
**Retorna:**
-* **C**: Um array de predições com as classes de saída para as características fornecidas.
-* **None**: Se não houver detectores.
+- **C**: Um array de predições com as classes de saída para as características fornecidas.
+- **None**: Se não houver detectores.
---
-### Método score(...):
+### Método score(...)
A função `score(...)` calcula a acurácia do modelo treinado realizando predições e calculando a precisão.
@@ -132,14 +131,14 @@ Retorna a acurácia como um `float`.
## Métodos Privados
-### Método _refinement_arb(...):
+### Método _refinement_arb(...)
A função "_refinement_arb(...)" refina o conjunto ARB até que o valor médio de estímulo ultrapasse o limiar definido (`affinity_threshold_scalar`).
Parâmetros:
-* **c_match** (`Cell`): Célula com o maior estímulo em relação a aᵢ.
-* **arb_list** (`List[_ARB]`): Conjunto ARB.
+- **c_match** (`Cell`): Célula com o maior estímulo em relação a aᵢ.
+- **arb_list** (`List[_ARB]`): Conjunto ARB.
```python
def _refinement_arb(self, ai: npt.NDArray, c_match: Cell, arb_list: List[_ARB]) -> _ARB:
@@ -149,7 +148,7 @@ Retorna a célula (_ARB) com o maior estímulo ARB.
---
-### Método _cells_affinity_threshold(...):
+### Método _cells_affinity_threshold(...)
A função "_cells_affinity_threshold(...)" calcula o limiar de afinidade com base na afinidade média entre instâncias de treinamento, onde aᵢ e aⱼ são um par de antígenos, e a afinidade é medida pela distância (Euclidiana, Manhattan, Minkowski, Hamming).
**Seguindo a fórmula:**
@@ -161,7 +160,7 @@ $$
Parâmetros:
-* **antigens_list** (`NDArray`): Lista de antígenos de treinamento.
+- **antigens_list** (`NDArray`): Lista de antígenos de treinamento.
```python
def _cells_affinity_threshold(self, antigens_list: npt.NDArray):
@@ -169,14 +168,14 @@ def _cells_affinity_threshold(self, antigens_list: npt.NDArray):
---
-### Método _affinity(...):
+### Método _affinity(...)
A função "_affinity(...)" calcula o estímulo entre dois vetores usando métricas.
Parâmetros:
-* **u** (`npt.NDArray`): Coordenadas do primeiro ponto.
-* **v** (`npt.NDArray`): Coordenadas do segundo ponto.
+- **u** (`npt.NDArray`): Coordenadas do primeiro ponto.
+- **v** (`npt.NDArray`): Coordenadas do segundo ponto.
```python
def _affinity(self, u: npt.NDArray, v: npt.NDArray) -> float:
@@ -186,13 +185,13 @@ Retorna a taxa de estímulo entre os vetores.
---
-### Método _init_memory_c(...):
+### Método _init_memory_c(...)
A função "_init_memory_c(...)" inicializa células de memória selecionando aleatoriamente `n_antigens_selected` da lista de antígenos de treinamento.
Parâmetros:
-* **antigens_list** (`NDArray`): Lista de antígenos de treinamento.
+- **antigens_list** (`NDArray`): Lista de antígenos de treinamento.
```python
def _init_memory_c(self, antigens_list: npt.NDArray) -> List[Cell]:
@@ -200,10 +199,10 @@ def _init_memory_c(self, antigens_list: npt.NDArray) -> List[Cell]:
---
-
-# Referências
+## Referências
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
\ No newline at end of file
+### 1
+>
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/airs/abr.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/airs/abr.md
index 86b9ce7e..949c9a47 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/airs/abr.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/airs/abr.md
@@ -25,16 +25,18 @@ Individuo do conjunto de células reconhecedoras (ABR), herda características d
:::
-### Constructor:
+### Constructor
Parameters:
+
* vector (``npt.NDArray``): A feature vector of the cell. Defaults to None.
---
-### Function consume_resource(...):
+### Function consume_resource(...)
Parameters:
+
* n_resource (```float```) : The initial amount of resources.
* amplified (``float``): Amplifier for resource consumption by the cell. It is multiplied by the cell's stimulus. The default value is 1.
@@ -43,4 +45,3 @@ def consume_resource(self, n_resource: float, amplified: float = 1) -> float:
```
Returns the remaining amount of resources after consumption.
-
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Negative Selection/BNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Negative Selection/BNSA.md
index 7bfa36a9..803f1022 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Negative Selection/BNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Negative Selection/BNSA.md
@@ -1,6 +1,5 @@
---
id: bnsa
-title: BNSA
sidebar_label: BNSA - Algoritmo de Seleção Negativa Binária
sidebar_position: 2
pagination_next: null
@@ -20,9 +19,9 @@ keywords:
- Computação Natural
---
-# BNSA (Algoritmo de Seleção Negativa Binária).
+# BNSA (Algoritmo de Seleção Negativa Binária)
-A classe ``BNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
+A classe ``BNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
```python
class BNSA(
@@ -36,18 +35,20 @@ class BNSA(
```
**Attributes:**
+
* *N* (``int``): Quantidade de detectores. Defaults to ``100``.
* *aff_thresh* (``float``): A variável ('affinity threshold') representa a porcentagem de não similaridade entre a célula T e as amostras próprias. O valor padrão é de 10% (0,1), enquanto que o valor de 1,0 representa 100% de não similaridade.
+
:::note
Definir uma porcentagem de diferença muito alta pode resultar na incapacidade de gerar detectores para não-próprio.
:::
-* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
+* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
possível loop infinito caso seja definido um raio que não seja possível gerar detectores do não-próprio. Defaults to ``1000``.
* *seed* (``int``): Semente para a geração randômica dos valores nos detectores. Defaults to ``None``.
* no_label_sample_selection (``str``): Método para a seleção de rótulos para amostras designadas como não pertencentes por todos os detectores não pertencentes. **Tipos de métodos disponíveis:**
- - (``max_average_difference``): Seleciona a classe com a maior diferença média entre os detectores.
- - (``max_nearest_difference``): Seleciona a classe com a maior diferença entre o detector mais próximo e mais distante da amostra.
+ * (``max_average_difference``): Seleciona a classe com a maior diferença média entre os detectores.
+ * (``max_nearest_difference``): Seleciona a classe com a maior diferença entre o detector mais próximo e mais distante da amostra.
**Outras variáveis iniciadas:**
@@ -57,17 +58,19 @@ possível loop infinito caso seja definido um raio que não seja possível gerar
---
-### Função fit(...)
+## Função fit(...)
A função ``fit(...)`` gera os detectores para os não próprios com relação às amostras:
```python
def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
```
+
Nela é realizado o treinamento de acordo com ``X`` e ``y``, usando o método de seleção negativa(``NegativeSelect``).
**Os parâmetros de entrada são:**
-* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
+
+* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
* ``y``: array com as classes de saídas disposto em **N** amostras que são relacionadas ao ``X``.
* ``verbose``: boolean com valor padrão ``True``, determina se o feedback da geração dos detectores será impresso.
@@ -75,7 +78,7 @@ Nela é realizado o treinamento de acordo com ``X`` e ``y``, usando o método de
---
-### Função predict(...)
+## Função predict(...)
A função ``predict(...)`` realiza a previsão das classes utilizando os detectores gerados:
@@ -84,16 +87,17 @@ def predict(self, X: npt.NDArray) -> npt.NDArray:
```
**O parâmetro de entrada:**
-
+
* ``X``: array com as características para a previsão, com **N** amostras (Linhas) e **N** colunas.
-**Retorna:**
-* ``C``: Um array de previsão com as classes de saída para as características informadas.
+**Retorna:**
+
+* ``C``: Um array de previsão com as classes de saída para as características informadas.
* ``None``: se não houver detectores.
---
-### Função score(...)
+## Função score(...)
A função "score(...)" calcula a precisão do modelo treinado por meio da realização de previsões e do cálculo da acurácia.
@@ -109,7 +113,7 @@ retorna a acurácia, do tipo ``float``.
---
-### Função __slice_index_list_by_class(...)
+## Função __slice_index_list_by_class(...)
A função ``__slice_index_list_by_class(...)``, separa os índices das linhas conforme a classe de saída, para percorrer o array de amostra, apenas nas posições que a saída for a classe que está sendo treinada:
@@ -119,4 +123,4 @@ def __slice_index_list_by_class(self, y: npt.NDArray) -> dict:
Retorna um dicionario com as classes como chave e os índices em ``X`` das amostras.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Negative Selection/README.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Negative Selection/README.md
index cb4ddc1c..7f31afdb 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Negative Selection/README.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Negative Selection/README.md
@@ -4,30 +4,37 @@ A **seleção negativa** é o processo em que o sistema imunológico faz a matur
---
-# classes
+## classes
> 1. **[Binary version:](BNSA.md)**
+>
>> O algoritmo binário adaptado para múltiplas classes neste projeto tem como base a versão proposta por [Forrest et al. (1994)](#2), originalmente desenvolvida para segurança computacional.
>>> **Exemplo:**
+>>>
>>> + [Base de dados Mushrooms](https://github.com/AIS-Package/aisp/blob/main/examples/BNSA/mushrooms_dataBase_example_pt-br.ipynb)
> 2. **[Real-Valued version:](RNSA.md)**
+>
>>Este algoritmo possui duas versões diferentes: uma baseada na versão canônica [[1]](#1) e outra com detectores de raio variável [[3]](#3). Ambas estão adaptadas para trabalhar com múltiplas classes e possuem métodos para previsão de dados presentes na região não-self de todos os detectores e classes.
>>> **Exemplos:**
->>> + [Base de dados Iris](https://github.com/AIS-Package/aisp/blob/main/examples/RNSA/iris_dataBase_example_pt-br.ipynb)
->>> + [Base de dados Geyser](https://github.com/AIS-Package/aisp/blob/main/examples/RNSA/geyser_dataBase_example_pt-br.ipynb)
+>>>
+>>> + [Base de dados Iris](https://github.com/AIS-Package/aisp/blob/main/examples/RNSA/iris_dataBase_example_pt-br.ipynb)
+>>> + [Base de dados Geyser](https://github.com/AIS-Package/aisp/blob/main/examples/RNSA/geyser_dataBase_example_pt-br.ipynb)
-# References
+## References
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
+### 1
+>
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
-##### 2
-> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: http://dx.doi.org/10.1109/RISP.1994.296580.
+### 2
+>
+> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: [https://dx.doi.org/10.1109/RISP.1994.296580](https://dx.doi.org/10.1109/RISP.1994.296580).
-##### 3
-> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: http://dx.doi.org/10.1007/978-3-540-24854-5_30.
+### 3
+>
+> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: [https://dx.doi.org/10.1007/978-3-540-24854-5_30](https://dx.doi.org/10.1007/978-3-540-24854-5_30).
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Negative Selection/RNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Negative Selection/RNSA.md
index b98833aa..8d97e90a 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Negative Selection/RNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/aisp-techniques/Negative Selection/RNSA.md
@@ -1,6 +1,5 @@
---
id: rnsa
-title: RNSA
sidebar_label: RNSA - Algoritmo de Seleção Negativa de Valor Real
sidebar_position: 1
last_update:
@@ -21,9 +20,9 @@ keywords:
# RNSA (Algoritmo de Seleção Negativa de Valor Real)
-## Construtor RNSA:
+## Construtor RNSA
-A classe ``RNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
+A classe ``RNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
```python
class RNSA(
@@ -44,39 +43,39 @@ class RNSA(
* *N* (``int``): Quantidade de detectores. Defaults to ``100``.
* *r* (``float``): Raio do detector. Defaults to ``0.05``.
+
:::note
É importante considerar que definir um raio muito baixo para o detector pode reduzir significativamente a taxa de detecção. Por outro lado, um raio muito grande pode inviabilizar a incorporação do detector no espaço de busca, o que também pode comprometer o desempenho da detecção. É fundamental encontrar um equilíbrio entre o tamanho do raio e a eficiência da detecção para obter os melhores resultados possíveis.
:::
-
* *k* (``int``): Quantidade de vizinhos próximos dos detectores gerados aleatoriamente para efetuar o cálculo da média da distância. Defaults to ``1``.
-* *metric* (``str``): Forma para se calcular a distância entre o detector e a amostra:
-
- * ``'euclidiana'`` ➜ O cálculo da distância dá-se pela expressão: $$\sqrt{(X_1 - X_1)^2 + (Y_2 - Y_2)^2 + ... + (Y_n - Y_n)^2}$$.
- * ``'minkowski'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - Y_1|^p + |X_2 - Y_2|^p + ... |X_n - Y_n|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - X_1| + |Y_2 - Y_2| + ... + |Y_n - Y_n|)$$.
+* *metric* (``str``): Forma para se calcular a distância entre o detector e a amostra:
+
+ * ``'euclidiana'`` ➜ O cálculo da distância dá-se pela expressão: $$\sqrt{(X_1 - X_1)^2 + (Y_2 - Y_2)^2 + ... + (Y_n - Y_n)^2}$$.
+ * ``'minkowski'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - Y_1|^p + |X_2 - Y_2|^p + ... |X_n - Y_n|^p)^\frac{1}{p}$$.
+ * ``'manhattan'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - X_1| + |Y_2 - Y_2| + ... + |Y_n - Y_n|)$$.
Defaults to ``'euclidean'``.
-* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
+* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
possível loop infinito caso seja definido um raio que não seja possível gerar detectores do não-próprio. Defaults to ``1000``.
* *seed* (``int``): Semente para a geração randômica dos valores nos detectores. Defaults to ``None``.
* *algorithm* (``str``), Definir a versão do algoritmo:
- * ``'default-NSA'``: Algoritmo padrão com raio fixo.
- * ``'V-detector'``: Este algoritmo é baseado no artigo "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", de autoria de Ji, Z., Dasgupta, D. (2004), e utiliza um raio variável para a detecção de anomalias em espaços de características.
+ * ``'default-NSA'``: Algoritmo padrão com raio fixo.
+ * ``'V-detector'``: Este algoritmo é baseado no artigo "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", de autoria de Ji, Z., Dasgupta, D. (2004), e utiliza um raio variável para a detecção de anomalias em espaços de características.
Defaults to ``'default-NSA'``.
* *r_s* (``float``): O valor de ``rₛ`` é o raio das amostras próprias da matriz ``X``.
-- ``**kwargs``:
- - *non_self_label* (``str``): Esta variável armazena o rótulo que será atribuído quando os dados possuírem
+
+* ``**kwargs``:
+ * *non_self_label* (``str``): Esta variável armazena o rótulo que será atribuído quando os dados possuírem
apenas uma classe de saída, e a amostra for classificada como não pertencente a essa classe. Defaults to ``'non-self'``.
-
- - *cell_bounds* (``bool``): Se definido como ``True``, esta opção limita a geração dos detectores ao espaço do plano compreendido entre 0 e 1. Isso significa que qualquer detector cujo raio ultrapasse esse limite é descartado, e esta variável é usada exclusivamente no algoritmo ``V-detector``.
- - p (``float``): Este parâmetro armazena o valor de ``p`` utilizada na distância de Minkowski. O padrão é ``2``, o que significa distância euclidiana normalizada. Diferentes valores de p levam a diferentes variantes da distância de Minkowski [saiba mais](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
-
+
+ * *cell_bounds* (``bool``): Se definido como ``True``, esta opção limita a geração dos detectores ao espaço do plano compreendido entre 0 e 1. Isso significa que qualquer detector cujo raio ultrapasse esse limite é descartado, e esta variável é usada exclusivamente no algoritmo ``V-detector``.
+ * p (``float``): Este parâmetro armazena o valor de ``p`` utilizada na distância de Minkowski. O padrão é ``2``, o que significa distância euclidiana normalizada. Diferentes valores de p levam a diferentes variantes da distância de Minkowski [saiba mais](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
**Outras variáveis iniciadas:**
@@ -93,10 +92,12 @@ A função ``fit(...)`` gera os detectores para os não próprios com relação
```python
def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
```
+
Nela é realizado o treinamento de acordo com ``X`` e ``y``, usando o método de seleção negativa(``NegativeSelect``).
**Os parâmetros de entrada são:**
-* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
+
+* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
* ``y``: array com as classes de saídas disposto em **N** amostras que são relacionadas ao ``X``.
* ``verbose``: boolean com valor padrão ``True``, determina se o feedback da geração dos detectores será impresso.
@@ -113,11 +114,12 @@ def predict(self, X: npt.NDArray) -> npt.NDArray:
```
**O parâmetro de entrada:**
-
+
* ``X``: array com as características para a previsão, com **N** amostras (Linhas) e **N** colunas.
-**Retorna:**
-* ``C``: Um array de previsão com as classes de saída para as características informadas.
+**Retorna:**
+
+* ``C``: Um array de previsão com as classes de saída para as características informadas.
* ``None``: se não houver detectores.
---
@@ -147,9 +149,10 @@ def __checks_valid_detector(self, X: npt.NDArray, vector_x: npt.NDArray, samples
```
**Os parâmetros de entrada são:**
+
* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
-* ``vector_x``: Detector candidato gerado aleatoriamente.
+* ``vector_x``: Detector candidato gerado aleatoriamente.
* ``samplesIndexClass``: Array com os indexes de uma classe.
@@ -173,14 +176,14 @@ def __compare_KnearestNeighbors_List(self, knn: npt.NDArray, distance: float) ->
Função para comparar uma amostra com os detectores, verificando se a amostra é própria.
-
Nesta função, quando possui ambiguidade de classes, retorna a classe que possuir a média de distância maior entre os detectores.
**Os parâmetros de entrada são:**
+
* line: vetor com N-características
**Retorna:** A classe prevista com os detectores ou None se a amostra não se qualificar a nenhuma classe.
-
+
---
### Função __detector_is_valid_to_Vdetector(...)
@@ -227,4 +230,4 @@ def __slice_index_list_by_class(self, y: npt.NDArray) -> dict:
Retorna um dicionario com as classes como chave e os índices em ``X`` das amostras.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/intro.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/intro.md
index 91331efa..29dbe80a 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/intro.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.2.x/intro.md
@@ -24,10 +24,11 @@ keywords:
- Immune-inspired Algorithms
---
-# Pacote de Sistemas Imunológicos Artificiais.
+# Pacote de Sistemas Imunológicos Artificiais
+
-
+
@@ -37,9 +38,9 @@ keywords:
**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).
-### Algoritmos implementados:
+### Algoritmos implementados
-> - [x] [**Seleção Negativa.**](/docs/0.2.x/aisp-techniques/Negative%20Selection/)
-> - [x] [**Algoritmos de Seleção Clonal.**](/docs/0.2.x/aisp-techniques/Clonal%20Selection%20Algorithms/)
+> - [x] [**Seleção Negativa.**](./aisp-techniques/Negative%20Selection/)
+> - [x] [**Algoritmos de Seleção Clonal.**](./aisp-techniques/Clonal%20Selection%20Algorithms/)
> - [ ] *Células Dendríticas.*
> - [ ] *Teoria da Rede Imune.*
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/about-us.mdx b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/about-us.mdx
index a8a81fbf..fb136e1e 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/about-us.mdx
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/about-us.mdx
@@ -26,7 +26,7 @@ pertencentes à área de sistemas imunológicos artificiais.
name='Alison Zille Lopes'
date='2022'
githubUrl='https://github.com/alisonzille'
- lattesUrl='http://lattes.cnpq.br/3294097090760981'
+ lattesUrl='https://lattes.cnpq.br/3294097090760981'
/>
@@ -42,7 +42,7 @@ pertencentes à área de sistemas imunológicos artificiais.
date='2022-2023'
description="Fui encarregado de implementar a versão 0.1, que apresenta as classes de seleção negativa BNSA e RNSA, incluindo as versões de raio fixo e variável."
githubUrl='https://github.com/Joao-Paulo-Silva'
- lattesUrl='http://lattes.cnpq.br/2561057724411407'
+ lattesUrl='https://lattes.cnpq.br/2561057724411407'
/>
\ No newline at end of file
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Core/negative-selection.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Core/negative-selection.md
index 6777640c..d9b62ea6 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Core/negative-selection.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Core/negative-selection.md
@@ -8,7 +8,7 @@ last_update:
As funções realizam verificações de detectores e utilizam decoradores Numba para compilação Just-In-Time.
-### Função check_detector_bnsa_validity(...):
+### Função check_detector_bnsa_validity(...)
```python
def check_detector_bnsa_validity(
@@ -20,19 +20,19 @@ def check_detector_bnsa_validity(
Verifica a validade de um candidato a detector (vector_x) contra amostras de uma classe (x_class) usando a distância de Hamming. Um detector é considerado INVÁLIDO se a sua distância para qualquer amostra em ``x_class`` for menor ou igual a ``aff_thresh``.
-
**Os parâmetros de entrada são:**
+
* x_class (``npt.NDArray``): Array contendo as amostras da classe. Formato esperado: (n_amostras, n_características).
* vector_x (``npt.NDArray``): Array representando o detector. Formato esperado: (n_características,).
* aff_thresh (``float``): Limiar de afinidade.
+**Retorna:**
-**Retorna:**
* True se o detector for válido, False caso contrário.
---
-### Função bnsa_class_prediction(...):
+### Função bnsa_class_prediction(...)
```python
def bnsa_class_prediction(
@@ -41,19 +41,22 @@ def bnsa_class_prediction(
aff_thresh: float
) -> int:
```
+
Define a classe de uma amostra a partir dos detectores não-próprios.
**Os parâmetros de entrada são:**
+
* features (``npt.NDArray``): amostra binária a ser classificada (shape: [n_features]).
-* class_detectors (``npt.NDArray``): Matriz contendo os detectores de todas as classes (shape: [n_classes, n_detectors, n_features]).
+* class_detectors (``npt.NDArray``): Matriz contendo os detectores de todas as classes (shape: [n_classes, n_detectors, n_features]).
* aff_thresh (``float``): Limiar de afinidade que determina se um detector reconhece a amostra como não-própria.
-**Retorna:**
+**Retorna:**
+
* int: Índice da classe predita. Retorna -1 se for não-própria para todas as classes.
---
-### Função check_detector_rnsa_validity(...):
+### Função check_detector_rnsa_validity(...)
```python
def check_detector_rnsa_validity(
@@ -64,18 +67,19 @@ def check_detector_rnsa_validity(
p: float
) -> bool:
```
-Verifica a validade de um candidato a detector (vector_x) contra amostras de uma classe (x_class) usando a distância de Hamming. Um detector é considerado INVÁLIDO se a sua distância para qualquer amostra em ``x_class`` for menor ou igual a ``aff_thresh``.
+Verifica a validade de um candidato a detector (vector_x) contra amostras de uma classe (x_class) usando a distância de Hamming. Um detector é considerado INVÁLIDO se a sua distância para qualquer amostra em ``x_class`` for menor ou igual a ``aff_thresh``.
**Os parâmetros de entrada são:**
+
* x_class (``npt.NDArray``): Array contendo as amostras da classe. Formato esperado: (n_amostras, n_características).
* vector_x (``npt.NDArray``): Array representando o detector. Formato esperado: (n_características,).
* threshold (``float``): Afinidade.
* metric (``int``): Métrica de distância a ser utilizada. Opções disponíveis: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)].
* p (``float``): Parâmetro da métrica de Minkowski (utilizado apenas se `metric` for "minkowski").
+**Retorna:**
-**Retorna:**
* True se o detector for válido, False caso contrário.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Distance.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Distance.md
index 3238ee07..4c4e896f 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Distance.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Distance.md
@@ -16,15 +16,15 @@ def hamming(u: npt.NDArray, v: npt.NDArray) -> np.float64:
Função para calcular a distância de Hamming normalizada entre dois pontos.
-
$((x₁ ≠ x₂) + (y₁ ≠ y₂) + ... + (y_n ≠ y_n)) / n$
-
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto
* v (``npt.NDArray``): Coordenadas do segundo ponto.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -39,13 +39,13 @@ Função para calcular a distância euclidiana normalizada entre dois pontos.
$√( (x₁ - x₂)² + (y₁ - y₂)² + ... + (y_n - y_n)²)$
-
-
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto
* v (``npt.NDArray``): Coordenadas do segundo ponto.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -57,15 +57,16 @@ def cityblock(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64]) -> np.floa
```
Função para calcular a distância Manhattan normalizada entre dois pontos.
-
-$(|x₁ - x₂| + |y₁ - y₂| + ... + |y_n - y_n|) / n$
+$(|x₁ - x₂| + |y₁ - y₂| + ... + |y_n - y_n|) / n$
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto
* v (``npt.NDArray``): Coordenadas do segundo ponto.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -77,19 +78,20 @@ def minkowski(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64], p: float =
```
Função para calcular a distância de Minkowski normalizada entre dois pontos.
-
-$(( |X₁ - Y₁|p + |X₂ - Y₂|p + ... + |X_n - Y_n|p) ¹/ₚ) / n$
+$(( |X₁ - Y₁|p + |X₂ - Y₂|p + ... + |X_n - Y_n|p) ¹/ₚ) / n$
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto.
* v (``npt.NDArray``): Coordenadas do segundo ponto.
* p (``float``): O parâmetro p define o tipo de distância a ser calculada:
- - p = 1: Distância **Manhattan** — soma das diferenças absolutas.
- - p = 2: Distância **Euclidiana** — soma das diferenças ao quadrado (raiz quadrada).
- - p > 2: Distância **Minkowski** com uma penalidade crescente à medida que p aumenta.
+ * p = 1: Distância **Manhattan** — soma das diferenças absolutas.
+ * p = 2: Distância **Euclidiana** — soma das diferenças ao quadrado (raiz quadrada).
+ * p > 2: Distância **Minkowski** com uma penalidade crescente à medida que p aumenta.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -107,15 +109,15 @@ def compute_metric_distance(
Função para calcular a distância entre dois pontos pela ``métrica`` escolhida.
-
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto.
* v (``npt.NDArray``): Coordenadas do segundo ponto.
* metric (``int``): Métrica de distância a ser utilizada. Opções disponíveis: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)].
* p (``float``): Parâmetro da métrica de Minkowski (utilizado apenas se `metric` for "minkowski").
-
**Returns:**
+
* Distância (``double``) entre os dois pontos com a métrica selecionada.
---
@@ -134,12 +136,14 @@ def min_distance_to_class_vectors(
Calcula a menor distância entre um vetor de entrada e os vetores de uma classe.
**Parameters:**
+
* x_class (``npt.NDArray``): Array contendo os vetores da classe com os quais o vetor de entrada será comparado. Formato esperado: (n_amostras, n_características).
* vector_x (``npt.NDArray``): Vetor a ser comparado com os vetores da classe. Formato esperado: (n_características,).
* metric (``int``): Métrica de distância a ser utilizada. Opções disponíveis: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)].
* p (``float``): Parâmetro da métrica de Minkowski (utilizado apenas se `metric` for "minkowski").
**Returns:**
+
* float: A menor distância calculada entre o vetor de entrada e os vetores da classe.
* Retorna -1.0 se as dimensões de entrada forem incompatíveis.
@@ -150,15 +154,17 @@ Calcula a menor distância entre um vetor de entrada e os vetores de uma classe.
```python
def get_metric_code(metric: str) -> int:
```
+
Retorna o código numérico associado a uma métrica de distância.
**Parameters:**
-* metric (``str``): Nome da métrica. Pode ser "euclidean", "manhattan", "minkowski" ou "hamming".
+* metric (``str``): Nome da métrica. Pode ser "euclidean", "manhattan", "minkowski" ou "hamming".
**Raises**
-----------
+
* ``ValueError``: Se a métrica informada não for suportada.
**Returns:**
-* ``int``: Código numérico correspondente à métrica.
\ No newline at end of file
+
+* ``int``: Código numérico correspondente à métrica.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Metrics.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Metrics.md
index dac82b80..6490d548 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Metrics.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Metrics.md
@@ -20,19 +20,22 @@ def accuracy_score(
Função para calcular a acurácia de precisão com base em listas de rótulos
verdadeiros e nos rótulos previstos.
-Parâmetros:
+Parâmetros
---
+
* y_true (``Union[npt.NDArray, list]``): Rótulos verdadeiros (corretos)..
* y_pred (``Union[npt.NDArray, list]``): Rótulos previstos.
-Retornos:
+Retornos
---
+
* Precisão (``float``): A proporção de previsões corretas em relação
ao número total de previsões.
-Lança:
+Lança
---
+
* ValueError: Se `y_true` ou `y_pred` estiverem vazios ou se não
tiverem o mesmo tamanho.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Multiclass.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Multiclass.md
index b05b1e60..96d2640a 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Multiclass.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Multiclass.md
@@ -18,12 +18,14 @@ A função ``slice_index_list_by_class(...)``, separa os índices das linhas con
classe de saída, para percorrer o array de amostra, apenas nas posições que a saída for \
a classe que está sendo treinada.
-Parameters:
+Parameters
---
- * classes (``list or npt.NDArray``): lista com classes únicas.
- * y (npt.NDArray): Recebe um array ``y``[``N amostra``] com as classes de saída do \
- array de amostra ``X``.
-
- Returns:
- ---
- * dict: Um dicionário com a lista de posições do array(``y``), com as classes como chave.
+
+* classes (``list or npt.NDArray``): lista com classes únicas.
+* y (npt.NDArray): Recebe um array ``y``[``N amostra``] com as classes de saída do \
+ array de amostra ``X``.
+
+Returns
+---
+
+* dict: Um dicionário com a lista de posições do array(``y``), com as classes como chave.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Sanitizers.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Sanitizers.md
index 27d1ca40..13ede0db 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Sanitizers.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Sanitizers.md
@@ -15,12 +15,13 @@ def sanitize_choice(value: T, valid_choices: Iterable[T], default: T) -> T
A função ``sanitize_choice(...)``, retorna o valor se estiver presente no conjunto de opções válidas; caso contrário, retorna o valor padrão.
**Parameters:**
+
* ***value*** (``T``): O valor a ser verificado.
* ***valid_choices*** (``Iterable[T]``): Uma coleção de opções válidas.
* ***default***: O valor padrão a ser retornado se ``value`` não estiver em ``valid_choices``.
-
**Returns:**
+
* `T`: O valor original, se válido, ou o valor padrão, se não.
---
@@ -34,12 +35,13 @@ def sanitize_param(value: T, default: T, condition: Callable[[T], bool]) -> T:
A função ``sanitize_param(...)``, retorna o valor se ele satisfizer a condição especificada; caso contrário, retorna o valor padrão.
**Parameters:**
+
* value (``T``): O valor a ser verificado.
* default (``T``): O valor padrão a ser retornado se a condição não for satisfeita.
* condition (``Callable[[T], bool]``): Uma função que recebe um valor e retorna um booleano, determinando se o valor é válido.
-
**Returns:**
+
* `T`: O valor original se a condição for satisfeita, ou o valor padrão se não for.
---
@@ -53,8 +55,9 @@ def sanitize_seed(seed: Any) -> Optional[int]:
A função ``sanitize_param(...)``, retorna a semente se for um inteiro não negativo; caso contrário, retorna Nenhum.
**Parameters:**
+
* seed (``Any``): O valor da seed a ser validado.
**Returns:**
-* ``Optional[int]``: A seed original se for um inteiro não negativo, ou ``None`` se for inválido.
+* ``Optional[int]``: A seed original se for um inteiro não negativo, ou ``None`` se for inválido.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Validation.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Validation.md
index 9d6c23ed..711e2392 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Validation.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/Utils/Validation.md
@@ -7,6 +7,7 @@ def detect_vector_data_type(
vector: npt.NDArray
) -> FeatureType:
```
+
Detecta o tipo de dado em um determinado vetor.
Esta função analisa o vetor de entrada e classifica seus dados como um dos tipos suportados:
@@ -25,4 +26,4 @@ Esta função analisa o vetor de entrada e classifica seus dados como um dos tip
**Lança**
-* `UnsupportedDataTypeError`: Gerado se o vetor contiver um tipo de dado não suportado.
\ No newline at end of file
+* `UnsupportedDataTypeError`: Gerado se o vetor contiver um tipo de dado não suportado.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-classes-reference/csa/airs.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-classes-reference/csa/airs.md
index 73337fa7..0e2c5d23 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-classes-reference/csa/airs.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-classes-reference/csa/airs.md
@@ -25,7 +25,7 @@ A classe base contém funções que são utilizadas por mais de uma classe no pa
---
-### def _check_and_raise_exceptions_fit(...):
+### def _check_and_raise_exceptions_fit(...)
Verifica os parâmetros de ajuste (*fit*) e lança exceções caso a verificação não seja bem-sucedida.
@@ -42,8 +42,8 @@ def _check_and_raise_exceptions_fit(
**Parâmetros**:
-* ***X*** (`npt.NDArray`): Array de treinamento, contendo as amostras e suas características, com formato [`N amostras` (linhas)][`N características` (colunas)].
-* ***y*** (`npt.NDArray`): Array das classes alvo de `X` com [`N amostras` (linhas)].
+* ***X*** (`npt.NDArray`): Array de treinamento, contendo as amostras e suas características, com formato \[`N amostras` (linhas)]\[`N características` (colunas)].
+* ***y*** (`npt.NDArray`): Array das classes alvo de `X` com \[`N amostras` (linhas)].
* ***algorithm*** (`Literal["continuous-features", "binary-features"], opcional`): Especifica o tipo de algoritmo a ser usado, dependendo se os dados de entrada possuem características contínuas ou binárias.
**Exceções**:
@@ -55,7 +55,7 @@ def _check_and_raise_exceptions_fit(
---
-### def _check_and_raise_exceptions_predict(...):
+### def _check_and_raise_exceptions_predict(...)
Verifica os parâmetros de predição e lança exceções caso a verificação não seja bem-sucedida.
@@ -72,7 +72,7 @@ def _check_and_raise_exceptions_predict(
**Parâmetros**:
-* ***X*** (`npt.NDArray`): Array de entrada, contendo as amostras e suas características, com formato [`N amostras` (linhas)][`N características` (colunas)].
+* ***X*** (`npt.NDArray`): Array de entrada, contendo as amostras e suas características, com formato \[`N amostras` (linhas)]\[`N características` (colunas)].
* ***expected*** (`int`): Número esperado de características por amostra (colunas de X).
* ***algorithm*** (`Literal["continuous-features", "binary-features"], opcional`): Especifica o tipo de algoritmo a ser usado, dependendo se os dados de entrada possuem características contínuas ou binárias.
@@ -85,4 +85,4 @@ def _check_and_raise_exceptions_predict(
* `ValueError`:
Se o algoritmo for "binary-features" e X contiver valores que não sejam compostos apenas por 0 e 1.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-classes-reference/ina/ainet.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-classes-reference/ina/ainet.md
index 4814456b..7f6abe70 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-classes-reference/ina/ainet.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-classes-reference/ina/ainet.md
@@ -33,7 +33,7 @@ def _check_and_raise_exceptions_fit(X: npt.NDArray)
**Parâmetros**:
-* ***X*** (`npt.NDArray`): Matriz de treinamento contendo as amostras e suas características, [`N amostras` (linhas)][`N atributos` (colunas)].
+* ***X*** (`npt.NDArray`): Matriz de treinamento contendo as amostras e suas características, \[`N amostras` (linhas)]\[`N atributos` (colunas)].
**Exceções**:
@@ -56,7 +56,7 @@ def _check_and_raise_exceptions_predict(
**Parâmetros**:
-* ***X*** (`npt.NDArray`): Matriz de entrada para predição, contendo as amostras e suas características, [`N amostras` (linhas)][`N atributos` (colunas)].
+* ***X*** (`npt.NDArray`): Matriz de entrada para predição, contendo as amostras e suas características, \[`N amostras` (linhas)]\[`N atributos` (colunas)].
* ***expected*** (`int`, default=0): Número esperado de atributos por amostra (colunas em X).
* ***feature_type*** (`FeatureType`, default="continuous-features"): Especifica o tipo de atributos: `"continuous-features"`, `"binary-features"` ou `"ranged-features"`.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-classes-reference/nsa.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-classes-reference/nsa.md
index 2c2ce233..0d2fc458 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-classes-reference/nsa.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-classes-reference/nsa.md
@@ -21,12 +21,11 @@ keywords:
## ``class BaseNSA(BaseClassifier, ABC)``
-
A classe ``BaseNSA`` contém funções utilitárias com o modificador ``protected`` que podem ser herdadas por várias classes para facilitar o uso. Ela inclui funções para calcular distância, separar dados para melhorar a eficiência de treinamento e previsão, medir precisão e outras funções.
---
-### Funções Protegidas:
+### Funções Protegidas
---
@@ -39,20 +38,21 @@ def _check_and_raise_exceptions_fit(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Função responsável por verificar os parâmetros da função fit e lançar exceções se a verificação não for bem-sucedida.
**Parâmetros**:
-* **X** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, [``N samples`` (linhas)][``N features`` (colunas)].
-* ***y*** (``npt.NDArray``): Array de classes alvo de ``X`` com [``N samples`` (linhas)].
-* ***_class_*** (Literal[RNSA, BNSA], opcional): Classe atual. O padrão é 'RNSA'.
+* **X** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, \[``N samples`` (linhas)\]\[``N features`` (colunas)].
+* ***y*** (``npt.NDArray``): Array de classes alvo de ``X`` com \[``N samples`` (linhas)].
+* ****class**** (Literal[RNSA, BNSA], opcional): Classe atual. O padrão é 'RNSA'.
**Lança:**
+
* ``TypeError``: Se X ou y não forem ndarrays ou tiverem formas incompatíveis.
* ``MaxDiscardsReachedError``: O número máximo de descartes do detector foi atingido durante
a maturação. Verifique o valor do raio definido e considere reduzi-lo.
-
#### def _check_and_raise_exceptions_predict(...)
```python
@@ -62,19 +62,20 @@ def _check_and_raise_exceptions_predict(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Função responsável por verificar os parâmetros da função predict e lançar exceções caso a verificação não seja bem-sucedida.
**Parâmetros**:
-* ***X*** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, [``N samples`` (linhas)][``N features`` (colunas)].
+
+* ***X*** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, \[``N samples`` (linhas)\]\[``N features`` (colunas)].
* ***expected*** (``int``): Número esperado de características por amostra (colunas em X).
-* ***_class_*** (``Literal[RNSA, BNSA], opcional``): Classe atual. O padrão é 'RNSA'.
+* ****class**** (``Literal[RNSA, BNSA], opcional``): Classe atual. O padrão é 'RNSA'.
**Lança:**
+
* ``TypeError``: Se X ou y não forem ndarrays ou tiverem formas incompatíveis.
* ``MaxDiscardsReachedError``: O número máximo de descartes do detector foi atingido durante
a maturação. Verifique o valor do raio definido e considere reduzi-lo.
-
-
---
## ``Class Detector``
@@ -84,4 +85,4 @@ Representa um detector não-próprio do class RNSA.
**Atributos:**
* ***position*** (``np.ndarray``): Vetor de características do detector.
-* ***radius*** (``float, opcional``): Raio do detector, utilizado no algoritmo V-detector.
\ No newline at end of file
+* ***radius*** (``float, opcional``): Raio do detector, utilizado no algoritmo V-detector.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-module/Classifier.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-module/Classifier.md
index 43198b20..eef99a11 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-module/Classifier.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-module/Classifier.md
@@ -1,21 +1,19 @@
---
sidebar_position: 1
-title: Classification
sidebar_label: BaseClassifier
last_update:
date: 2025/05/17
author: João Paulo
---
-# Classe base para algoritmo de classificação.
+# Classe base para algoritmo de classificação
-## ``class BaseClassifier(ABC)``:
+## ``class BaseClassifier(ABC)``
Classe base para algoritmos de classificação, definindo os métodos abstratos ``fit`` e ``predict``, e implementando o método ``get_params``.
## Abstract methods
-
### def fit(...)
```python
@@ -26,9 +24,9 @@ Ajusta o modelo aos dados de treinamento.
Implementação:
-- [RNSA](/docs/aisp-techniques/negative-selection/rnsa#Função-fit)
-- [BNSA](/docs/aisp-techniques/negative-selection/bnsa#Função-fit)
-- [AIRS](/docs/aisp-techniques/clonal-selection-algorithms/airs/#Método-fit)
+- [RNSA](../../aisp-techniques/negative-selection/RNSA.md#Função-fit)
+- [BNSA](../../aisp-techniques/negative-selection/BNSA.md#Função-fit)
+- [AIRS](../../aisp-techniques/clonal-selection-algorithms/airs/#Método-fit)
### def predict(...)
@@ -40,9 +38,9 @@ Realiza a previsão dos rótulos para os dados fornecidos.
Implementação:
-- [RNSA](/docs/aisp-techniques/negative-selection/rnsa#Função-predict)
-- [BNSA](/docs/aisp-techniques/negative-selection/bnsa#Função-predict)
-- [AIRS](/docs/aisp-techniques/clonal-selection-algorithms/airs/#Método-predict)
+- [RNSA](../../aisp-techniques/negative-selection/RNSA.md#Função-predict)
+- [BNSA](../../aisp-techniques/negative-selection/BNSA.md#Função-predict)
+- [AIRS](../../aisp-techniques/clonal-selection-algorithms/airs/#Método-predict)
---
@@ -56,23 +54,24 @@ def score(self, X: npt.NDArray, y: list) -> float
A função de pontuação (score) calcula a precisão da previsão.
-Esta função realiza a previsão de X e verifica quantos elementos são iguais entre o vetor y e y_predicted.
+Esta função realiza a previsão de X e verifica quantos elementos são iguais entre o vetor y e y_predicted.
Esta função foi adicionada para compatibilidade com algumas funções do scikit-learn.
**Parâmetros**:
-+ ***X***: np.ndarray
+
+- ***X***: np.ndarray
Conjunto de características com formato (n_amostras, n_características).
-+ ***y***: np.ndarray
+- ***y***: np.ndarray
Valores verdadeiros com formato (n_amostras,).
**Retorna**:
-+ precisão: float
+- precisão: float
A precisão do modelo.
---
-### Método _slice_index_list_by_class(...):
+### Método _slice_index_list_by_class(...)
A função ``_slice_index_list_by_class(...)``, separa os índices das linhas conforme a classe de saída, para percorrer o array de amostra, apenas nas posições que a saída for a classe que está sendo treinada:
@@ -89,6 +88,7 @@ Retorna um dicionário com as classes como chave e os índices em ``X`` das amos
```python
def get_params(self, deep: bool = True) -> dict:
```
+
A função get_params retorna um dicionário com os parâmetros principais do objeto.
Esta função é necessária para garantir a compatibilidade com as funções do scikit-learn.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-module/Clusterer.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-module/Clusterer.md
index 08294154..ced74add 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-module/Clusterer.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-module/Clusterer.md
@@ -19,6 +19,7 @@ keywords:
---
## ``BaseClusterer(ABC, Base)``
+
Classe base abstrata para algoritmos de clustering.
Esta classe define a interface central para modelos de agrupamento. Ela exige
@@ -47,7 +48,7 @@ Este método abstrato deve ser implementado pelas subclasses.
**Implementação**:
-* [AiNet](/docs/aisp-techniques/immune-network-theory/ainet#Função-fit)
+* [AiNet](../../aisp-techniques/immune-network-theory/AiNet.md#Função-fit)
---
@@ -70,7 +71,7 @@ Este método abstrato deve ser implementado pelas subclasses.
**Implementação**:
-* [AiNet](/docs/aisp-techniques/immune-network-theory/ainet#Função-predict)
+* [AiNet](../../aisp-techniques/immune-network-theory/AiNet.md#Função-predict)
---
@@ -89,4 +90,4 @@ Método de conveniência que combina `fit` e `predict` em uma única chamada.
**Retorna**:
-* ***predictions***: `Optional[npt.NDArray]` - Rótulos previstos dos clusters para cada amostra de entrada, ou `None` caso a previsão não seja possível.
\ No newline at end of file
+* ***predictions***: `Optional[npt.NDArray]` - Rótulos previstos dos clusters para cada amostra de entrada, ou `None` caso a previsão não seja possível.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-module/Mutation.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-module/Mutation.md
index 470b73e9..4eaef904 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-module/Mutation.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/advanced-guides/base-module/Mutation.md
@@ -17,8 +17,6 @@ keywords:
- Mutação Vetorial
---
-# Mutation
-
Contém funções que geram conjuntos de clones mutados a partir de vetores contínuos ou binários, simulando o processo de expansão clonal em sistemas imunológicos artificiais.
## clone_and_mutate_continuous
@@ -69,7 +67,6 @@ Esta função cria `n` clones do vetor binário de entrada e aplica mutações a
* `clone_set` (`npt.NDArray[np.bool_]`): Array com forma `(n, len(vector))` contendo os `n` clones mutados do vetor original.
-
---
## clone_and_mutate_ranged
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/Cell.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/Cell.md
index 0b6cfa6c..0c3944e3 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/Cell.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/Cell.md
@@ -17,20 +17,17 @@ lastUpdatedAt: 2025/05/25
author: João Paulo
---
-# Célula-B de memória
-
Representa uma célula-B de memória.
-### Construtor:
+### Construtor
Parâmetros:
* **vector** (`npt.NDArray`): Vetor de características da célula. Padrão é None.
-
---
-### Função hyper_clonal_mutate(...):
+### Função hyper_clonal_mutate(...)
Parâmetros:
@@ -51,4 +48,4 @@ def hyper_clonal_mutate(
) -> npt.NDArray
```
-Retorna um array contendo N vetores mutados a partir da célula original.
\ No newline at end of file
+Retorna um array contendo N vetores mutados a partir da célula original.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/airs/README.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/airs/README.md
index 4fa2e67f..02a88ed2 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/airs/README.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/airs/README.md
@@ -16,7 +16,6 @@ author: João Paulo
O ``AIRS`` é um algoritmo de classificação inspirado no processo de seleção clonal. A versão implementada nesta classe é inspirada na sua versão simplificada, o AIRS2, descrito em[Brabazon, O'Neill, and McGarraghy (2015)](#1)
-
Esta implementação é inspirada no AIRS2, uma versão simplificada do algoritmo AIRS original, introduzindo adaptações para lidar com conjuntos de dados contínuos e binários.
Com base no algoritmo 16.5 de Brabazon et al. [1](#1).
@@ -33,46 +32,46 @@ Com base no algoritmo 16.5 de Brabazon et al. [1](#1).
:::
-## Construtor AIRS:
+## Construtor AIRS
A classe `AIRS` tem como objetivo realizar classificação utilizando metáforas de seleção e expansão clonal.
**Atributos:**
-* **n_resources** (`float`): Quantidade total de recursos disponíveis. O padrão é 10.
+- **n_resources** (`float`): Quantidade total de recursos disponíveis. O padrão é 10.
-* **rate_clonal** (`float`): Número máximo de clones possíveis de uma classe. Esta quantidade é multiplicada por (estímulo da célula * taxa de hipermutação) para definir o número de clones. O padrão é 10.
+- **rate_clonal** (`float`): Número máximo de clones possíveis de uma classe. Esta quantidade é multiplicada por (estímulo da célula * taxa de hipermutação) para definir o número de clones. O padrão é 10.
-* **rate_hypermutation** (`int`): Taxa de clones mutados derivada de rate_clonal como um fator escalar. O padrão é 0,75.
+- **rate_hypermutation** (`int`): Taxa de clones mutados derivada de rate_clonal como um fator escalar. O padrão é 0,75.
-* **affinity_threshold_scalar** (`float`): Limiar de afinidade normalizado. O padrão é 0,75.
+- **affinity_threshold_scalar** (`float`): Limiar de afinidade normalizado. O padrão é 0,75.
-* **k** (`int`): Número de vizinhos mais próximos (k-NN) que será usado para escolher um rótulo na predição. O padrão é 10.
+- **k** (`int`): Número de vizinhos mais próximos (k-NN) que será usado para escolher um rótulo na predição. O padrão é 10.
-* **max_iters** (`int`): Número máximo de interações no processo de refinamento do conjunto ARB exposto a aᵢ. O padrão é 100.
+- **max_iters** (`int`): Número máximo de interações no processo de refinamento do conjunto ARB exposto a aᵢ. O padrão é 100.
-* **resource_amplified** (`float`): Amplificador de consumo de recursos, multiplicado com o estímulo para subtrair recursos. O padrão é 1.0 (sem amplificação).
+- **resource_amplified** (`float`): Amplificador de consumo de recursos, multiplicado com o estímulo para subtrair recursos. O padrão é 1.0 (sem amplificação).
-* **metric** (Literal["manhattan", "minkowski", "euclidean"]): Forma de calcular a distância entre o detector e a amostra:
+- **metric** (Literal["manhattan", "minkowski", "euclidean"]): Forma de calcular a distância entre o detector e a amostra:
- * ``'euclidiana'`` ➜ O cálculo da distância dá-se pela expressão: $$\sqrt{(X_1 - X_1)^2 + (Y_2 - Y_2)^2 + ... + (Y_n - Y_n)^2}$$.
- * ``'minkowski'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - Y_1|^p + |X_2 - Y_2|^p + ... |X_n - Y_n|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - X_1| + |Y_2 - Y_2| + ... + |Y_n - Y_n|)$$.
+ - ``'euclidiana'`` ➜ O cálculo da distância dá-se pela expressão: $$\sqrt{(X_1 - X_1)^2 + (Y_2 - Y_2)^2 + ... + (Y_n - Y_n)^2}$$.
+ - ``'minkowski'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - Y_1|^p + |X_2 - Y_2|^p + ... |X_n - Y_n|^p)^\frac{1}{p}$$.
+ - ``'manhattan'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - X_1| + |Y_2 - Y_2| + ... + |Y_n - Y_n|)$$.
Defaults to ``'euclidean'``.
-* **seed** (``Optional[int]``): Semente para geração aleatória de valores dos detectores. O padrão é None.
+- **seed** (``Optional[int]``): Semente para geração aleatória de valores dos detectores. O padrão é None.
- `**kwargs`:
- * **p** (`float`): Este parâmetro armazena o valor de `p` usado na distância de Minkowski.
+ - **p** (`float`): Este parâmetro armazena o valor de `p` usado na distância de Minkowski.
O padrão é `2`, que corresponde à distância euclidiana normalizada. Diferentes valores de p resultam em variantes distintas da distância de Minkowski. [Saiba mais](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
**Outras variáveis inicializadas:**
-* **cells_memory** (`dict`): Armazena uma lista de células de memória por classe.
-* **affinity_threshold** (`dict`): Define o limiar de afinidade entre antígenos.
-* **classes** (`npt.NDArray`): Lista de classes de saída.
+- **cells_memory** (`dict`): Armazena uma lista de células de memória por classe.
+- **affinity_threshold** (`dict`): Define o limiar de afinidade entre antígenos.
+- **classes** (`npt.NDArray`): Lista de classes de saída.
---
@@ -90,9 +89,9 @@ Realiza o treinamento conforme `X` e `y`, utilizando o método Sistema de Reconh
**Parâmetros de entrada:**
-* **X**: Array com as características das amostras, com **N** amostras (linhas) e **N** características (colunas), normalizado para valores entre [0, 1].
-* **y**: Array com as classes de saída correspondentes às **N** amostras relacionadas a `X`.
-* **verbose**: Booleano, padrão `True`, determina se o feedback da geração dos detectores será impresso.
+- **X**: Array com as características das amostras, com **N** amostras (linhas) e **N** características (colunas), normalizado para valores entre [0, 1].
+- **y**: Array com as classes de saída correspondentes às **N** amostras relacionadas a `X`.
+- **verbose**: Booleano, padrão `True`, determina se o feedback da geração dos detectores será impresso.
*Retorna a instância da classe.*
@@ -108,16 +107,16 @@ def predict(self, X: npt.NDArray) -> npt.NDArray:
**Parâmetro de entrada:**
-* **X**: Array com as características para predição, com **N** amostras (linhas) e **N** colunas.
+- **X**: Array com as características para predição, com **N** amostras (linhas) e **N** colunas.
**Retorna:**
-* **C**: Um array de predições com as classes de saída para as características fornecidas.
-* **None**: Se não houver detectores.
+- **C**: Um array de predições com as classes de saída para as características fornecidas.
+- **None**: Se não houver detectores.
---
-### Método score(...):
+### Método score(...)
A função `score(...)` calcula a acurácia do modelo treinado realizando predições e calculando a precisão.
@@ -131,14 +130,14 @@ Retorna a acurácia como um `float`.
## Métodos Privados
-### Método _refinement_arb(...):
+### Método _refinement_arb(...)
A função "_refinement_arb(...)" refina o conjunto ARB até que o valor médio de estímulo ultrapasse o limiar definido (`affinity_threshold_scalar`).
Parâmetros:
-* **c_match** (`Cell`): Célula com o maior estímulo em relação a aᵢ.
-* **arb_list** (`List[_ARB]`): Conjunto ARB.
+- **c_match** (`Cell`): Célula com o maior estímulo em relação a aᵢ.
+- **arb_list** (`List[_ARB]`): Conjunto ARB.
```python
def _refinement_arb(self, ai: npt.NDArray, c_match: Cell, arb_list: List[_ARB]) -> _ARB:
@@ -148,7 +147,7 @@ Retorna a célula (_ARB) com o maior estímulo ARB.
---
-### Método _cells_affinity_threshold(...):
+### Método _cells_affinity_threshold(...)
A função "_cells_affinity_threshold(...)" calcula o limiar de afinidade com base na afinidade média entre instâncias de treinamento, onde aᵢ e aⱼ são um par de antígenos, e a afinidade é medida pela distância (Euclidiana, Manhattan, Minkowski, Hamming).
**Seguindo a fórmula:**
@@ -160,7 +159,7 @@ $$
Parâmetros:
-* **antigens_list** (`NDArray`): Lista de antígenos de treinamento.
+- **antigens_list** (`NDArray`): Lista de antígenos de treinamento.
```python
def _cells_affinity_threshold(self, antigens_list: npt.NDArray):
@@ -168,14 +167,14 @@ def _cells_affinity_threshold(self, antigens_list: npt.NDArray):
---
-### Método _affinity(...):
+### Método _affinity(...)
A função "_affinity(...)" calcula o estímulo entre dois vetores usando métricas.
Parâmetros:
-* **u** (`npt.NDArray`): Coordenadas do primeiro ponto.
-* **v** (`npt.NDArray`): Coordenadas do segundo ponto.
+- **u** (`npt.NDArray`): Coordenadas do primeiro ponto.
+- **v** (`npt.NDArray`): Coordenadas do segundo ponto.
```python
def _affinity(self, u: npt.NDArray, v: npt.NDArray) -> float:
@@ -185,13 +184,13 @@ Retorna a taxa de estímulo entre os vetores.
---
-### Método _init_memory_c(...):
+### Método _init_memory_c(...)
A função "_init_memory_c(...)" inicializa células de memória selecionando aleatoriamente `n_antigens_selected` da lista de antígenos de treinamento.
Parâmetros:
-* **antigens_list** (`NDArray`): Lista de antígenos de treinamento.
+- **antigens_list** (`NDArray`): Lista de antígenos de treinamento.
```python
def _init_memory_c(self, antigens_list: npt.NDArray) -> List[Cell]:
@@ -199,10 +198,10 @@ def _init_memory_c(self, antigens_list: npt.NDArray) -> List[Cell]:
---
-
-# Referências
+## Referências
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
\ No newline at end of file
+### 1
+>
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/airs/abr.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/airs/abr.md
index 86b9ce7e..949c9a47 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/airs/abr.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/airs/abr.md
@@ -25,16 +25,18 @@ Individuo do conjunto de células reconhecedoras (ABR), herda características d
:::
-### Constructor:
+### Constructor
Parameters:
+
* vector (``npt.NDArray``): A feature vector of the cell. Defaults to None.
---
-### Function consume_resource(...):
+### Function consume_resource(...)
Parameters:
+
* n_resource (```float```) : The initial amount of resources.
* amplified (``float``): Amplifier for resource consumption by the cell. It is multiplied by the cell's stimulus. The default value is 1.
@@ -43,4 +45,3 @@ def consume_resource(self, n_resource: float, amplified: float = 1) -> float:
```
Returns the remaining amount of resources after consumption.
-
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/immune-network-theory/AiNet.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/immune-network-theory/AiNet.md
index eb81833b..19be65a0 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/immune-network-theory/AiNet.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/immune-network-theory/AiNet.md
@@ -1,6 +1,5 @@
---
id: ainet
-title: AiNet
sidebar_label: AiNet - Agrupamento e Compressão
sidebar_position: 1
pagination_next: null
@@ -28,24 +27,23 @@ lastUpdatedAt: 2025/08/19
author: João Paulo
---
-# AiNet - Rede Imunológica Artificial para Agrupamento e Compressão.
+# AiNet - Rede Imunológica Artificial para Agrupamento e Compressão
A classe AiNet tem como objetivo realizar agrupamento utilizando metáforas inspiradas na teoria da rede imunológica.
-A classe AiNet implementa o algoritmo de Rede Imune Artificial para compressão e clustering. Ela utiliza princípios da teoria de redes imunes,
-seleção clonal e maturação por afinidade para comprimir conjuntos de dados e encontrar clusters [1](#1).
+A classe AiNet implementa o algoritmo de Rede Imune Artificial para compressão e clustering. Ela utiliza princípios da teoria de redes imunes,
+seleção clonal e maturação por afinidade para comprimir conjuntos de dados e encontrar clusters [1](#1).
Para clustering, pode opcionalmente utilizar uma [**Árvore Geradora Mínima**
(MST)](#2) para separar nós distantes em grupos.
:::info
-**``AiNet``** estende a **[classe ``BaseAiNet``](/docs/advanced-guides/base-classes-reference/ina/ainet)**, herdando sua funcionalidade básica.
+**``AiNet``** estende a **[classe ``BaseAiNet``](../../advanced-guides/base-classes-reference/ina/ainet.md)**, herdando sua funcionalidade básica.
:::
## Constructor
-
```python
class AiNet(
self,
@@ -78,18 +76,17 @@ class AiNet(
* **k** (`int`): Número de vizinhos mais próximos usados para predição de rótulos. Padrão: 3.
* **metric** (Literal["manhattan", "minkowski", "euclidean"]): Forma de calcular a distância entre o detector e a amostra:
- * `'euclidean'` ➜ Distância dada pela expressão:
- $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + ... + (Y_{n} - Y_{n})^2}$$
- * ``'minkowski'`` ➜ Distância dada pela expressão:
- $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + ... |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ Distância dada pela expressão: $$( |X_{1} - X_{1}| + |Y_{2} - Y_{2}| + ... + |Y_{n} - Y_{n}|)$$.
+ * `'euclidean'` ➜ Distância dada pela expressão:
+ $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$
+ * ``'minkowski'`` ➜ Distância dada pela expressão:
+ $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
+ * ``'manhattan'`` ➜ Distância dada pela expressão: $$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$.
Padrão: **"Euclidean"**.
* **seed** (`Optional[int]`): Semente para geração de números aleatórios. Padrão: None.
* **use_mst_clustering** (`bool`): Define se o clustering baseado em MST deve ser utilizado. Padrão: True.
* **kwargs**:
-
* **p** (`float`): Parâmetro para distância de Minkowski. Padrão: 2.
**Outras variáveis inicializadas:**
@@ -310,12 +307,14 @@ def _build_mst(self):
---
-# Referências
+## Referências
-##### 1
+### 1
+>
> 1. De Castro, Leandro & José, Fernando & von Zuben, Antonio Augusto. (2001). aiNet: An Artificial Immune Network for Data Analysis.
> Disponível em: [https://www.researchgate.net/publication/228378350_aiNet_An_Artificial_Immune_Network_for_Data_Analysis](https://www.researchgate.net/publication/228378350_aiNet_An_Artificial_Immune_Network_for_Data_Analysis)
-##### 2
+### 2
+>
> 2. SciPy Documentation. *Minimum Spanning Tree*.
-> Disponível em: [https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree)
\ No newline at end of file
+> Disponível em: [https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree)
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/immune-network-theory/README.mdx b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/immune-network-theory/README.mdx
index 66359b3c..cfa989ea 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/immune-network-theory/README.mdx
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/immune-network-theory/README.mdx
@@ -31,9 +31,9 @@ A Rede Imunológica Artificial pode ser aplicada em diferentes contextos, tais c
-# References
+## References
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
+### 1
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/negative-selection/BNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/negative-selection/BNSA.md
index 7bfa36a9..803f1022 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/negative-selection/BNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/negative-selection/BNSA.md
@@ -1,6 +1,5 @@
---
id: bnsa
-title: BNSA
sidebar_label: BNSA - Algoritmo de Seleção Negativa Binária
sidebar_position: 2
pagination_next: null
@@ -20,9 +19,9 @@ keywords:
- Computação Natural
---
-# BNSA (Algoritmo de Seleção Negativa Binária).
+# BNSA (Algoritmo de Seleção Negativa Binária)
-A classe ``BNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
+A classe ``BNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
```python
class BNSA(
@@ -36,18 +35,20 @@ class BNSA(
```
**Attributes:**
+
* *N* (``int``): Quantidade de detectores. Defaults to ``100``.
* *aff_thresh* (``float``): A variável ('affinity threshold') representa a porcentagem de não similaridade entre a célula T e as amostras próprias. O valor padrão é de 10% (0,1), enquanto que o valor de 1,0 representa 100% de não similaridade.
+
:::note
Definir uma porcentagem de diferença muito alta pode resultar na incapacidade de gerar detectores para não-próprio.
:::
-* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
+* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
possível loop infinito caso seja definido um raio que não seja possível gerar detectores do não-próprio. Defaults to ``1000``.
* *seed* (``int``): Semente para a geração randômica dos valores nos detectores. Defaults to ``None``.
* no_label_sample_selection (``str``): Método para a seleção de rótulos para amostras designadas como não pertencentes por todos os detectores não pertencentes. **Tipos de métodos disponíveis:**
- - (``max_average_difference``): Seleciona a classe com a maior diferença média entre os detectores.
- - (``max_nearest_difference``): Seleciona a classe com a maior diferença entre o detector mais próximo e mais distante da amostra.
+ * (``max_average_difference``): Seleciona a classe com a maior diferença média entre os detectores.
+ * (``max_nearest_difference``): Seleciona a classe com a maior diferença entre o detector mais próximo e mais distante da amostra.
**Outras variáveis iniciadas:**
@@ -57,17 +58,19 @@ possível loop infinito caso seja definido um raio que não seja possível gerar
---
-### Função fit(...)
+## Função fit(...)
A função ``fit(...)`` gera os detectores para os não próprios com relação às amostras:
```python
def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
```
+
Nela é realizado o treinamento de acordo com ``X`` e ``y``, usando o método de seleção negativa(``NegativeSelect``).
**Os parâmetros de entrada são:**
-* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
+
+* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
* ``y``: array com as classes de saídas disposto em **N** amostras que são relacionadas ao ``X``.
* ``verbose``: boolean com valor padrão ``True``, determina se o feedback da geração dos detectores será impresso.
@@ -75,7 +78,7 @@ Nela é realizado o treinamento de acordo com ``X`` e ``y``, usando o método de
---
-### Função predict(...)
+## Função predict(...)
A função ``predict(...)`` realiza a previsão das classes utilizando os detectores gerados:
@@ -84,16 +87,17 @@ def predict(self, X: npt.NDArray) -> npt.NDArray:
```
**O parâmetro de entrada:**
-
+
* ``X``: array com as características para a previsão, com **N** amostras (Linhas) e **N** colunas.
-**Retorna:**
-* ``C``: Um array de previsão com as classes de saída para as características informadas.
+**Retorna:**
+
+* ``C``: Um array de previsão com as classes de saída para as características informadas.
* ``None``: se não houver detectores.
---
-### Função score(...)
+## Função score(...)
A função "score(...)" calcula a precisão do modelo treinado por meio da realização de previsões e do cálculo da acurácia.
@@ -109,7 +113,7 @@ retorna a acurácia, do tipo ``float``.
---
-### Função __slice_index_list_by_class(...)
+## Função __slice_index_list_by_class(...)
A função ``__slice_index_list_by_class(...)``, separa os índices das linhas conforme a classe de saída, para percorrer o array de amostra, apenas nas posições que a saída for a classe que está sendo treinada:
@@ -119,4 +123,4 @@ def __slice_index_list_by_class(self, y: npt.NDArray) -> dict:
Retorna um dicionario com as classes como chave e os índices em ``X`` das amostras.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/negative-selection/README.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/negative-selection/README.md
index 4e2d9448..610f032b 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/negative-selection/README.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/negative-selection/README.md
@@ -8,30 +8,37 @@ A **seleção negativa** é o processo em que o sistema imunológico faz a matur
---
-# classes
+## classes
> 1. **[Binary version:](BNSA.md)**
+>
>> O algoritmo binário adaptado para múltiplas classes neste projeto tem como base a versão proposta por [Forrest et al. (1994)](#2), originalmente desenvolvida para segurança computacional.
>>> **Exemplo:**
+>>>
>>> + [Base de dados Mushrooms](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/BNSA/mushrooms_dataBase_example_pt-br.ipynb)
> 2. **[Real-Valued version:](RNSA.md)**
+>
>>Este algoritmo possui duas versões diferentes: uma baseada na versão canônica [[1]](#1) e outra com detectores de raio variável [[3]](#3). Ambas estão adaptadas para trabalhar com múltiplas classes e possuem métodos para previsão de dados presentes na região não-self de todos os detectores e classes.
>>> **Exemplos:**
->>> + [Base de dados Iris](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/iris_dataBase_example_pt-br.ipynb)
->>> + [Base de dados Geyser](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/geyser_dataBase_example_pt-br.ipynb)
+>>>
+>>> + [Base de dados Iris](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/iris_dataBase_example_pt-br.ipynb)
+>>> + [Base de dados Geyser](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/geyser_dataBase_example_pt-br.ipynb)
-# References
+## References
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
+### 1
+>
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
-##### 2
-> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: http://dx.doi.org/10.1109/RISP.1994.296580.
+### 2
+>
+> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: [https://dx.doi.org/10.1109/RISP.1994.296580](https://dx.doi.org/10.1109/RISP.1994.296580).
-##### 3
-> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: http://dx.doi.org/10.1007/978-3-540-24854-5_30.
+### 3
+>
+> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: [https://dx.doi.org/10.1007/978-3-540-24854-5_30](https://dx.doi.org/10.1007/978-3-540-24854-5_30).
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/negative-selection/RNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/negative-selection/RNSA.md
index b98833aa..8d97e90a 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/negative-selection/RNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/aisp-techniques/negative-selection/RNSA.md
@@ -1,6 +1,5 @@
---
id: rnsa
-title: RNSA
sidebar_label: RNSA - Algoritmo de Seleção Negativa de Valor Real
sidebar_position: 1
last_update:
@@ -21,9 +20,9 @@ keywords:
# RNSA (Algoritmo de Seleção Negativa de Valor Real)
-## Construtor RNSA:
+## Construtor RNSA
-A classe ``RNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
+A classe ``RNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
```python
class RNSA(
@@ -44,39 +43,39 @@ class RNSA(
* *N* (``int``): Quantidade de detectores. Defaults to ``100``.
* *r* (``float``): Raio do detector. Defaults to ``0.05``.
+
:::note
É importante considerar que definir um raio muito baixo para o detector pode reduzir significativamente a taxa de detecção. Por outro lado, um raio muito grande pode inviabilizar a incorporação do detector no espaço de busca, o que também pode comprometer o desempenho da detecção. É fundamental encontrar um equilíbrio entre o tamanho do raio e a eficiência da detecção para obter os melhores resultados possíveis.
:::
-
* *k* (``int``): Quantidade de vizinhos próximos dos detectores gerados aleatoriamente para efetuar o cálculo da média da distância. Defaults to ``1``.
-* *metric* (``str``): Forma para se calcular a distância entre o detector e a amostra:
-
- * ``'euclidiana'`` ➜ O cálculo da distância dá-se pela expressão: $$\sqrt{(X_1 - X_1)^2 + (Y_2 - Y_2)^2 + ... + (Y_n - Y_n)^2}$$.
- * ``'minkowski'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - Y_1|^p + |X_2 - Y_2|^p + ... |X_n - Y_n|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - X_1| + |Y_2 - Y_2| + ... + |Y_n - Y_n|)$$.
+* *metric* (``str``): Forma para se calcular a distância entre o detector e a amostra:
+
+ * ``'euclidiana'`` ➜ O cálculo da distância dá-se pela expressão: $$\sqrt{(X_1 - X_1)^2 + (Y_2 - Y_2)^2 + ... + (Y_n - Y_n)^2}$$.
+ * ``'minkowski'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - Y_1|^p + |X_2 - Y_2|^p + ... |X_n - Y_n|^p)^\frac{1}{p}$$.
+ * ``'manhattan'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - X_1| + |Y_2 - Y_2| + ... + |Y_n - Y_n|)$$.
Defaults to ``'euclidean'``.
-* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
+* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
possível loop infinito caso seja definido um raio que não seja possível gerar detectores do não-próprio. Defaults to ``1000``.
* *seed* (``int``): Semente para a geração randômica dos valores nos detectores. Defaults to ``None``.
* *algorithm* (``str``), Definir a versão do algoritmo:
- * ``'default-NSA'``: Algoritmo padrão com raio fixo.
- * ``'V-detector'``: Este algoritmo é baseado no artigo "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", de autoria de Ji, Z., Dasgupta, D. (2004), e utiliza um raio variável para a detecção de anomalias em espaços de características.
+ * ``'default-NSA'``: Algoritmo padrão com raio fixo.
+ * ``'V-detector'``: Este algoritmo é baseado no artigo "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", de autoria de Ji, Z., Dasgupta, D. (2004), e utiliza um raio variável para a detecção de anomalias em espaços de características.
Defaults to ``'default-NSA'``.
* *r_s* (``float``): O valor de ``rₛ`` é o raio das amostras próprias da matriz ``X``.
-- ``**kwargs``:
- - *non_self_label* (``str``): Esta variável armazena o rótulo que será atribuído quando os dados possuírem
+
+* ``**kwargs``:
+ * *non_self_label* (``str``): Esta variável armazena o rótulo que será atribuído quando os dados possuírem
apenas uma classe de saída, e a amostra for classificada como não pertencente a essa classe. Defaults to ``'non-self'``.
-
- - *cell_bounds* (``bool``): Se definido como ``True``, esta opção limita a geração dos detectores ao espaço do plano compreendido entre 0 e 1. Isso significa que qualquer detector cujo raio ultrapasse esse limite é descartado, e esta variável é usada exclusivamente no algoritmo ``V-detector``.
- - p (``float``): Este parâmetro armazena o valor de ``p`` utilizada na distância de Minkowski. O padrão é ``2``, o que significa distância euclidiana normalizada. Diferentes valores de p levam a diferentes variantes da distância de Minkowski [saiba mais](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
-
+
+ * *cell_bounds* (``bool``): Se definido como ``True``, esta opção limita a geração dos detectores ao espaço do plano compreendido entre 0 e 1. Isso significa que qualquer detector cujo raio ultrapasse esse limite é descartado, e esta variável é usada exclusivamente no algoritmo ``V-detector``.
+ * p (``float``): Este parâmetro armazena o valor de ``p`` utilizada na distância de Minkowski. O padrão é ``2``, o que significa distância euclidiana normalizada. Diferentes valores de p levam a diferentes variantes da distância de Minkowski [saiba mais](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
**Outras variáveis iniciadas:**
@@ -93,10 +92,12 @@ A função ``fit(...)`` gera os detectores para os não próprios com relação
```python
def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
```
+
Nela é realizado o treinamento de acordo com ``X`` e ``y``, usando o método de seleção negativa(``NegativeSelect``).
**Os parâmetros de entrada são:**
-* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
+
+* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
* ``y``: array com as classes de saídas disposto em **N** amostras que são relacionadas ao ``X``.
* ``verbose``: boolean com valor padrão ``True``, determina se o feedback da geração dos detectores será impresso.
@@ -113,11 +114,12 @@ def predict(self, X: npt.NDArray) -> npt.NDArray:
```
**O parâmetro de entrada:**
-
+
* ``X``: array com as características para a previsão, com **N** amostras (Linhas) e **N** colunas.
-**Retorna:**
-* ``C``: Um array de previsão com as classes de saída para as características informadas.
+**Retorna:**
+
+* ``C``: Um array de previsão com as classes de saída para as características informadas.
* ``None``: se não houver detectores.
---
@@ -147,9 +149,10 @@ def __checks_valid_detector(self, X: npt.NDArray, vector_x: npt.NDArray, samples
```
**Os parâmetros de entrada são:**
+
* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
-* ``vector_x``: Detector candidato gerado aleatoriamente.
+* ``vector_x``: Detector candidato gerado aleatoriamente.
* ``samplesIndexClass``: Array com os indexes de uma classe.
@@ -173,14 +176,14 @@ def __compare_KnearestNeighbors_List(self, knn: npt.NDArray, distance: float) ->
Função para comparar uma amostra com os detectores, verificando se a amostra é própria.
-
Nesta função, quando possui ambiguidade de classes, retorna a classe que possuir a média de distância maior entre os detectores.
**Os parâmetros de entrada são:**
+
* line: vetor com N-características
**Retorna:** A classe prevista com os detectores ou None se a amostra não se qualificar a nenhuma classe.
-
+
---
### Função __detector_is_valid_to_Vdetector(...)
@@ -227,4 +230,4 @@ def __slice_index_list_by_class(self, y: npt.NDArray) -> dict:
Retorna um dicionario com as classes como chave e os índices em ``X`` das amostras.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/examples/Classification/csa.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/examples/Classification/csa.md
index 6549d751..3e622c8f 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/examples/Classification/csa.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/examples/Classification/csa.md
@@ -26,30 +26,34 @@ keywords:
- reconhecimpt-brto imune
---
-# Algoritmo de Seleção Clonal
-
Esta página apresenta uma coleção de exemplos práticos demonstrando como usar o Algoritmo de Seleção Clonal.
## AIRS (Sistema Imunológico Artificial de Reconhecimento)
-
Run online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fpt%2Dbr%2Fclassification%2FAIRS)
---
### Algoritmo Binário
-+ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/example_with_randomly_gpt-brerated_dataset-pt-br.ipynb)
++ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/example_with_randomly_gpt-brerated_dataset-pt-br.ipynb)
+
> No exemplo apresentado neste notebook, foram geradas 1000 amostras aleatórias, organizadas em dois grupos, um para cada classe.
+ [Exemplo com banco de dados de cogumelos](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/mushrooms_dataBase_example_pt-br.ipynb)
+
> Utiliza o [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), que contém informações sobre cogumelos comestíveis e venenosos.
### Algoritmo com Valores Reais
-+ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/example_with_randomly_gpt-brerated_dataset-pt-br.ipynb)
++ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/example_with_randomly_gpt-brerated_dataset-pt-br.ipynb)
+
> No exemplo apresentado neste notebook, foram geradas 500 amostras aleatórias, organizadas em dois grupos, um para cada classe. Podemos ver abaixo os detectores "não-próprio" gerados.
+
+ [Exemplo com banco de dados Iris](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/iris_dataBase_example_pt-br.ipynb)
+
> Exemplo usando o NSA com o [iris database](https://archive.ics.uci.edu/ml/datasets/iris), que contém amostras com quatro dimensões e três classes de saída (Setosa, Versicolor e Virginica).
+
+ [Exemplo com banco de dados Geyser](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/geyser_dataBase_example_pt-br.ipynb)
-> Para classificar erupções de gêiseres no Parque Nacional de Yellowstone, este notebook utiliza o [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
\ No newline at end of file
+
+> Para classificar erupções de gêiseres no Parque Nacional de Yellowstone, este notebook utiliza o [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/examples/Classification/nsa.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/examples/Classification/nsa.md
index 3a12e3d5..946c60c6 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/examples/Classification/nsa.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/examples/Classification/nsa.md
@@ -35,9 +35,11 @@ Execute on-line via Binder: [](htt
---
+ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/BNSA/example_with_randomly_generated_dataset-pt.ipynb)
+
> No exemplo presente neste notebook, foram geradas 1000 amostras aleatórias, organizadas em dois grupos, um para cada classe.
+ [Exemplo de Base de Dados de Cogumelos](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/BNSA/mushrooms_dataBase_example_pt.ipynb)
+
> Ele usa a [base de dados de cogumelos](https://archive.ics.uci.edu/dataset/73/mushroom), que contém informações sobre cogumelos comestíveis e venenosos.
## RNSA (Algoritmo de Seleção Negativa de Valores Reais)
@@ -47,10 +49,13 @@ Execute on-line via Binder: [](htt
---
+ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/example_with_randomly_generated_dataset-pt.ipynb)
+
> No exemplo presente neste notebook, foram geradas 500 amostras aleatórias, organizadas em dois grupos, um para cada classe.
+ [Exemplo de Base de Dados Iris](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/iris_dataBase_example_pt.ipynb)
+
> Exemplo usando a base de dados [íris](https://archive.ics.uci.edu/ml/datasets/iris), que contém amostras de quatro dimensões e três classes de saída (Setosa, Versicolor e Virginica).
+ [Exemplo de Base de Dados Geyser](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/geyser_dataBase_example_pt.ipynb)
+
> Para classificar erupções de geysers no Parque Nacional de Yellowstone, este notebook usa a [base de dados Old Faithful](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/examples/Clustering/ina.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/examples/Clustering/ina.md
index 23334dcf..fb3f1087 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/examples/Clustering/ina.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/examples/Clustering/ina.md
@@ -18,8 +18,6 @@ keywords:
- conjunto de dados geyser
---
-# Algoritmos de Rede Imunológica
-
Nesta página, você encontrará uma coleção de exemplos práticos que demonstram como usar as classes do Algoritmo de Rede Imunológica implementadas em nosso pacote.
Execute os notebooks online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fpt-br%2Fclustering%2FAiNet)
@@ -29,10 +27,13 @@ Execute os notebooks online via Binder: [
+
> Neste notebook, o AiNet é demonstrado em três conjuntos de dados sintéticos:
-> - **Blobs:** clusters esféricos bem definidos, fáceis de separar.
-> - **Moons:** clusters não-lineares, ilustrando fronteiras de decisão mais complexas.
-> - **Circles:** dois círculos concêntricos, mostrando a capacidade de lidar com separações não-lineares.
+>
+> + **Blobs:** clusters esféricos bem definidos, fáceis de separar.
+> + **Moons:** clusters não-lineares, ilustrando fronteiras de decisão mais complexas.
+> + **Circles:** dois círculos concêntricos, mostrando a capacidade de lidar com separações não-lineares.
+ [Exemplo com base de dados do geyser](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/clustering/AiNet/geyser_dataBase_example.ipynb)
-> Para classificar erupções de geysers no Parque Nacional de Yellowstone, este notebook usa a [base de dados Old Faithful](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
\ No newline at end of file
+
+> Para classificar erupções de geysers no Parque Nacional de Yellowstone, este notebook usa a [base de dados Old Faithful](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/basic-use/AIRS.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/basic-use/AIRS.md
index 55a92c70..f23c30b7 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/basic-use/AIRS.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/basic-use/AIRS.md
@@ -32,12 +32,13 @@ Acesse o notebook Jupyter com o código disponível [aqui](https://github.com/AI
Executar o notebook online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fpt-br%2Fclassification%2FAIRS%2Fexample_with_randomly_generated_dataset-pt.ipynb)
-### Importação do Sistema de Reconhecimento Imunológico Artificial
+## Importação do Sistema de Reconhecimento Imunológico Artificial
+
```python
from aisp.csa import AIRS
```
-### Gerando bolhas de dados para as classe aleatoriamente.
+## Gerando bolhas de dados para as classe aleatoriamente
Utilizando a função make_blobs, são gerados dois conjuntos de dados em forma de bolhas, no intervalo entre 0 e 1, representando cada classe x e y. Em seguida, esses dados são separados em conjuntos de teste e treinamento.
@@ -59,7 +60,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-### Testing the model AIRS:
+## Testing the model AIRS
Em seguida, apresenta o resultado da acurácia da previsão.
@@ -79,6 +80,7 @@ print(classification_report(test_y, prev))
```
Output:
+
```bash
✔ Set of memory cells for classes (0, 1) successfully generated: ┇██████████┇ 400/400 memory cells for each aᵢ
A acurácia é 1.0
@@ -94,6 +96,6 @@ weighted avg 1.00 1.00 1.00 100
---
-### Célula de memória e plotagem de amostra:
+## Célula de memória e plotagem de amostra
-
\ No newline at end of file
+
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/basic-use/AiNet.mdx b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/basic-use/AiNet.mdx
index d63e5d5d..48544600 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/basic-use/AiNet.mdx
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/basic-use/AiNet.mdx
@@ -260,4 +260,4 @@ Coeficiente de Silhueta: 0.112
plot_immune_network(samples, predict_y, model, title_prefix="Circles - ")
```
-
+
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/basic-use/BNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/basic-use/BNSA.md
index 467b9958..6ae9ade1 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/basic-use/BNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/basic-use/BNSA.md
@@ -22,12 +22,10 @@ keywords:
# Usando o BNSA
-O presente exemplo, disponível aqui, visa demonstrar a aplicação do algoritmo de seleção negativa binária. Esse algoritmo é empregado na classificação de amostras com características discretas.
-
+O presente exemplo, disponível aqui, visa demonstrar a aplicação do algoritmo de seleção negativa binária. Esse algoritmo é empregado na classificação de amostras com características discretas.
Acesse o notebook Jupyter disponível [aqui](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/BNSA/example_with_randomly_generated_dataset-pt.ipynb)!
-
Executar o notebook online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fpt-br%2Fclassification%2FBNSA%2Fexample_with_randomly_generated_dataset-pt.ipynb)
## Importando o algoritmo BNSA
@@ -63,7 +61,7 @@ def generate_samples(n_samples: int, n_features: int, s: float, x: None):
---
-Cada classe contará com 500 amostras, sendo a similaridade mínima entre amostras de 80% (s = 0.2). Essas classes serão separadas em conjunto de treinamento (800 amostras) e de teste (200 amostras).
+Cada classe contará com 500 amostras, sendo a similaridade mínima entre amostras de 80% (s = 0.2). Essas classes serão separadas em conjunto de treinamento (800 amostras) e de teste (200 amostras).
```python
# Configurando a seed para 121 para garantir a reprodutibilidade dos dados gerados.
@@ -89,7 +87,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-## Treinamento:
+## Treinamento
O modelo é ajustado através dos padrões de treinamento. Nessa aplicação, a seleção negativa distribuirá, com taxa de diferenciação de 30%, 250 detectores pelo espaço de entradas.
@@ -106,7 +104,8 @@ print(classification_report(test_y, prev))
```
Output:
-```
+
+```bash
✔ Non-self detectors for classes (x, y) successfully generated: ┇██████████┇ 500/500 detectors
A acurácia é 0.93
precision recall f1-score support
@@ -122,6 +121,7 @@ weighted avg 0.93 0.93 0.93 200
---
## Avaliação
+
O modelo obteve 0,93 de acurácia para o conjunto teste. A precisão na classificação, tanto para x quanto para y, também foi de 0,93. Isso pode ser observado pela matriz de confusão na Figura 1.
-
\ No newline at end of file
+
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/basic-use/RNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/basic-use/RNSA.md
index e743dcd5..27a5fba4 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/basic-use/RNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/basic-use/RNSA.md
@@ -24,16 +24,15 @@ keywords:
Acesse o notebook Jupyter com o código disponível [aqui](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/example_with_randomly_generated_dataset-pt.ipynb)!
-
Executar o notebook online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fpt-br%2Fclassification%2FRNSA%2Fexample_with_randomly_generated_dataset-pt.ipynb)
+## Importando o Algoritmo de seleção negativa de valor real
-## Importando o Algoritmo de seleção negativa de valor real.
```python
from aisp.nsa import RNSA
```
-## Gerando bolhas de dados para as classe aleatoriamente.
+## Gerando bolhas de dados para as classe aleatoriamente
Utilizando a função make_blobs, são gerados dois conjuntos de dados em forma de bolhas, no intervalo entre 0 e 1, representando cada classe x e y. Em seguida, esses dados são separados em conjuntos de teste e treinamento.
@@ -49,7 +48,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-## Testando o modelo `default-NSA`:
+## Testando o modelo `default-NSA`
Inicia o modelo com 500 detectores, cada um com um raio de 0.06. Em seguida, apresenta o resultado da acurácia da previsão.
@@ -68,6 +67,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```bash
✔ Non-self detectors for classes (0, 1) successfully generated: ┇██████████┇ 1000/1000 detectors
The accuracy is 1.0
@@ -83,13 +83,13 @@ weighted avg 1.00 1.00 1.00 100
---
-## Plotagem dos detector e amostras:
+## Plotagem dos detector e amostras
-
+
---
-## Testando o modelo `V-detector`:
+## Testando o modelo `V-detector`
Inicia o modelo com 50 detectores, onde o raio mínimo é de 0.05 e o raio próprio das amostras é de 0.04. Em seguida, mostra o resultado da acurácia da previsão.
@@ -108,6 +108,7 @@ print(classification_report(test_y, prev))
```
Output:
+
```bash
✔ Non-self detectors for classes (0, 1) successfully generated: ┇██████████┇ 100/100 detectors
A acuracia é 1.0
@@ -123,6 +124,6 @@ weighted avg 1.00 1.00 1.00 100
---
-## Plotagem dos detector e amostras:
+## Plotagem dos v-detector e amostras
-
\ No newline at end of file
+
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/instalation.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/instalation.md
index 169128c3..332103b7 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/instalation.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/getting-started/instalation.md
@@ -11,8 +11,6 @@ last_update:
author: João Paulo
---
-# **Instalação**
-
Esta página contém informações sobre as dependências do pacote, como instalá-lo e como importar os módulos.
### **Dependências:**
@@ -45,4 +43,4 @@ from aisp.nsa import RNSA, BNSA
nsa = RNSA(N=300, r=0.05)
-```
\ No newline at end of file
+```
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/intro.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/intro.md
index 4fe3eb6d..faccfdbc 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/intro.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.3.x/intro.md
@@ -24,10 +24,11 @@ keywords:
- Immune-inspired Algorithms
---
-# Pacote de Sistemas Imunológicos Artificiais.
+# Pacote de Sistemas Imunológicos Artificiais
+
-
+
@@ -37,9 +38,9 @@ keywords:
**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).
-### Algoritmos implementados:
+### Algoritmos implementados
-> - [x] [**Seleção Negativa.**](/docs/aisp-techniques/negative-selection/)
-> - [x] [**Algoritmos de Seleção Clonal.**](/docs/aisp-techniques/clonal-selection-algorithms/)
-> - [x] [**Teoria da Rede Imune.**](/docs/aisp-techniques/immune-network-theory/)
+> - [x] [**Seleção Negativa.**](./aisp-techniques/negative-selection/)
+> - [x] [**Algoritmos de Seleção Clonal.**](./aisp-techniques/clonal-selection-algorithms/)
+> - [x] [**Teoria da Rede Imune.**](./aisp-techniques/immune-network-theory/)
> - [ ] *Teoria do Perigo.*
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/about-us.mdx b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/about-us.mdx
index a8a81fbf..fb136e1e 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/about-us.mdx
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/about-us.mdx
@@ -26,7 +26,7 @@ pertencentes à área de sistemas imunológicos artificiais.
name='Alison Zille Lopes'
date='2022'
githubUrl='https://github.com/alisonzille'
- lattesUrl='http://lattes.cnpq.br/3294097090760981'
+ lattesUrl='https://lattes.cnpq.br/3294097090760981'
/>
@@ -42,7 +42,7 @@ pertencentes à área de sistemas imunológicos artificiais.
date='2022-2023'
description="Fui encarregado de implementar a versão 0.1, que apresenta as classes de seleção negativa BNSA e RNSA, incluindo as versões de raio fixo e variável."
githubUrl='https://github.com/Joao-Paulo-Silva'
- lattesUrl='http://lattes.cnpq.br/2561057724411407'
+ lattesUrl='https://lattes.cnpq.br/2561057724411407'
/>
\ No newline at end of file
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Core/negative-selection.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Core/negative-selection.md
index 6777640c..9041d2b2 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Core/negative-selection.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Core/negative-selection.md
@@ -8,7 +8,7 @@ last_update:
As funções realizam verificações de detectores e utilizam decoradores Numba para compilação Just-In-Time.
-### Função check_detector_bnsa_validity(...):
+## Função check_detector_bnsa_validity(...)
```python
def check_detector_bnsa_validity(
@@ -20,19 +20,19 @@ def check_detector_bnsa_validity(
Verifica a validade de um candidato a detector (vector_x) contra amostras de uma classe (x_class) usando a distância de Hamming. Um detector é considerado INVÁLIDO se a sua distância para qualquer amostra em ``x_class`` for menor ou igual a ``aff_thresh``.
-
**Os parâmetros de entrada são:**
+
* x_class (``npt.NDArray``): Array contendo as amostras da classe. Formato esperado: (n_amostras, n_características).
* vector_x (``npt.NDArray``): Array representando o detector. Formato esperado: (n_características,).
* aff_thresh (``float``): Limiar de afinidade.
+**Retorna:**
-**Retorna:**
* True se o detector for válido, False caso contrário.
---
-### Função bnsa_class_prediction(...):
+## Função bnsa_class_prediction(...)
```python
def bnsa_class_prediction(
@@ -41,19 +41,22 @@ def bnsa_class_prediction(
aff_thresh: float
) -> int:
```
+
Define a classe de uma amostra a partir dos detectores não-próprios.
**Os parâmetros de entrada são:**
+
* features (``npt.NDArray``): amostra binária a ser classificada (shape: [n_features]).
-* class_detectors (``npt.NDArray``): Matriz contendo os detectores de todas as classes (shape: [n_classes, n_detectors, n_features]).
+* class_detectors (``npt.NDArray``): Matriz contendo os detectores de todas as classes (shape: [n_classes, n_detectors, n_features]).
* aff_thresh (``float``): Limiar de afinidade que determina se um detector reconhece a amostra como não-própria.
-**Retorna:**
+**Retorna:**
+
* int: Índice da classe predita. Retorna -1 se for não-própria para todas as classes.
---
-### Função check_detector_rnsa_validity(...):
+## Função check_detector_rnsa_validity(...)
```python
def check_detector_rnsa_validity(
@@ -64,18 +67,19 @@ def check_detector_rnsa_validity(
p: float
) -> bool:
```
-Verifica a validade de um candidato a detector (vector_x) contra amostras de uma classe (x_class) usando a distância de Hamming. Um detector é considerado INVÁLIDO se a sua distância para qualquer amostra em ``x_class`` for menor ou igual a ``aff_thresh``.
+Verifica a validade de um candidato a detector (vector_x) contra amostras de uma classe (x_class) usando a distância de Hamming. Um detector é considerado INVÁLIDO se a sua distância para qualquer amostra em ``x_class`` for menor ou igual a ``aff_thresh``.
**Os parâmetros de entrada são:**
+
* x_class (``npt.NDArray``): Array contendo as amostras da classe. Formato esperado: (n_amostras, n_características).
* vector_x (``npt.NDArray``): Array representando o detector. Formato esperado: (n_características,).
* threshold (``float``): Afinidade.
* metric (``int``): Métrica de distância a ser utilizada. Opções disponíveis: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)].
* p (``float``): Parâmetro da métrica de Minkowski (utilizado apenas se `metric` for "minkowski").
+**Retorna:**
-**Retorna:**
* True se o detector for válido, False caso contrário.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Distance.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Distance.md
index 3238ee07..4c4e896f 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Distance.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Distance.md
@@ -16,15 +16,15 @@ def hamming(u: npt.NDArray, v: npt.NDArray) -> np.float64:
Função para calcular a distância de Hamming normalizada entre dois pontos.
-
$((x₁ ≠ x₂) + (y₁ ≠ y₂) + ... + (y_n ≠ y_n)) / n$
-
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto
* v (``npt.NDArray``): Coordenadas do segundo ponto.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -39,13 +39,13 @@ Função para calcular a distância euclidiana normalizada entre dois pontos.
$√( (x₁ - x₂)² + (y₁ - y₂)² + ... + (y_n - y_n)²)$
-
-
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto
* v (``npt.NDArray``): Coordenadas do segundo ponto.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -57,15 +57,16 @@ def cityblock(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64]) -> np.floa
```
Função para calcular a distância Manhattan normalizada entre dois pontos.
-
-$(|x₁ - x₂| + |y₁ - y₂| + ... + |y_n - y_n|) / n$
+$(|x₁ - x₂| + |y₁ - y₂| + ... + |y_n - y_n|) / n$
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto
* v (``npt.NDArray``): Coordenadas do segundo ponto.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -77,19 +78,20 @@ def minkowski(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64], p: float =
```
Função para calcular a distância de Minkowski normalizada entre dois pontos.
-
-$(( |X₁ - Y₁|p + |X₂ - Y₂|p + ... + |X_n - Y_n|p) ¹/ₚ) / n$
+$(( |X₁ - Y₁|p + |X₂ - Y₂|p + ... + |X_n - Y_n|p) ¹/ₚ) / n$
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto.
* v (``npt.NDArray``): Coordenadas do segundo ponto.
* p (``float``): O parâmetro p define o tipo de distância a ser calculada:
- - p = 1: Distância **Manhattan** — soma das diferenças absolutas.
- - p = 2: Distância **Euclidiana** — soma das diferenças ao quadrado (raiz quadrada).
- - p > 2: Distância **Minkowski** com uma penalidade crescente à medida que p aumenta.
+ * p = 1: Distância **Manhattan** — soma das diferenças absolutas.
+ * p = 2: Distância **Euclidiana** — soma das diferenças ao quadrado (raiz quadrada).
+ * p > 2: Distância **Minkowski** com uma penalidade crescente à medida que p aumenta.
**Returns:**
+
* Distância (``float``) entre os dois pontos.
---
@@ -107,15 +109,15 @@ def compute_metric_distance(
Função para calcular a distância entre dois pontos pela ``métrica`` escolhida.
-
**Parameters:**
+
* u (``npt.NDArray``): Coordenadas do primeiro ponto.
* v (``npt.NDArray``): Coordenadas do segundo ponto.
* metric (``int``): Métrica de distância a ser utilizada. Opções disponíveis: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)].
* p (``float``): Parâmetro da métrica de Minkowski (utilizado apenas se `metric` for "minkowski").
-
**Returns:**
+
* Distância (``double``) entre os dois pontos com a métrica selecionada.
---
@@ -134,12 +136,14 @@ def min_distance_to_class_vectors(
Calcula a menor distância entre um vetor de entrada e os vetores de uma classe.
**Parameters:**
+
* x_class (``npt.NDArray``): Array contendo os vetores da classe com os quais o vetor de entrada será comparado. Formato esperado: (n_amostras, n_características).
* vector_x (``npt.NDArray``): Vetor a ser comparado com os vetores da classe. Formato esperado: (n_características,).
* metric (``int``): Métrica de distância a ser utilizada. Opções disponíveis: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)].
* p (``float``): Parâmetro da métrica de Minkowski (utilizado apenas se `metric` for "minkowski").
**Returns:**
+
* float: A menor distância calculada entre o vetor de entrada e os vetores da classe.
* Retorna -1.0 se as dimensões de entrada forem incompatíveis.
@@ -150,15 +154,17 @@ Calcula a menor distância entre um vetor de entrada e os vetores de uma classe.
```python
def get_metric_code(metric: str) -> int:
```
+
Retorna o código numérico associado a uma métrica de distância.
**Parameters:**
-* metric (``str``): Nome da métrica. Pode ser "euclidean", "manhattan", "minkowski" ou "hamming".
+* metric (``str``): Nome da métrica. Pode ser "euclidean", "manhattan", "minkowski" ou "hamming".
**Raises**
-----------
+
* ``ValueError``: Se a métrica informada não for suportada.
**Returns:**
-* ``int``: Código numérico correspondente à métrica.
\ No newline at end of file
+
+* ``int``: Código numérico correspondente à métrica.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Metrics.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Metrics.md
index dac82b80..6490d548 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Metrics.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Metrics.md
@@ -20,19 +20,22 @@ def accuracy_score(
Função para calcular a acurácia de precisão com base em listas de rótulos
verdadeiros e nos rótulos previstos.
-Parâmetros:
+Parâmetros
---
+
* y_true (``Union[npt.NDArray, list]``): Rótulos verdadeiros (corretos)..
* y_pred (``Union[npt.NDArray, list]``): Rótulos previstos.
-Retornos:
+Retornos
---
+
* Precisão (``float``): A proporção de previsões corretas em relação
ao número total de previsões.
-Lança:
+Lança
---
+
* ValueError: Se `y_true` ou `y_pred` estiverem vazios ou se não
tiverem o mesmo tamanho.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Multiclass.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Multiclass.md
index b05b1e60..96d2640a 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Multiclass.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Multiclass.md
@@ -18,12 +18,14 @@ A função ``slice_index_list_by_class(...)``, separa os índices das linhas con
classe de saída, para percorrer o array de amostra, apenas nas posições que a saída for \
a classe que está sendo treinada.
-Parameters:
+Parameters
---
- * classes (``list or npt.NDArray``): lista com classes únicas.
- * y (npt.NDArray): Recebe um array ``y``[``N amostra``] com as classes de saída do \
- array de amostra ``X``.
-
- Returns:
- ---
- * dict: Um dicionário com a lista de posições do array(``y``), com as classes como chave.
+
+* classes (``list or npt.NDArray``): lista com classes únicas.
+* y (npt.NDArray): Recebe um array ``y``[``N amostra``] com as classes de saída do \
+ array de amostra ``X``.
+
+Returns
+---
+
+* dict: Um dicionário com a lista de posições do array(``y``), com as classes como chave.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Sanitizers.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Sanitizers.md
index 8cc8e741..56be3c29 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Sanitizers.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Sanitizers.md
@@ -15,12 +15,13 @@ def sanitize_choice(value: T, valid_choices: Iterable[T], default: T) -> T
A função ``sanitize_choice(...)``, retorna o valor se estiver presente no conjunto de opções válidas; caso contrário, retorna o valor padrão.
**Parameters:**
+
* ***value*** (``T``): O valor a ser verificado.
* ***valid_choices*** (``Iterable[T]``): Uma coleção de opções válidas.
* ***default***: O valor padrão a ser retornado se ``value`` não estiver em ``valid_choices``.
-
**Returns:**
+
* `T`: O valor original, se válido, ou o valor padrão, se não.
---
@@ -34,12 +35,13 @@ def sanitize_param(value: T, default: T, condition: Callable[[T], bool]) -> T:
A função ``sanitize_param(...)``, retorna o valor se ele satisfizer a condição especificada; caso contrário, retorna o valor padrão.
**Parameters:**
+
* value (``T``): O valor a ser verificado.
* default (``T``): O valor padrão a ser retornado se a condição não for satisfeita.
* condition (``Callable[[T], bool]``): Uma função que recebe um valor e retorna um booleano, determinando se o valor é válido.
-
**Returns:**
+
* `T`: O valor original se a condição for satisfeita, ou o valor padrão se não for.
---
@@ -53,9 +55,11 @@ def sanitize_seed(seed: Any) -> Optional[int]:
A função ``sanitize_param(...)``, retorna a semente se for um inteiro não negativo; caso contrário, retorna Nenhum.
**Parameters:**
+
* seed (``Any``): O valor da seed a ser validado.
**Returns:**
+
* ``Optional[int]``: A seed original se for um inteiro não negativo, ou ``None`` se for inválido.
---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Validation.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Validation.md
index 9d6c23ed..711e2392 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Validation.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/Utils/Validation.md
@@ -7,6 +7,7 @@ def detect_vector_data_type(
vector: npt.NDArray
) -> FeatureType:
```
+
Detecta o tipo de dado em um determinado vetor.
Esta função analisa o vetor de entrada e classifica seus dados como um dos tipos suportados:
@@ -25,4 +26,4 @@ Esta função analisa o vetor de entrada e classifica seus dados como um dos tip
**Lança**
-* `UnsupportedDataTypeError`: Gerado se o vetor contiver um tipo de dado não suportado.
\ No newline at end of file
+* `UnsupportedDataTypeError`: Gerado se o vetor contiver um tipo de dado não suportado.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-classes-reference/csa/airs.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-classes-reference/csa/airs.md
index 73337fa7..0e2c5d23 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-classes-reference/csa/airs.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-classes-reference/csa/airs.md
@@ -25,7 +25,7 @@ A classe base contém funções que são utilizadas por mais de uma classe no pa
---
-### def _check_and_raise_exceptions_fit(...):
+### def _check_and_raise_exceptions_fit(...)
Verifica os parâmetros de ajuste (*fit*) e lança exceções caso a verificação não seja bem-sucedida.
@@ -42,8 +42,8 @@ def _check_and_raise_exceptions_fit(
**Parâmetros**:
-* ***X*** (`npt.NDArray`): Array de treinamento, contendo as amostras e suas características, com formato [`N amostras` (linhas)][`N características` (colunas)].
-* ***y*** (`npt.NDArray`): Array das classes alvo de `X` com [`N amostras` (linhas)].
+* ***X*** (`npt.NDArray`): Array de treinamento, contendo as amostras e suas características, com formato \[`N amostras` (linhas)]\[`N características` (colunas)].
+* ***y*** (`npt.NDArray`): Array das classes alvo de `X` com \[`N amostras` (linhas)].
* ***algorithm*** (`Literal["continuous-features", "binary-features"], opcional`): Especifica o tipo de algoritmo a ser usado, dependendo se os dados de entrada possuem características contínuas ou binárias.
**Exceções**:
@@ -55,7 +55,7 @@ def _check_and_raise_exceptions_fit(
---
-### def _check_and_raise_exceptions_predict(...):
+### def _check_and_raise_exceptions_predict(...)
Verifica os parâmetros de predição e lança exceções caso a verificação não seja bem-sucedida.
@@ -72,7 +72,7 @@ def _check_and_raise_exceptions_predict(
**Parâmetros**:
-* ***X*** (`npt.NDArray`): Array de entrada, contendo as amostras e suas características, com formato [`N amostras` (linhas)][`N características` (colunas)].
+* ***X*** (`npt.NDArray`): Array de entrada, contendo as amostras e suas características, com formato \[`N amostras` (linhas)]\[`N características` (colunas)].
* ***expected*** (`int`): Número esperado de características por amostra (colunas de X).
* ***algorithm*** (`Literal["continuous-features", "binary-features"], opcional`): Especifica o tipo de algoritmo a ser usado, dependendo se os dados de entrada possuem características contínuas ou binárias.
@@ -85,4 +85,4 @@ def _check_and_raise_exceptions_predict(
* `ValueError`:
Se o algoritmo for "binary-features" e X contiver valores que não sejam compostos apenas por 0 e 1.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-classes-reference/ina/ainet.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-classes-reference/ina/ainet.md
index 4814456b..7f6abe70 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-classes-reference/ina/ainet.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-classes-reference/ina/ainet.md
@@ -33,7 +33,7 @@ def _check_and_raise_exceptions_fit(X: npt.NDArray)
**Parâmetros**:
-* ***X*** (`npt.NDArray`): Matriz de treinamento contendo as amostras e suas características, [`N amostras` (linhas)][`N atributos` (colunas)].
+* ***X*** (`npt.NDArray`): Matriz de treinamento contendo as amostras e suas características, \[`N amostras` (linhas)]\[`N atributos` (colunas)].
**Exceções**:
@@ -56,7 +56,7 @@ def _check_and_raise_exceptions_predict(
**Parâmetros**:
-* ***X*** (`npt.NDArray`): Matriz de entrada para predição, contendo as amostras e suas características, [`N amostras` (linhas)][`N atributos` (colunas)].
+* ***X*** (`npt.NDArray`): Matriz de entrada para predição, contendo as amostras e suas características, \[`N amostras` (linhas)]\[`N atributos` (colunas)].
* ***expected*** (`int`, default=0): Número esperado de atributos por amostra (colunas em X).
* ***feature_type*** (`FeatureType`, default="continuous-features"): Especifica o tipo de atributos: `"continuous-features"`, `"binary-features"` ou `"ranged-features"`.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-classes-reference/nsa.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-classes-reference/nsa.md
index 2c2ce233..0d2fc458 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-classes-reference/nsa.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-classes-reference/nsa.md
@@ -21,12 +21,11 @@ keywords:
## ``class BaseNSA(BaseClassifier, ABC)``
-
A classe ``BaseNSA`` contém funções utilitárias com o modificador ``protected`` que podem ser herdadas por várias classes para facilitar o uso. Ela inclui funções para calcular distância, separar dados para melhorar a eficiência de treinamento e previsão, medir precisão e outras funções.
---
-### Funções Protegidas:
+### Funções Protegidas
---
@@ -39,20 +38,21 @@ def _check_and_raise_exceptions_fit(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Função responsável por verificar os parâmetros da função fit e lançar exceções se a verificação não for bem-sucedida.
**Parâmetros**:
-* **X** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, [``N samples`` (linhas)][``N features`` (colunas)].
-* ***y*** (``npt.NDArray``): Array de classes alvo de ``X`` com [``N samples`` (linhas)].
-* ***_class_*** (Literal[RNSA, BNSA], opcional): Classe atual. O padrão é 'RNSA'.
+* **X** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, \[``N samples`` (linhas)\]\[``N features`` (colunas)].
+* ***y*** (``npt.NDArray``): Array de classes alvo de ``X`` com \[``N samples`` (linhas)].
+* ****class**** (Literal[RNSA, BNSA], opcional): Classe atual. O padrão é 'RNSA'.
**Lança:**
+
* ``TypeError``: Se X ou y não forem ndarrays ou tiverem formas incompatíveis.
* ``MaxDiscardsReachedError``: O número máximo de descartes do detector foi atingido durante
a maturação. Verifique o valor do raio definido e considere reduzi-lo.
-
#### def _check_and_raise_exceptions_predict(...)
```python
@@ -62,19 +62,20 @@ def _check_and_raise_exceptions_predict(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Função responsável por verificar os parâmetros da função predict e lançar exceções caso a verificação não seja bem-sucedida.
**Parâmetros**:
-* ***X*** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, [``N samples`` (linhas)][``N features`` (colunas)].
+
+* ***X*** (``npt.NDArray``): Array de treinamento, contendo as amostras e suas características, \[``N samples`` (linhas)\]\[``N features`` (colunas)].
* ***expected*** (``int``): Número esperado de características por amostra (colunas em X).
-* ***_class_*** (``Literal[RNSA, BNSA], opcional``): Classe atual. O padrão é 'RNSA'.
+* ****class**** (``Literal[RNSA, BNSA], opcional``): Classe atual. O padrão é 'RNSA'.
**Lança:**
+
* ``TypeError``: Se X ou y não forem ndarrays ou tiverem formas incompatíveis.
* ``MaxDiscardsReachedError``: O número máximo de descartes do detector foi atingido durante
a maturação. Verifique o valor do raio definido e considere reduzi-lo.
-
-
---
## ``Class Detector``
@@ -84,4 +85,4 @@ Representa um detector não-próprio do class RNSA.
**Atributos:**
* ***position*** (``np.ndarray``): Vetor de características do detector.
-* ***radius*** (``float, opcional``): Raio do detector, utilizado no algoritmo V-detector.
\ No newline at end of file
+* ***radius*** (``float, opcional``): Raio do detector, utilizado no algoritmo V-detector.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-module/Base.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-module/Base.md
index d5bbb313..dc887ed5 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-module/Base.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-module/Base.md
@@ -67,4 +67,4 @@ Define a semente para números aleatórios usados por funções compiladas com N
**Parâmetros**:
-* **seed**: `int` - Valor inteiro usado para inicializar o gerador de números aleatórios do Numba.
\ No newline at end of file
+* **seed**: `int` - Valor inteiro usado para inicializar o gerador de números aleatórios do Numba.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-module/Classifier.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-module/Classifier.md
index 43198b20..eef99a11 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-module/Classifier.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-module/Classifier.md
@@ -1,21 +1,19 @@
---
sidebar_position: 1
-title: Classification
sidebar_label: BaseClassifier
last_update:
date: 2025/05/17
author: João Paulo
---
-# Classe base para algoritmo de classificação.
+# Classe base para algoritmo de classificação
-## ``class BaseClassifier(ABC)``:
+## ``class BaseClassifier(ABC)``
Classe base para algoritmos de classificação, definindo os métodos abstratos ``fit`` e ``predict``, e implementando o método ``get_params``.
## Abstract methods
-
### def fit(...)
```python
@@ -26,9 +24,9 @@ Ajusta o modelo aos dados de treinamento.
Implementação:
-- [RNSA](/docs/aisp-techniques/negative-selection/rnsa#Função-fit)
-- [BNSA](/docs/aisp-techniques/negative-selection/bnsa#Função-fit)
-- [AIRS](/docs/aisp-techniques/clonal-selection-algorithms/airs/#Método-fit)
+- [RNSA](../../aisp-techniques/negative-selection/RNSA.md#Função-fit)
+- [BNSA](../../aisp-techniques/negative-selection/BNSA.md#Função-fit)
+- [AIRS](../../aisp-techniques/clonal-selection-algorithms/airs/#Método-fit)
### def predict(...)
@@ -40,9 +38,9 @@ Realiza a previsão dos rótulos para os dados fornecidos.
Implementação:
-- [RNSA](/docs/aisp-techniques/negative-selection/rnsa#Função-predict)
-- [BNSA](/docs/aisp-techniques/negative-selection/bnsa#Função-predict)
-- [AIRS](/docs/aisp-techniques/clonal-selection-algorithms/airs/#Método-predict)
+- [RNSA](../../aisp-techniques/negative-selection/RNSA.md#Função-predict)
+- [BNSA](../../aisp-techniques/negative-selection/BNSA.md#Função-predict)
+- [AIRS](../../aisp-techniques/clonal-selection-algorithms/airs/#Método-predict)
---
@@ -56,23 +54,24 @@ def score(self, X: npt.NDArray, y: list) -> float
A função de pontuação (score) calcula a precisão da previsão.
-Esta função realiza a previsão de X e verifica quantos elementos são iguais entre o vetor y e y_predicted.
+Esta função realiza a previsão de X e verifica quantos elementos são iguais entre o vetor y e y_predicted.
Esta função foi adicionada para compatibilidade com algumas funções do scikit-learn.
**Parâmetros**:
-+ ***X***: np.ndarray
+
+- ***X***: np.ndarray
Conjunto de características com formato (n_amostras, n_características).
-+ ***y***: np.ndarray
+- ***y***: np.ndarray
Valores verdadeiros com formato (n_amostras,).
**Retorna**:
-+ precisão: float
+- precisão: float
A precisão do modelo.
---
-### Método _slice_index_list_by_class(...):
+### Método _slice_index_list_by_class(...)
A função ``_slice_index_list_by_class(...)``, separa os índices das linhas conforme a classe de saída, para percorrer o array de amostra, apenas nas posições que a saída for a classe que está sendo treinada:
@@ -89,6 +88,7 @@ Retorna um dicionário com as classes como chave e os índices em ``X`` das amos
```python
def get_params(self, deep: bool = True) -> dict:
```
+
A função get_params retorna um dicionário com os parâmetros principais do objeto.
Esta função é necessária para garantir a compatibilidade com as funções do scikit-learn.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-module/Clusterer.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-module/Clusterer.md
index 08294154..ced74add 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-module/Clusterer.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-module/Clusterer.md
@@ -19,6 +19,7 @@ keywords:
---
## ``BaseClusterer(ABC, Base)``
+
Classe base abstrata para algoritmos de clustering.
Esta classe define a interface central para modelos de agrupamento. Ela exige
@@ -47,7 +48,7 @@ Este método abstrato deve ser implementado pelas subclasses.
**Implementação**:
-* [AiNet](/docs/aisp-techniques/immune-network-theory/ainet#Função-fit)
+* [AiNet](../../aisp-techniques/immune-network-theory/AiNet.md#Função-fit)
---
@@ -70,7 +71,7 @@ Este método abstrato deve ser implementado pelas subclasses.
**Implementação**:
-* [AiNet](/docs/aisp-techniques/immune-network-theory/ainet#Função-predict)
+* [AiNet](../../aisp-techniques/immune-network-theory/AiNet.md#Função-predict)
---
@@ -89,4 +90,4 @@ Método de conveniência que combina `fit` e `predict` em uma única chamada.
**Retorna**:
-* ***predictions***: `Optional[npt.NDArray]` - Rótulos previstos dos clusters para cada amostra de entrada, ou `None` caso a previsão não seja possível.
\ No newline at end of file
+* ***predictions***: `Optional[npt.NDArray]` - Rótulos previstos dos clusters para cada amostra de entrada, ou `None` caso a previsão não seja possível.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-module/Mutation.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-module/Mutation.md
index 470b73e9..4eaef904 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-module/Mutation.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/advanced-guides/base-module/Mutation.md
@@ -17,8 +17,6 @@ keywords:
- Mutação Vetorial
---
-# Mutation
-
Contém funções que geram conjuntos de clones mutados a partir de vetores contínuos ou binários, simulando o processo de expansão clonal em sistemas imunológicos artificiais.
## clone_and_mutate_continuous
@@ -69,7 +67,6 @@ Esta função cria `n` clones do vetor binário de entrada e aplica mutações a
* `clone_set` (`npt.NDArray[np.bool_]`): Array com forma `(n, len(vector))` contendo os `n` clones mutados do vetor original.
-
---
## clone_and_mutate_ranged
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/Cell.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/Cell.md
index 0b6cfa6c..0c3944e3 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/Cell.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/Cell.md
@@ -17,20 +17,17 @@ lastUpdatedAt: 2025/05/25
author: João Paulo
---
-# Célula-B de memória
-
Representa uma célula-B de memória.
-### Construtor:
+### Construtor
Parâmetros:
* **vector** (`npt.NDArray`): Vetor de características da célula. Padrão é None.
-
---
-### Função hyper_clonal_mutate(...):
+### Função hyper_clonal_mutate(...)
Parâmetros:
@@ -51,4 +48,4 @@ def hyper_clonal_mutate(
) -> npt.NDArray
```
-Retorna um array contendo N vetores mutados a partir da célula original.
\ No newline at end of file
+Retorna um array contendo N vetores mutados a partir da célula original.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/airs/README.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/airs/README.md
index 4fa2e67f..02a88ed2 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/airs/README.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/airs/README.md
@@ -16,7 +16,6 @@ author: João Paulo
O ``AIRS`` é um algoritmo de classificação inspirado no processo de seleção clonal. A versão implementada nesta classe é inspirada na sua versão simplificada, o AIRS2, descrito em[Brabazon, O'Neill, and McGarraghy (2015)](#1)
-
Esta implementação é inspirada no AIRS2, uma versão simplificada do algoritmo AIRS original, introduzindo adaptações para lidar com conjuntos de dados contínuos e binários.
Com base no algoritmo 16.5 de Brabazon et al. [1](#1).
@@ -33,46 +32,46 @@ Com base no algoritmo 16.5 de Brabazon et al. [1](#1).
:::
-## Construtor AIRS:
+## Construtor AIRS
A classe `AIRS` tem como objetivo realizar classificação utilizando metáforas de seleção e expansão clonal.
**Atributos:**
-* **n_resources** (`float`): Quantidade total de recursos disponíveis. O padrão é 10.
+- **n_resources** (`float`): Quantidade total de recursos disponíveis. O padrão é 10.
-* **rate_clonal** (`float`): Número máximo de clones possíveis de uma classe. Esta quantidade é multiplicada por (estímulo da célula * taxa de hipermutação) para definir o número de clones. O padrão é 10.
+- **rate_clonal** (`float`): Número máximo de clones possíveis de uma classe. Esta quantidade é multiplicada por (estímulo da célula * taxa de hipermutação) para definir o número de clones. O padrão é 10.
-* **rate_hypermutation** (`int`): Taxa de clones mutados derivada de rate_clonal como um fator escalar. O padrão é 0,75.
+- **rate_hypermutation** (`int`): Taxa de clones mutados derivada de rate_clonal como um fator escalar. O padrão é 0,75.
-* **affinity_threshold_scalar** (`float`): Limiar de afinidade normalizado. O padrão é 0,75.
+- **affinity_threshold_scalar** (`float`): Limiar de afinidade normalizado. O padrão é 0,75.
-* **k** (`int`): Número de vizinhos mais próximos (k-NN) que será usado para escolher um rótulo na predição. O padrão é 10.
+- **k** (`int`): Número de vizinhos mais próximos (k-NN) que será usado para escolher um rótulo na predição. O padrão é 10.
-* **max_iters** (`int`): Número máximo de interações no processo de refinamento do conjunto ARB exposto a aᵢ. O padrão é 100.
+- **max_iters** (`int`): Número máximo de interações no processo de refinamento do conjunto ARB exposto a aᵢ. O padrão é 100.
-* **resource_amplified** (`float`): Amplificador de consumo de recursos, multiplicado com o estímulo para subtrair recursos. O padrão é 1.0 (sem amplificação).
+- **resource_amplified** (`float`): Amplificador de consumo de recursos, multiplicado com o estímulo para subtrair recursos. O padrão é 1.0 (sem amplificação).
-* **metric** (Literal["manhattan", "minkowski", "euclidean"]): Forma de calcular a distância entre o detector e a amostra:
+- **metric** (Literal["manhattan", "minkowski", "euclidean"]): Forma de calcular a distância entre o detector e a amostra:
- * ``'euclidiana'`` ➜ O cálculo da distância dá-se pela expressão: $$\sqrt{(X_1 - X_1)^2 + (Y_2 - Y_2)^2 + ... + (Y_n - Y_n)^2}$$.
- * ``'minkowski'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - Y_1|^p + |X_2 - Y_2|^p + ... |X_n - Y_n|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - X_1| + |Y_2 - Y_2| + ... + |Y_n - Y_n|)$$.
+ - ``'euclidiana'`` ➜ O cálculo da distância dá-se pela expressão: $$\sqrt{(X_1 - X_1)^2 + (Y_2 - Y_2)^2 + ... + (Y_n - Y_n)^2}$$.
+ - ``'minkowski'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - Y_1|^p + |X_2 - Y_2|^p + ... |X_n - Y_n|^p)^\frac{1}{p}$$.
+ - ``'manhattan'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - X_1| + |Y_2 - Y_2| + ... + |Y_n - Y_n|)$$.
Defaults to ``'euclidean'``.
-* **seed** (``Optional[int]``): Semente para geração aleatória de valores dos detectores. O padrão é None.
+- **seed** (``Optional[int]``): Semente para geração aleatória de valores dos detectores. O padrão é None.
- `**kwargs`:
- * **p** (`float`): Este parâmetro armazena o valor de `p` usado na distância de Minkowski.
+ - **p** (`float`): Este parâmetro armazena o valor de `p` usado na distância de Minkowski.
O padrão é `2`, que corresponde à distância euclidiana normalizada. Diferentes valores de p resultam em variantes distintas da distância de Minkowski. [Saiba mais](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
**Outras variáveis inicializadas:**
-* **cells_memory** (`dict`): Armazena uma lista de células de memória por classe.
-* **affinity_threshold** (`dict`): Define o limiar de afinidade entre antígenos.
-* **classes** (`npt.NDArray`): Lista de classes de saída.
+- **cells_memory** (`dict`): Armazena uma lista de células de memória por classe.
+- **affinity_threshold** (`dict`): Define o limiar de afinidade entre antígenos.
+- **classes** (`npt.NDArray`): Lista de classes de saída.
---
@@ -90,9 +89,9 @@ Realiza o treinamento conforme `X` e `y`, utilizando o método Sistema de Reconh
**Parâmetros de entrada:**
-* **X**: Array com as características das amostras, com **N** amostras (linhas) e **N** características (colunas), normalizado para valores entre [0, 1].
-* **y**: Array com as classes de saída correspondentes às **N** amostras relacionadas a `X`.
-* **verbose**: Booleano, padrão `True`, determina se o feedback da geração dos detectores será impresso.
+- **X**: Array com as características das amostras, com **N** amostras (linhas) e **N** características (colunas), normalizado para valores entre [0, 1].
+- **y**: Array com as classes de saída correspondentes às **N** amostras relacionadas a `X`.
+- **verbose**: Booleano, padrão `True`, determina se o feedback da geração dos detectores será impresso.
*Retorna a instância da classe.*
@@ -108,16 +107,16 @@ def predict(self, X: npt.NDArray) -> npt.NDArray:
**Parâmetro de entrada:**
-* **X**: Array com as características para predição, com **N** amostras (linhas) e **N** colunas.
+- **X**: Array com as características para predição, com **N** amostras (linhas) e **N** colunas.
**Retorna:**
-* **C**: Um array de predições com as classes de saída para as características fornecidas.
-* **None**: Se não houver detectores.
+- **C**: Um array de predições com as classes de saída para as características fornecidas.
+- **None**: Se não houver detectores.
---
-### Método score(...):
+### Método score(...)
A função `score(...)` calcula a acurácia do modelo treinado realizando predições e calculando a precisão.
@@ -131,14 +130,14 @@ Retorna a acurácia como um `float`.
## Métodos Privados
-### Método _refinement_arb(...):
+### Método _refinement_arb(...)
A função "_refinement_arb(...)" refina o conjunto ARB até que o valor médio de estímulo ultrapasse o limiar definido (`affinity_threshold_scalar`).
Parâmetros:
-* **c_match** (`Cell`): Célula com o maior estímulo em relação a aᵢ.
-* **arb_list** (`List[_ARB]`): Conjunto ARB.
+- **c_match** (`Cell`): Célula com o maior estímulo em relação a aᵢ.
+- **arb_list** (`List[_ARB]`): Conjunto ARB.
```python
def _refinement_arb(self, ai: npt.NDArray, c_match: Cell, arb_list: List[_ARB]) -> _ARB:
@@ -148,7 +147,7 @@ Retorna a célula (_ARB) com o maior estímulo ARB.
---
-### Método _cells_affinity_threshold(...):
+### Método _cells_affinity_threshold(...)
A função "_cells_affinity_threshold(...)" calcula o limiar de afinidade com base na afinidade média entre instâncias de treinamento, onde aᵢ e aⱼ são um par de antígenos, e a afinidade é medida pela distância (Euclidiana, Manhattan, Minkowski, Hamming).
**Seguindo a fórmula:**
@@ -160,7 +159,7 @@ $$
Parâmetros:
-* **antigens_list** (`NDArray`): Lista de antígenos de treinamento.
+- **antigens_list** (`NDArray`): Lista de antígenos de treinamento.
```python
def _cells_affinity_threshold(self, antigens_list: npt.NDArray):
@@ -168,14 +167,14 @@ def _cells_affinity_threshold(self, antigens_list: npt.NDArray):
---
-### Método _affinity(...):
+### Método _affinity(...)
A função "_affinity(...)" calcula o estímulo entre dois vetores usando métricas.
Parâmetros:
-* **u** (`npt.NDArray`): Coordenadas do primeiro ponto.
-* **v** (`npt.NDArray`): Coordenadas do segundo ponto.
+- **u** (`npt.NDArray`): Coordenadas do primeiro ponto.
+- **v** (`npt.NDArray`): Coordenadas do segundo ponto.
```python
def _affinity(self, u: npt.NDArray, v: npt.NDArray) -> float:
@@ -185,13 +184,13 @@ Retorna a taxa de estímulo entre os vetores.
---
-### Método _init_memory_c(...):
+### Método _init_memory_c(...)
A função "_init_memory_c(...)" inicializa células de memória selecionando aleatoriamente `n_antigens_selected` da lista de antígenos de treinamento.
Parâmetros:
-* **antigens_list** (`NDArray`): Lista de antígenos de treinamento.
+- **antigens_list** (`NDArray`): Lista de antígenos de treinamento.
```python
def _init_memory_c(self, antigens_list: npt.NDArray) -> List[Cell]:
@@ -199,10 +198,10 @@ def _init_memory_c(self, antigens_list: npt.NDArray) -> List[Cell]:
---
-
-# Referências
+## Referências
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
\ No newline at end of file
+### 1
+>
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/airs/abr.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/airs/abr.md
index 86b9ce7e..949c9a47 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/airs/abr.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/airs/abr.md
@@ -25,16 +25,18 @@ Individuo do conjunto de células reconhecedoras (ABR), herda características d
:::
-### Constructor:
+### Constructor
Parameters:
+
* vector (``npt.NDArray``): A feature vector of the cell. Defaults to None.
---
-### Function consume_resource(...):
+### Function consume_resource(...)
Parameters:
+
* n_resource (```float```) : The initial amount of resources.
* amplified (``float``): Amplifier for resource consumption by the cell. It is multiplied by the cell's stimulus. The default value is 1.
@@ -43,4 +45,3 @@ def consume_resource(self, n_resource: float, amplified: float = 1) -> float:
```
Returns the remaining amount of resources after consumption.
-
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/clonalg.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/clonalg.md
index 6415eb11..94e2ee23 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/clonalg.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/clonalg.md
@@ -17,11 +17,10 @@ keywords:
A classe `Clonalg` é um **algoritmo de otimização** inspirado no processo biológico de seleção clonal do sistema imunológico. Esta implementação é projetada para minimizar ou maximizar funções de custo em diversos tipos de problemas, incluindo problemas binários, contínuos, com valores limitados (ranged) e de permutação.
-:::info
+:::tip
A implementação do CLONALG foi inspirada na descrição apresentada em [1](#1).
:::
-
:::info
Esta implementação do CLONALG contém algumas alterações baseadas no contexto do AISP, para aplicação geral
a diversos problemas, que podem produzir resultados diferentes da implementação padrão ou
@@ -178,9 +177,10 @@ Clona e aplica hipermutação a uma população de anticorpos. Retorna uma lista
---
-# Referências
+## Referências
---
-##### 1
-> BROWNLEE, Jason. Clonal Selection Algorithm. Clever Algorithms: Nature-inspired Programming Recipes., 2011. Available at: https://cleveralgorithms.com/nature-inspired/immune/clonal_selection_algorithm.html
\ No newline at end of file
+### 1
+>
+> BROWNLEE, Jason. Clonal Selection Algorithm. Clever Algorithms: Nature-inspired Programming Recipes., 2011. Available at: [https://cleveralgorithms.com/nature-inspired/immune/clonal_selection_algorithm.html](https://cleveralgorithms.com/nature-inspired/immune/clonal_selection_algorithm.html)
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/immune-network-theory/AiNet.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/immune-network-theory/AiNet.md
index eb81833b..19be65a0 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/immune-network-theory/AiNet.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/immune-network-theory/AiNet.md
@@ -1,6 +1,5 @@
---
id: ainet
-title: AiNet
sidebar_label: AiNet - Agrupamento e Compressão
sidebar_position: 1
pagination_next: null
@@ -28,24 +27,23 @@ lastUpdatedAt: 2025/08/19
author: João Paulo
---
-# AiNet - Rede Imunológica Artificial para Agrupamento e Compressão.
+# AiNet - Rede Imunológica Artificial para Agrupamento e Compressão
A classe AiNet tem como objetivo realizar agrupamento utilizando metáforas inspiradas na teoria da rede imunológica.
-A classe AiNet implementa o algoritmo de Rede Imune Artificial para compressão e clustering. Ela utiliza princípios da teoria de redes imunes,
-seleção clonal e maturação por afinidade para comprimir conjuntos de dados e encontrar clusters [1](#1).
+A classe AiNet implementa o algoritmo de Rede Imune Artificial para compressão e clustering. Ela utiliza princípios da teoria de redes imunes,
+seleção clonal e maturação por afinidade para comprimir conjuntos de dados e encontrar clusters [1](#1).
Para clustering, pode opcionalmente utilizar uma [**Árvore Geradora Mínima**
(MST)](#2) para separar nós distantes em grupos.
:::info
-**``AiNet``** estende a **[classe ``BaseAiNet``](/docs/advanced-guides/base-classes-reference/ina/ainet)**, herdando sua funcionalidade básica.
+**``AiNet``** estende a **[classe ``BaseAiNet``](../../advanced-guides/base-classes-reference/ina/ainet.md)**, herdando sua funcionalidade básica.
:::
## Constructor
-
```python
class AiNet(
self,
@@ -78,18 +76,17 @@ class AiNet(
* **k** (`int`): Número de vizinhos mais próximos usados para predição de rótulos. Padrão: 3.
* **metric** (Literal["manhattan", "minkowski", "euclidean"]): Forma de calcular a distância entre o detector e a amostra:
- * `'euclidean'` ➜ Distância dada pela expressão:
- $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + ... + (Y_{n} - Y_{n})^2}$$
- * ``'minkowski'`` ➜ Distância dada pela expressão:
- $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + ... |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ Distância dada pela expressão: $$( |X_{1} - X_{1}| + |Y_{2} - Y_{2}| + ... + |Y_{n} - Y_{n}|)$$.
+ * `'euclidean'` ➜ Distância dada pela expressão:
+ $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$
+ * ``'minkowski'`` ➜ Distância dada pela expressão:
+ $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
+ * ``'manhattan'`` ➜ Distância dada pela expressão: $$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$.
Padrão: **"Euclidean"**.
* **seed** (`Optional[int]`): Semente para geração de números aleatórios. Padrão: None.
* **use_mst_clustering** (`bool`): Define se o clustering baseado em MST deve ser utilizado. Padrão: True.
* **kwargs**:
-
* **p** (`float`): Parâmetro para distância de Minkowski. Padrão: 2.
**Outras variáveis inicializadas:**
@@ -310,12 +307,14 @@ def _build_mst(self):
---
-# Referências
+## Referências
-##### 1
+### 1
+>
> 1. De Castro, Leandro & José, Fernando & von Zuben, Antonio Augusto. (2001). aiNet: An Artificial Immune Network for Data Analysis.
> Disponível em: [https://www.researchgate.net/publication/228378350_aiNet_An_Artificial_Immune_Network_for_Data_Analysis](https://www.researchgate.net/publication/228378350_aiNet_An_Artificial_Immune_Network_for_Data_Analysis)
-##### 2
+### 2
+>
> 2. SciPy Documentation. *Minimum Spanning Tree*.
-> Disponível em: [https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree)
\ No newline at end of file
+> Disponível em: [https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree)
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/immune-network-theory/README.mdx b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/immune-network-theory/README.mdx
index 66359b3c..cfa989ea 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/immune-network-theory/README.mdx
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/immune-network-theory/README.mdx
@@ -31,9 +31,9 @@ A Rede Imunológica Artificial pode ser aplicada em diferentes contextos, tais c
-# References
+## References
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
+### 1
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/negative-selection/BNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/negative-selection/BNSA.md
index 7bfa36a9..803f1022 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/negative-selection/BNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/negative-selection/BNSA.md
@@ -1,6 +1,5 @@
---
id: bnsa
-title: BNSA
sidebar_label: BNSA - Algoritmo de Seleção Negativa Binária
sidebar_position: 2
pagination_next: null
@@ -20,9 +19,9 @@ keywords:
- Computação Natural
---
-# BNSA (Algoritmo de Seleção Negativa Binária).
+# BNSA (Algoritmo de Seleção Negativa Binária)
-A classe ``BNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
+A classe ``BNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
```python
class BNSA(
@@ -36,18 +35,20 @@ class BNSA(
```
**Attributes:**
+
* *N* (``int``): Quantidade de detectores. Defaults to ``100``.
* *aff_thresh* (``float``): A variável ('affinity threshold') representa a porcentagem de não similaridade entre a célula T e as amostras próprias. O valor padrão é de 10% (0,1), enquanto que o valor de 1,0 representa 100% de não similaridade.
+
:::note
Definir uma porcentagem de diferença muito alta pode resultar na incapacidade de gerar detectores para não-próprio.
:::
-* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
+* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
possível loop infinito caso seja definido um raio que não seja possível gerar detectores do não-próprio. Defaults to ``1000``.
* *seed* (``int``): Semente para a geração randômica dos valores nos detectores. Defaults to ``None``.
* no_label_sample_selection (``str``): Método para a seleção de rótulos para amostras designadas como não pertencentes por todos os detectores não pertencentes. **Tipos de métodos disponíveis:**
- - (``max_average_difference``): Seleciona a classe com a maior diferença média entre os detectores.
- - (``max_nearest_difference``): Seleciona a classe com a maior diferença entre o detector mais próximo e mais distante da amostra.
+ * (``max_average_difference``): Seleciona a classe com a maior diferença média entre os detectores.
+ * (``max_nearest_difference``): Seleciona a classe com a maior diferença entre o detector mais próximo e mais distante da amostra.
**Outras variáveis iniciadas:**
@@ -57,17 +58,19 @@ possível loop infinito caso seja definido um raio que não seja possível gerar
---
-### Função fit(...)
+## Função fit(...)
A função ``fit(...)`` gera os detectores para os não próprios com relação às amostras:
```python
def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
```
+
Nela é realizado o treinamento de acordo com ``X`` e ``y``, usando o método de seleção negativa(``NegativeSelect``).
**Os parâmetros de entrada são:**
-* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
+
+* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
* ``y``: array com as classes de saídas disposto em **N** amostras que são relacionadas ao ``X``.
* ``verbose``: boolean com valor padrão ``True``, determina se o feedback da geração dos detectores será impresso.
@@ -75,7 +78,7 @@ Nela é realizado o treinamento de acordo com ``X`` e ``y``, usando o método de
---
-### Função predict(...)
+## Função predict(...)
A função ``predict(...)`` realiza a previsão das classes utilizando os detectores gerados:
@@ -84,16 +87,17 @@ def predict(self, X: npt.NDArray) -> npt.NDArray:
```
**O parâmetro de entrada:**
-
+
* ``X``: array com as características para a previsão, com **N** amostras (Linhas) e **N** colunas.
-**Retorna:**
-* ``C``: Um array de previsão com as classes de saída para as características informadas.
+**Retorna:**
+
+* ``C``: Um array de previsão com as classes de saída para as características informadas.
* ``None``: se não houver detectores.
---
-### Função score(...)
+## Função score(...)
A função "score(...)" calcula a precisão do modelo treinado por meio da realização de previsões e do cálculo da acurácia.
@@ -109,7 +113,7 @@ retorna a acurácia, do tipo ``float``.
---
-### Função __slice_index_list_by_class(...)
+## Função __slice_index_list_by_class(...)
A função ``__slice_index_list_by_class(...)``, separa os índices das linhas conforme a classe de saída, para percorrer o array de amostra, apenas nas posições que a saída for a classe que está sendo treinada:
@@ -119,4 +123,4 @@ def __slice_index_list_by_class(self, y: npt.NDArray) -> dict:
Retorna um dicionario com as classes como chave e os índices em ``X`` das amostras.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/negative-selection/README.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/negative-selection/README.md
index 4e2d9448..610f032b 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/negative-selection/README.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/negative-selection/README.md
@@ -8,30 +8,37 @@ A **seleção negativa** é o processo em que o sistema imunológico faz a matur
---
-# classes
+## classes
> 1. **[Binary version:](BNSA.md)**
+>
>> O algoritmo binário adaptado para múltiplas classes neste projeto tem como base a versão proposta por [Forrest et al. (1994)](#2), originalmente desenvolvida para segurança computacional.
>>> **Exemplo:**
+>>>
>>> + [Base de dados Mushrooms](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/BNSA/mushrooms_dataBase_example_pt-br.ipynb)
> 2. **[Real-Valued version:](RNSA.md)**
+>
>>Este algoritmo possui duas versões diferentes: uma baseada na versão canônica [[1]](#1) e outra com detectores de raio variável [[3]](#3). Ambas estão adaptadas para trabalhar com múltiplas classes e possuem métodos para previsão de dados presentes na região não-self de todos os detectores e classes.
>>> **Exemplos:**
->>> + [Base de dados Iris](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/iris_dataBase_example_pt-br.ipynb)
->>> + [Base de dados Geyser](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/geyser_dataBase_example_pt-br.ipynb)
+>>>
+>>> + [Base de dados Iris](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/iris_dataBase_example_pt-br.ipynb)
+>>> + [Base de dados Geyser](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/geyser_dataBase_example_pt-br.ipynb)
-# References
+## References
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
+### 1
+>
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
-##### 2
-> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: http://dx.doi.org/10.1109/RISP.1994.296580.
+### 2
+>
+> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: [https://dx.doi.org/10.1109/RISP.1994.296580](https://dx.doi.org/10.1109/RISP.1994.296580).
-##### 3
-> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: http://dx.doi.org/10.1007/978-3-540-24854-5_30.
+### 3
+>
+> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: [https://dx.doi.org/10.1007/978-3-540-24854-5_30](https://dx.doi.org/10.1007/978-3-540-24854-5_30).
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/negative-selection/RNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/negative-selection/RNSA.md
index b98833aa..342e3f01 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/negative-selection/RNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/aisp-techniques/negative-selection/RNSA.md
@@ -1,6 +1,5 @@
---
id: rnsa
-title: RNSA
sidebar_label: RNSA - Algoritmo de Seleção Negativa de Valor Real
sidebar_position: 1
last_update:
@@ -21,9 +20,9 @@ keywords:
# RNSA (Algoritmo de Seleção Negativa de Valor Real)
-## Construtor RNSA:
+## Construtor RNSA
-A classe ``RNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
+A classe ``RNSA`` tem a finalidade de classificação e identificação de anomalias através do método self e not self .
```python
class RNSA(
@@ -44,39 +43,39 @@ class RNSA(
* *N* (``int``): Quantidade de detectores. Defaults to ``100``.
* *r* (``float``): Raio do detector. Defaults to ``0.05``.
+
:::note
É importante considerar que definir um raio muito baixo para o detector pode reduzir significativamente a taxa de detecção. Por outro lado, um raio muito grande pode inviabilizar a incorporação do detector no espaço de busca, o que também pode comprometer o desempenho da detecção. É fundamental encontrar um equilíbrio entre o tamanho do raio e a eficiência da detecção para obter os melhores resultados possíveis.
:::
-
* *k* (``int``): Quantidade de vizinhos próximos dos detectores gerados aleatoriamente para efetuar o cálculo da média da distância. Defaults to ``1``.
-* *metric* (``str``): Forma para se calcular a distância entre o detector e a amostra:
-
- * ``'euclidiana'`` ➜ O cálculo da distância dá-se pela expressão: $$\sqrt{(X_1 - X_1)^2 + (Y_2 - Y_2)^2 + ... + (Y_n - Y_n)^2}$$.
- * ``'minkowski'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - Y_1|^p + |X_2 - Y_2|^p + ... |X_n - Y_n|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - X_1| + |Y_2 - Y_2| + ... + |Y_n - Y_n|)$$.
+* *metric* (``str``): Forma para se calcular a distância entre o detector e a amostra:
+
+ * ``'euclidiana'`` ➜ O cálculo da distância dá-se pela expressão: $$\sqrt{(X_1 - X_1)^2 + (Y_2 - Y_2)^2 + ... + (Y_n - Y_n)^2}$$.
+ * ``'minkowski'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - Y_1|^p + |X_2 - Y_2|^p + ... |X_n - Y_n|^p)^\frac{1}{p}$$.
+ * ``'manhattan'`` ➜ O cálculo da distância dá-se pela expressão: $$( |X_1 - X_1| + |Y_2 - Y_2| + ... + |Y_n - Y_n|)$$.
Defaults to ``'euclidean'``.
-* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
+* *max_discards* (``int``): Este parâmetro indica o número máximo de descartes de detectores em sequência, que tem como objetivo evitar um
possível loop infinito caso seja definido um raio que não seja possível gerar detectores do não-próprio. Defaults to ``1000``.
* *seed* (``int``): Semente para a geração randômica dos valores nos detectores. Defaults to ``None``.
* *algorithm* (``str``), Definir a versão do algoritmo:
- * ``'default-NSA'``: Algoritmo padrão com raio fixo.
- * ``'V-detector'``: Este algoritmo é baseado no artigo "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", de autoria de Ji, Z., Dasgupta, D. (2004), e utiliza um raio variável para a detecção de anomalias em espaços de características.
+ * ``'default-NSA'``: Algoritmo padrão com raio fixo.
+ * ``'V-detector'``: Este algoritmo é baseado no artigo "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", de autoria de Ji, Z., Dasgupta, D. (2004), e utiliza um raio variável para a detecção de anomalias em espaços de características.
Defaults to ``'default-NSA'``.
* *r_s* (``float``): O valor de ``rₛ`` é o raio das amostras próprias da matriz ``X``.
+
- ``**kwargs``:
- - *non_self_label* (``str``): Esta variável armazena o rótulo que será atribuído quando os dados possuírem
+ * *non_self_label* (``str``): Esta variável armazena o rótulo que será atribuído quando os dados possuírem
apenas uma classe de saída, e a amostra for classificada como não pertencente a essa classe. Defaults to ``'non-self'``.
-
- - *cell_bounds* (``bool``): Se definido como ``True``, esta opção limita a geração dos detectores ao espaço do plano compreendido entre 0 e 1. Isso significa que qualquer detector cujo raio ultrapasse esse limite é descartado, e esta variável é usada exclusivamente no algoritmo ``V-detector``.
- - p (``float``): Este parâmetro armazena o valor de ``p`` utilizada na distância de Minkowski. O padrão é ``2``, o que significa distância euclidiana normalizada. Diferentes valores de p levam a diferentes variantes da distância de Minkowski [saiba mais](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
-
+
+ * *cell_bounds* (``bool``): Se definido como ``True``, esta opção limita a geração dos detectores ao espaço do plano compreendido entre 0 e 1. Isso significa que qualquer detector cujo raio ultrapasse esse limite é descartado, e esta variável é usada exclusivamente no algoritmo ``V-detector``.
+ * p (``float``): Este parâmetro armazena o valor de ``p`` utilizada na distância de Minkowski. O padrão é ``2``, o que significa distância euclidiana normalizada. Diferentes valores de p levam a diferentes variantes da distância de Minkowski [saiba mais](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
**Outras variáveis iniciadas:**
@@ -93,10 +92,12 @@ A função ``fit(...)`` gera os detectores para os não próprios com relação
```python
def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
```
+
Nela é realizado o treinamento de acordo com ``X`` e ``y``, usando o método de seleção negativa(``NegativeSelect``).
**Os parâmetros de entrada são:**
-* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
+
+* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
* ``y``: array com as classes de saídas disposto em **N** amostras que são relacionadas ao ``X``.
* ``verbose``: boolean com valor padrão ``True``, determina se o feedback da geração dos detectores será impresso.
@@ -113,11 +114,12 @@ def predict(self, X: npt.NDArray) -> npt.NDArray:
```
**O parâmetro de entrada:**
-
+
* ``X``: array com as características para a previsão, com **N** amostras (Linhas) e **N** colunas.
-**Retorna:**
-* ``C``: Um array de previsão com as classes de saída para as características informadas.
+**Retorna:**
+
+* ``C``: Um array de previsão com as classes de saída para as características informadas.
* ``None``: se não houver detectores.
---
@@ -147,9 +149,10 @@ def __checks_valid_detector(self, X: npt.NDArray, vector_x: npt.NDArray, samples
```
**Os parâmetros de entrada são:**
+
* ``X``: array com as características das amostras com **N** amostras (linhas) e **N** características (colunas), normalizados para valores entre [0, 1].
-* ``vector_x``: Detector candidato gerado aleatoriamente.
+* ``vector_x``: Detector candidato gerado aleatoriamente.
* ``samplesIndexClass``: Array com os indexes de uma classe.
@@ -173,14 +176,14 @@ def __compare_KnearestNeighbors_List(self, knn: npt.NDArray, distance: float) ->
Função para comparar uma amostra com os detectores, verificando se a amostra é própria.
-
Nesta função, quando possui ambiguidade de classes, retorna a classe que possuir a média de distância maior entre os detectores.
**Os parâmetros de entrada são:**
+
* line: vetor com N-características
**Retorna:** A classe prevista com os detectores ou None se a amostra não se qualificar a nenhuma classe.
-
+
---
### Função __detector_is_valid_to_Vdetector(...)
@@ -227,4 +230,4 @@ def __slice_index_list_by_class(self, y: npt.NDArray) -> dict:
Retorna um dicionario com as classes como chave e os índices em ``X`` das amostras.
----
\ No newline at end of file
+---
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/examples/Classification/csa.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/examples/Classification/csa.md
index 6549d751..3e622c8f 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/examples/Classification/csa.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/examples/Classification/csa.md
@@ -26,30 +26,34 @@ keywords:
- reconhecimpt-brto imune
---
-# Algoritmo de Seleção Clonal
-
Esta página apresenta uma coleção de exemplos práticos demonstrando como usar o Algoritmo de Seleção Clonal.
## AIRS (Sistema Imunológico Artificial de Reconhecimento)
-
Run online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fpt%2Dbr%2Fclassification%2FAIRS)
---
### Algoritmo Binário
-+ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/example_with_randomly_gpt-brerated_dataset-pt-br.ipynb)
++ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/example_with_randomly_gpt-brerated_dataset-pt-br.ipynb)
+
> No exemplo apresentado neste notebook, foram geradas 1000 amostras aleatórias, organizadas em dois grupos, um para cada classe.
+ [Exemplo com banco de dados de cogumelos](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/mushrooms_dataBase_example_pt-br.ipynb)
+
> Utiliza o [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), que contém informações sobre cogumelos comestíveis e venenosos.
### Algoritmo com Valores Reais
-+ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/example_with_randomly_gpt-brerated_dataset-pt-br.ipynb)
++ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/example_with_randomly_gpt-brerated_dataset-pt-br.ipynb)
+
> No exemplo apresentado neste notebook, foram geradas 500 amostras aleatórias, organizadas em dois grupos, um para cada classe. Podemos ver abaixo os detectores "não-próprio" gerados.
+
+ [Exemplo com banco de dados Iris](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/iris_dataBase_example_pt-br.ipynb)
+
> Exemplo usando o NSA com o [iris database](https://archive.ics.uci.edu/ml/datasets/iris), que contém amostras com quatro dimensões e três classes de saída (Setosa, Versicolor e Virginica).
+
+ [Exemplo com banco de dados Geyser](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/AIRS/geyser_dataBase_example_pt-br.ipynb)
-> Para classificar erupções de gêiseres no Parque Nacional de Yellowstone, este notebook utiliza o [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
\ No newline at end of file
+
+> Para classificar erupções de gêiseres no Parque Nacional de Yellowstone, este notebook utiliza o [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/examples/Classification/nsa.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/examples/Classification/nsa.md
index 3a12e3d5..946c60c6 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/examples/Classification/nsa.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/examples/Classification/nsa.md
@@ -35,9 +35,11 @@ Execute on-line via Binder: [](htt
---
+ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/BNSA/example_with_randomly_generated_dataset-pt.ipynb)
+
> No exemplo presente neste notebook, foram geradas 1000 amostras aleatórias, organizadas em dois grupos, um para cada classe.
+ [Exemplo de Base de Dados de Cogumelos](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/BNSA/mushrooms_dataBase_example_pt.ipynb)
+
> Ele usa a [base de dados de cogumelos](https://archive.ics.uci.edu/dataset/73/mushroom), que contém informações sobre cogumelos comestíveis e venenosos.
## RNSA (Algoritmo de Seleção Negativa de Valores Reais)
@@ -47,10 +49,13 @@ Execute on-line via Binder: [](htt
---
+ [Exemplo com amostras aleatórias](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/example_with_randomly_generated_dataset-pt.ipynb)
+
> No exemplo presente neste notebook, foram geradas 500 amostras aleatórias, organizadas em dois grupos, um para cada classe.
+ [Exemplo de Base de Dados Iris](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/iris_dataBase_example_pt.ipynb)
+
> Exemplo usando a base de dados [íris](https://archive.ics.uci.edu/ml/datasets/iris), que contém amostras de quatro dimensões e três classes de saída (Setosa, Versicolor e Virginica).
+ [Exemplo de Base de Dados Geyser](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/geyser_dataBase_example_pt.ipynb)
+
> Para classificar erupções de geysers no Parque Nacional de Yellowstone, este notebook usa a [base de dados Old Faithful](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/examples/Clustering/ina.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/examples/Clustering/ina.md
index 23334dcf..fb3f1087 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/examples/Clustering/ina.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/examples/Clustering/ina.md
@@ -18,8 +18,6 @@ keywords:
- conjunto de dados geyser
---
-# Algoritmos de Rede Imunológica
-
Nesta página, você encontrará uma coleção de exemplos práticos que demonstram como usar as classes do Algoritmo de Rede Imunológica implementadas em nosso pacote.
Execute os notebooks online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fpt-br%2Fclustering%2FAiNet)
@@ -29,10 +27,13 @@ Execute os notebooks online via Binder: [
+
> Neste notebook, o AiNet é demonstrado em três conjuntos de dados sintéticos:
-> - **Blobs:** clusters esféricos bem definidos, fáceis de separar.
-> - **Moons:** clusters não-lineares, ilustrando fronteiras de decisão mais complexas.
-> - **Circles:** dois círculos concêntricos, mostrando a capacidade de lidar com separações não-lineares.
+>
+> + **Blobs:** clusters esféricos bem definidos, fáceis de separar.
+> + **Moons:** clusters não-lineares, ilustrando fronteiras de decisão mais complexas.
+> + **Circles:** dois círculos concêntricos, mostrando a capacidade de lidar com separações não-lineares.
+ [Exemplo com base de dados do geyser](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/clustering/AiNet/geyser_dataBase_example.ipynb)
-> Para classificar erupções de geysers no Parque Nacional de Yellowstone, este notebook usa a [base de dados Old Faithful](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
\ No newline at end of file
+
+> Para classificar erupções de geysers no Parque Nacional de Yellowstone, este notebook usa a [base de dados Old Faithful](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/examples/Optimization/csa.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/examples/Optimization/csa.md
index eeea8a92..ea9b0171 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/examples/Optimization/csa.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/examples/Optimization/csa.md
@@ -17,8 +17,6 @@ palavras-chave:
- aprendizado de máquina
---
-# Algoritmo de Seleção Clonal
-
Nesta página, você encontrará uma coleção de exemplos práticos que demonstram como usar as classes do Algoritmo de Seleção Clonal implementadas em nosso pacote.
Execute notebooks online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fpt-br%2Foptimization%2Fclonalg)
@@ -28,10 +26,13 @@ Execute notebooks online via Binder: [
+
> Neste notebook, aplique o **Clonalg** ao Problema da Mochila usando algoritmos de otimização do pacote AISP.
+ [Função Rastrigin](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/optimization/clonalg/rastrigin_function_example.ipynb)
+
> Neste notebook, aplicamos o **Clonalg** à Função Rastrigin, um problema clássico de otimização contínua usando algoritmos de otimização do pacote AISP.
+ [Problema da Mochila](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/optimization/clonalg/knapsack_problem_example.ipynb)
-> Neste notebook, aplicamos o **Clonalg** ao Problema da Mochila usando algoritmos de otimização do pacote AISP.
\ No newline at end of file
+
+> Neste notebook, aplicamos o **Clonalg** ao Problema da Mochila usando algoritmos de otimização do pacote AISP.
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/AIRS.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/AIRS.md
index 55a92c70..506a2d2a 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/AIRS.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/AIRS.md
@@ -33,11 +33,12 @@ Acesse o notebook Jupyter com o código disponível [aqui](https://github.com/AI
Executar o notebook online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fpt-br%2Fclassification%2FAIRS%2Fexample_with_randomly_generated_dataset-pt.ipynb)
### Importação do Sistema de Reconhecimento Imunológico Artificial
+
```python
from aisp.csa import AIRS
```
-### Gerando bolhas de dados para as classe aleatoriamente.
+### Gerando bolhas de dados para as classe aleatoriamente
Utilizando a função make_blobs, são gerados dois conjuntos de dados em forma de bolhas, no intervalo entre 0 e 1, representando cada classe x e y. Em seguida, esses dados são separados em conjuntos de teste e treinamento.
@@ -59,7 +60,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-### Testing the model AIRS:
+### Testing the model AIRS
Em seguida, apresenta o resultado da acurácia da previsão.
@@ -79,6 +80,7 @@ print(classification_report(test_y, prev))
```
Output:
+
```bash
✔ Set of memory cells for classes (0, 1) successfully generated: ┇██████████┇ 400/400 memory cells for each aᵢ
A acurácia é 1.0
@@ -94,6 +96,6 @@ weighted avg 1.00 1.00 1.00 100
---
-### Célula de memória e plotagem de amostra:
+### Célula de memória e plotagem de amostra
-
\ No newline at end of file
+
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/AiNet.mdx b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/AiNet.mdx
index d63e5d5d..48544600 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/AiNet.mdx
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/AiNet.mdx
@@ -260,4 +260,4 @@ Coeficiente de Silhueta: 0.112
plot_immune_network(samples, predict_y, model, title_prefix="Circles - ")
```
-
+
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/BNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/BNSA.md
index 467b9958..0cc72327 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/BNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/BNSA.md
@@ -22,12 +22,10 @@ keywords:
# Usando o BNSA
-O presente exemplo, disponível aqui, visa demonstrar a aplicação do algoritmo de seleção negativa binária. Esse algoritmo é empregado na classificação de amostras com características discretas.
-
+O presente exemplo, disponível aqui, visa demonstrar a aplicação do algoritmo de seleção negativa binária. Esse algoritmo é empregado na classificação de amostras com características discretas.
Acesse o notebook Jupyter disponível [aqui](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/BNSA/example_with_randomly_generated_dataset-pt.ipynb)!
-
Executar o notebook online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fpt-br%2Fclassification%2FBNSA%2Fexample_with_randomly_generated_dataset-pt.ipynb)
## Importando o algoritmo BNSA
@@ -63,7 +61,7 @@ def generate_samples(n_samples: int, n_features: int, s: float, x: None):
---
-Cada classe contará com 500 amostras, sendo a similaridade mínima entre amostras de 80% (s = 0.2). Essas classes serão separadas em conjunto de treinamento (800 amostras) e de teste (200 amostras).
+Cada classe contará com 500 amostras, sendo a similaridade mínima entre amostras de 80% (s = 0.2). Essas classes serão separadas em conjunto de treinamento (800 amostras) e de teste (200 amostras).
```python
# Configurando a seed para 121 para garantir a reprodutibilidade dos dados gerados.
@@ -89,7 +87,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-## Treinamento:
+## Treinamento
O modelo é ajustado através dos padrões de treinamento. Nessa aplicação, a seleção negativa distribuirá, com taxa de diferenciação de 30%, 250 detectores pelo espaço de entradas.
@@ -106,6 +104,7 @@ print(classification_report(test_y, prev))
```
Output:
+
```
✔ Non-self detectors for classes (x, y) successfully generated: ┇██████████┇ 500/500 detectors
A acurácia é 0.93
@@ -122,6 +121,7 @@ weighted avg 0.93 0.93 0.93 200
---
## Avaliação
+
O modelo obteve 0,93 de acurácia para o conjunto teste. A precisão na classificação, tanto para x quanto para y, também foi de 0,93. Isso pode ser observado pela matriz de confusão na Figura 1.
-
\ No newline at end of file
+
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/Clonalg.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/Clonalg.md
index 60cc6a6a..3f10be4a 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/Clonalg.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/Clonalg.md
@@ -23,14 +23,15 @@ Acesse o notebook Jupyter com o código disponível [here](https://github.com/AI
Executar o notebook online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?urlpath=%2Fdoc%2Ftree%2F%2Fexamples%2Fpt-br%2Foptimization%2Fclonalg%2Frastrigin_function_example.ipynb)
-### Aplicamos o Clonalg à Função Rastrigin.
+### Aplicamos o Clonalg à Função Rastrigin
-A função Rastrigin é uma função multimodal não-convexa que possui muitos mínimos locais,
+A função Rastrigin é uma função multimodal não-convexa que possui muitos mínimos locais,
tornando-a um excelente teste para algoritmos de otimização, [saiba mais](https://en.wikipedia.org/wiki/Rastrigin_function). A função é definida como:
$$ f(x) = 10n + \sum_{i=1}^{n} (x_i^{2} - 10\cos(2\pi x_i)) $$
Onde:
+
* **n** é a dimensão do problema
* **x_i** ∈ [-5.12, 5.12] para cada dimensão
* **Mínimo global**: f(0,0) = 0
@@ -91,7 +92,9 @@ clonalg.optimize(100, 20)
if clonalg.best_cost is not None:
print('Best cost:', abs(clonalg.best_cost))
```
+
Output:
+
```bash
┌───────────┬─────────────────────────┬────────────────────┬─────────────────┐
│ Iteration │ Best Affinity (min) │ Worse Affinity │ Stagnation │
@@ -152,7 +155,9 @@ Best cost: 0.020278270044883584
```python
print(clonalg.get_report())
```
+
Output:
+
```python
=============================================
Optimization Summary
@@ -215,4 +220,4 @@ Cost History per Iteration:
### Evolução do melhor ao longo das gerações
-
\ No newline at end of file
+
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/RNSA.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/RNSA.md
index e743dcd5..27a5fba4 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/RNSA.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/basic-use/RNSA.md
@@ -24,16 +24,15 @@ keywords:
Acesse o notebook Jupyter com o código disponível [aqui](https://github.com/AIS-Package/aisp/blob/main/examples/pt-br/classification/RNSA/example_with_randomly_generated_dataset-pt.ipynb)!
-
Executar o notebook online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fpt-br%2Fclassification%2FRNSA%2Fexample_with_randomly_generated_dataset-pt.ipynb)
+## Importando o Algoritmo de seleção negativa de valor real
-## Importando o Algoritmo de seleção negativa de valor real.
```python
from aisp.nsa import RNSA
```
-## Gerando bolhas de dados para as classe aleatoriamente.
+## Gerando bolhas de dados para as classe aleatoriamente
Utilizando a função make_blobs, são gerados dois conjuntos de dados em forma de bolhas, no intervalo entre 0 e 1, representando cada classe x e y. Em seguida, esses dados são separados em conjuntos de teste e treinamento.
@@ -49,7 +48,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-## Testando o modelo `default-NSA`:
+## Testando o modelo `default-NSA`
Inicia o modelo com 500 detectores, cada um com um raio de 0.06. Em seguida, apresenta o resultado da acurácia da previsão.
@@ -68,6 +67,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```bash
✔ Non-self detectors for classes (0, 1) successfully generated: ┇██████████┇ 1000/1000 detectors
The accuracy is 1.0
@@ -83,13 +83,13 @@ weighted avg 1.00 1.00 1.00 100
---
-## Plotagem dos detector e amostras:
+## Plotagem dos detector e amostras
-
+
---
-## Testando o modelo `V-detector`:
+## Testando o modelo `V-detector`
Inicia o modelo com 50 detectores, onde o raio mínimo é de 0.05 e o raio próprio das amostras é de 0.04. Em seguida, mostra o resultado da acurácia da previsão.
@@ -108,6 +108,7 @@ print(classification_report(test_y, prev))
```
Output:
+
```bash
✔ Non-self detectors for classes (0, 1) successfully generated: ┇██████████┇ 100/100 detectors
A acuracia é 1.0
@@ -123,6 +124,6 @@ weighted avg 1.00 1.00 1.00 100
---
-## Plotagem dos detector e amostras:
+## Plotagem dos v-detector e amostras
-
\ No newline at end of file
+
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/instalation.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/instalation.md
index 169128c3..332103b7 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/instalation.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/getting-started/instalation.md
@@ -11,8 +11,6 @@ last_update:
author: João Paulo
---
-# **Instalação**
-
Esta página contém informações sobre as dependências do pacote, como instalá-lo e como importar os módulos.
### **Dependências:**
@@ -45,4 +43,4 @@ from aisp.nsa import RNSA, BNSA
nsa = RNSA(N=300, r=0.05)
-```
\ No newline at end of file
+```
diff --git a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/intro.md b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/intro.md
index 4fe3eb6d..ae0b0f46 100644
--- a/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/intro.md
+++ b/i18n/pt-br/docusaurus-plugin-content-docs/version-0.4.x/intro.md
@@ -24,10 +24,11 @@ keywords:
- Immune-inspired Algorithms
---
-# Pacote de Sistemas Imunológicos Artificiais.
+# Pacote de Sistemas Imunológicos Artificiais
+
-
+
@@ -37,9 +38,9 @@ keywords:
**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).
-### Algoritmos implementados:
+### Algoritmos implementados
-> - [x] [**Seleção Negativa.**](/docs/aisp-techniques/negative-selection/)
-> - [x] [**Algoritmos de Seleção Clonal.**](/docs/aisp-techniques/clonal-selection-algorithms/)
-> - [x] [**Teoria da Rede Imune.**](/docs/aisp-techniques/immune-network-theory/)
+> - [x] [**Seleção Negativa.**](./aisp-techniques/negative-selection/)
+> - [x] [**Algoritmos de Seleção Clonal.**](./aisp-techniques/clonal-selection-algorithms/)
+> - [x] [**Teoria da Rede Imune.**](./aisp-techniques/immune-network-theory/)
> - [ ] *Teoria do Perigo.*
diff --git a/versioned_docs/version-0.1.x/About us.mdx b/versioned_docs/version-0.1.x/About us.mdx
index d7cf4168..9e690c17 100644
--- a/versioned_docs/version-0.1.x/About us.mdx
+++ b/versioned_docs/version-0.1.x/About us.mdx
@@ -29,7 +29,7 @@ The AISP, or Artificial Immune Systems Package, had its origins in a research pr
name='Alison Zille Lopes'
date='2022'
githubUrl='https://github.com/alisonzille'
- lattesUrl='http://lattes.cnpq.br/3294097090760981'
+ lattesUrl='https://lattes.cnpq.br/3294097090760981'
/>
@@ -45,7 +45,7 @@ The AISP, or Artificial Immune Systems Package, had its origins in a research pr
date='2022-2023'
description="I was tasked with implementing version 0.1, which features the BNSA and RNSA negative selection classes, including fixed and variable radius versions."
githubUrl='https://github.com/Joao-Paulo-Silva'
- lattesUrl='http://lattes.cnpq.br/2561057724411407'
+ lattesUrl='https://lattes.cnpq.br/2561057724411407'
/>
\ No newline at end of file
diff --git a/versioned_docs/version-0.1.x/Examples/nsa.md b/versioned_docs/version-0.1.x/Examples/nsa.md
index 274d53a0..2b3654b7 100644
--- a/versioned_docs/version-0.1.x/Examples/nsa.md
+++ b/versioned_docs/version-0.1.x/Examples/nsa.md
@@ -24,15 +24,18 @@ keywords:
On this page, you will find a collection of practical examples that demonstrate how to use the negative selection classes implemented in our package.
-## The examples are organized below:
+## The examples are organized below
-### Data Normalization:
+### Data Normalization
+>
> Shows how to normalize data using negative selection classes. In the real-valued version, the data is normalized between 0 and 1. In the binary version, it is normalized into a bit vector.
-### K-fold Cross Validation with 50 Interactions:
+### K-fold Cross Validation with 50 Interactions
+>
> In this example, the data is divided into training and test sets and model performance is evaluated by cross-validation. So with dividing the training data into k parts. In each iteration, 10% of the training data is reserved for testing.
-### Training:
+### Training
+>
> The trained model is tested in this example with all available training data.
The examples below show various functionality of negative selection classes so that you know how to use them in your project. Feel free to explore these examples and adapt them as needed to meet your specific needs.
@@ -41,20 +44,26 @@ The examples below show various functionality of negative selection classes so t
Access the notebooks with the option to run them online using Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples)
-
## BNSA (Binary Negative Selection Algorithm)
-+ [Example with random samples](https://github.com/AIS-Package/aisp/blob/0.1.x/examples/BNSA/example_with_randomly_generated_dataset-en.ipynb)
++ [Example with random samples](https://github.com/AIS-Package/aisp/blob/0.1.x/examples/BNSA/example_with_randomly_generated_dataset-en.ipynb)
+
> In the example present in this notebook 1000 random samples were generated, arranged in two groups, one for each class.
+ [mushrooms_dataBase_example](https://github.com/AIS-Package/aisp/blob/0.1.x/examples/BNSA/mushrooms_dataBase_example_en.ipynb)
-> It uses the [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), which contains information about edible and poisonous mushrooms.
-# RNSA (Real-Valued Negative Selection Algorithm)
+> It uses the [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), which contains information about edible and poisonous mushrooms.
+
+## RNSA (Real-Valued Negative Selection Algorithm)
+
++ [Example with random samples](https://github.com/AIS-Package/aisp/blob/0.1.x/examples/RNSA/example_with_randomly_generated_dataset-en.ipynb)
-+ [Example with random samples](https://github.com/AIS-Package/aisp/blob/0.1.x/examples/RNSA/example_with_randomly_generated_dataset-en.ipynb)
> In the example present in this notebook 500 random samples were generated, arranged in two groups, one for each class, we can see the non-self detectors generated below
+
+ [iris_dataBase_example](https://github.com/AIS-Package/aisp/blob/0.1.x/examples/RNSA/iris_dataBase_example_en.ipynb)
+
> Example using the NSA [iris database](https://archive.ics.uci.edu/ml/datasets/iris), which contains four-dimensional samples and three output classes (Setosa, Versicolor and Virginica).
+
+ [geyser_dataBase_example](https://github.com/AIS-Package/aisp/blob/0.1.x/examples/RNSA/geyser_dataBase_example_en.ipynb)
-> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
\ No newline at end of file
+
+> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/versioned_docs/version-0.1.x/Getting Started/basic use/BNSA.md b/versioned_docs/version-0.1.x/Getting Started/basic use/BNSA.md
index 84d4935a..a5d56ea5 100644
--- a/versioned_docs/version-0.1.x/Getting Started/basic use/BNSA.md
+++ b/versioned_docs/version-0.1.x/Getting Started/basic use/BNSA.md
@@ -131,4 +131,4 @@ plt.ylabel('Estimated')
plt.show()
```
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/versioned_docs/version-0.1.x/Getting Started/basic use/RNSA.md b/versioned_docs/version-0.1.x/Getting Started/basic use/RNSA.md
index b34295da..71080a64 100644
--- a/versioned_docs/version-0.1.x/Getting Started/basic use/RNSA.md
+++ b/versioned_docs/version-0.1.x/Getting Started/basic use/RNSA.md
@@ -83,7 +83,7 @@ weighted avg 1.00 1.00 1.00 100
### Detector and sample plotting:
-
+
---
@@ -122,4 +122,4 @@ weighted avg 1.00 1.00 1.00 100
---
### Detector and sample plotting:
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/versioned_docs/version-0.1.x/Getting Started/instalation.md b/versioned_docs/version-0.1.x/Getting Started/instalation.md
index 185fdc7d..bbe5c9cd 100644
--- a/versioned_docs/version-0.1.x/Getting Started/instalation.md
+++ b/versioned_docs/version-0.1.x/Getting Started/instalation.md
@@ -1,7 +1,7 @@
---
sidebar_position: 1
-title: Instalation
-sidebar_label: Instalation
+title: Installation
+sidebar_label: Installation
lastUpdatedAt: 2025/05/17
author: João Paulo
showLastUpdateAuthor: true
@@ -11,8 +11,6 @@ last_update:
author: João Paulo
---
-# **Installation**
-
This page contains information about dependencies, how to install and how to import modules.
## **Dependencies:**
@@ -30,7 +28,7 @@ The package requires [python 3.10](https://www.python.org/downloads/) or higher.
-## **Instalation procedure**
+## **Installation procedure**
The simplest way to install is via ``pip``:
@@ -45,4 +43,3 @@ from aisp.nsa import RNSA, BNSA
nsa = RNSA(N=300, r=0.05)
```
-
diff --git a/versioned_docs/version-0.1.x/advanced-guides/Base Classes Reference/nsa.md b/versioned_docs/version-0.1.x/advanced-guides/Base Classes Reference/nsa.md
index 544d26a6..307eeb4f 100644
--- a/versioned_docs/version-0.1.x/advanced-guides/Base Classes Reference/nsa.md
+++ b/versioned_docs/version-0.1.x/advanced-guides/Base Classes Reference/nsa.md
@@ -12,11 +12,12 @@ The ``BaseNSA`` class contains utility functions with the ``protected`` modifier
---
-## Protected Functions:
+## Protected Functions
---
-### Function _check_and_raise_exceptions_fit(...):
+### Function _check_and_raise_exceptions_fit(...)
+
```python
def _check_and_raise_exceptions_fit(
X: npt.NDArray = None,
@@ -24,20 +25,24 @@ def _check_and_raise_exceptions_fit(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Function responsible for verifying fit function parameters and throwing exceptions if the verification is not successful.
**Parameters**:
-* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, [``N samples`` (rows)][``N features`` (columns)].
-* ***y*** (``npt.NDArray``): Array of target classes of ``X`` with [``N samples`` (lines)].
-* ***_class_*** (Literal[RNSA, BNSA], optional): Current class. Defaults to 'RNSA'.
+
+* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, \[``N samples`` (rows)\]\[``N features`` (columns)].
+* ***y*** (``npt.NDArray``): Array of target classes of ``X`` with \[``N samples`` (lines)].
+* ****class**** (Literal[RNSA, BNSA], optional): Current class. Defaults to 'RNSA'.
**Raises**
+
* ``TypeError``: If X or y are not ndarrays or have incompatible shapes.
-* ``ValueError``: If _class_ is BNSA and X contains values that are not composed only of 0 and 1.
+* ``ValueError``: If *class* is BNSA and X contains values that are not composed only of 0 and 1.
---
-### Function _check_and_raise_exceptions_predict(...):
+### Function _check_and_raise_exceptions_predict(...)
+
```python
def _check_and_raise_exceptions_predict(
X: npt.NDArray = None,
@@ -45,14 +50,17 @@ def _check_and_raise_exceptions_predict(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Function responsible for verifying predict function parameters and throwing exceptions if the verification is not successful.
**Parameters**:
-* ***X*** (``npt.NDArray``): Input array for prediction, containing the samples and their characteristics, [``N samples`` (rows)][``N features`` (columns)].
+
+* ***X*** (``npt.NDArray``): Input array for prediction, containing the samples and their characteristics, \[``N samples`` (rows)\]\[``N features`` (columns)].
* ***expected*** (``int``): Expected number of features per sample (columns in X).
-* _class_ (``Literal[RNSA, BNSA], optional``): Current class. Defaults to 'RNSA'.
+* *class* (``Literal[RNSA, BNSA], optional``): Current class. Defaults to 'RNSA'.
**Raises**
+
* ``TypeError``: If X is not an ndarray or list.
* ``FeatureDimensionMismatch``: If the number of features in X does not match the expected number.
-* ``ValueError``: If _class_ is BNSA and X contains values that are not composed only of 0 and 1.
\ No newline at end of file
+* ``ValueError``: If *class* is BNSA and X contains values that are not composed only of 0 and 1.
diff --git a/versioned_docs/version-0.1.x/advanced-guides/Base module/Classifier.md b/versioned_docs/version-0.1.x/advanced-guides/Base module/Classifier.md
index a7d51997..412208ef 100644
--- a/versioned_docs/version-0.1.x/advanced-guides/Base module/Classifier.md
+++ b/versioned_docs/version-0.1.x/advanced-guides/Base module/Classifier.md
@@ -1,20 +1,18 @@
---
sidebar_position: 1
-title: Classification
sidebar_label: BaseClassifier
lastUpdatedAt: 2025/04/04
author: João Paulo
---
-# Base class for classification algorithm.
+# Base class for classification algorithm
-## ``class BaseClassifier(ABC)``:
+## ``class BaseClassifier(ABC)``
Base class for classification algorithms, defining the abstract methods ``fit`` and ``predict``, and implementing the ``get_params`` method.
## Abstract methods
-
### def fit(...)
```python
@@ -25,10 +23,8 @@ Fit the model to the training data.
Implementation:
-- [RNSA](/docs/0.1.x/aisp-techniques/Negative%20Selection/rnsa#Function-fit)
-- [BNSA](/docs/0.1.x/aisp-techniques/Negative%20Selection/bnsa#Function-fit)
-
-
+- [RNSA](../../aisp-techniques/Negative%20Selection/RNSA.md#Function-fit)
+- [BNSA](../../aisp-techniques/Negative%20Selection/BNSA.md#Function-fit)
### def predict(...)
@@ -40,34 +36,34 @@ Performs label prediction for the given data.
Implementation:
-- [RNSA](/docs/0.1.x/aisp-techniques/Negative%20Selection/rnsa#Function-predict)
-- [BNSA](/docs/0.1.x/aisp-techniques/Negative%20Selection/bnsa#Function-predict)
+- [RNSA](../../aisp-techniques/Negative%20Selection/RNSA.md#Function-predict)
+- [BNSA](../../aisp-techniques/Negative%20Selection/BNSA.md#Function-predict)
---
## Methods
-
### def score(...)
```python
def score(self, X: npt.NDArray, y: list) -> float
```
+
Score function calculates forecast accuracy.
-This function performs the prediction of X and checks how many elements are equal between vector y and y_predicted.
+This function performs the prediction of X and checks how many elements are equal between vector y and y_predicted.
This function was added for compatibility with some scikit-learn functions.
**Parameters**:
-+ ***X***: ``np.ndarray``
+
+- ***X***: ``np.ndarray``
Feature set with shape (n_samples, n_features).
-+ ***y***: ``np.ndarray``
+- ***y***: ``np.ndarray``
True values with shape (n_samples,).
**Returns**:
-+ accuracy: ``float`` The accuracy of the model.
-
+- accuracy: ``float`` The accuracy of the model.
### Function _slice_index_list_by_class(...)
@@ -86,11 +82,9 @@ Returns a dictionary with the classes as key and the indices in ``X`` of the sam
```python
def get_params(self, deep: bool = True) -> dict:
```
+
The get_params function Returns a dictionary with the object's main parameters.
This function is required to ensure compatibility with scikit-learn functions.
---
-
-
-
diff --git a/versioned_docs/version-0.1.x/advanced-guides/Core/Negative Selection.md b/versioned_docs/version-0.1.x/advanced-guides/Core/Negative Selection.md
index e5b80d60..a85f9771 100644
--- a/versioned_docs/version-0.1.x/advanced-guides/Core/Negative Selection.md
+++ b/versioned_docs/version-0.1.x/advanced-guides/Core/Negative Selection.md
@@ -8,7 +8,7 @@ last_update:
The functions perform detector checks and utilize Numba decorators for Just-In-Time compilation
-### Function check_detector_bnsa_validity(...):
+## Function check_detector_bnsa_validity(...)
```python
def check_detector_bnsa_validity(
@@ -20,18 +20,19 @@ def check_detector_bnsa_validity(
Checks the validity of a candidate detector (vector_x) against samples from a class (x_class) using the Hamming distance. A detector is considered INVALID if its distance to any sample in ``x_class`` is less than or equal to ``aff_thresh``.
-
**Parameters**:
+
* x_class (``npt.NDArray``): Array containing the class samples. Expected shape: (n_samples, n_features).
* vector_x (``npt.NDArray``): Array representing the detector. Expected shape: (n_features,).
* aff_thresh (``float``): Affinity threshold.
**returns**:
+
* True if the detector is valid, False otherwise.
---
-### Function bnsa_class_prediction(...):
+## Function bnsa_class_prediction(...)
```python
def bnsa_class_prediction(
@@ -40,21 +41,23 @@ def bnsa_class_prediction(
aff_thresh: float
) -> int:
```
-Defines the class of a sample from the non-self detectors.
+Defines the class of a sample from the non-self detectors.
**Parameters**:
+
* features (``npt.NDArray``): binary sample to be classified (shape: [n_features]).
* class_detectors (``npt.NDArray``): Array containing the detectors of all classes
(shape: [n_classes, n_detectors, n_features]).
* aff_thresh (``float``): Affinity threshold that determines whether a detector recognizes the sample as non-self.
**returns**:
+
* int: Index of the predicted class. Returns -1 if it is non-self for all classes.
---
-### Function check_detector_rnsa_validity(...):
+## Function check_detector_rnsa_validity(...)
```python
def check_detector_rnsa_validity(
@@ -65,9 +68,11 @@ def check_detector_rnsa_validity(
p: float
) -> bool:
```
+
Checks the validity of a candidate detector (vector_x) against samples from a class (x_class) using the Hamming distance. A detector is considered INVALID if its distance to any sample in ``x_class`` is less than or equal to ``aff_thresh``.
**Parameters**:
+
* x_class (``npt.NDArray``): Array containing the class samples. Expected shape: (n_samples, n_features).
* vector_x (``npt.NDArray``): Array representing the detector. Expected shape: (n_features,).
* threshold (``float``): threshold.
@@ -75,6 +80,7 @@ Checks the validity of a candidate detector (vector_x) against samples from a cl
* p (``float``): Parameter for the Minkowski distance (used only if `metric` is "minkowski").
**returns**:
+
* int: Index of the predicted class. Returns -1 if it is non-self for all classes.
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.1.x/advanced-guides/Utils/Distance.md b/versioned_docs/version-0.1.x/advanced-guides/Utils/Distance.md
index f3d61352..31981a44 100644
--- a/versioned_docs/version-0.1.x/advanced-guides/Utils/Distance.md
+++ b/versioned_docs/version-0.1.x/advanced-guides/Utils/Distance.md
@@ -15,15 +15,16 @@ def hamming(u: npt.NDArray, v: npt.NDArray) -> np.float64:
```
The function to calculate the normalized Hamming distance between two points.
-
-$((x₁ ≠ x₂) + (y₁ ≠ y₂) + ... + (yn ≠ yn)) / n$
+$$\frac{(x_1 \neq y_1) + (x_2 \neq y_2) + \cdots + (x_n \neq y_n)}{n}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -36,15 +37,15 @@ def euclidean(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64]) -> np.floa
Function to calculate the normalized Euclidean distance between two points.
-$√( (x₁ - x₂)² + (y₁ - y₂)² + ... + (yn - yn)²)$
-
-
+$$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -56,15 +57,16 @@ def cityblock(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64]) -> np.floa
```
Function to calculate the normalized Manhattan distance between two points.
-
-$(|x₁ - x₂| + |y₁ - y₂| + ... + |yn - yn|) / n$
+$$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -76,19 +78,20 @@ def minkowski(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64], p: float =
```
Function to calculate the normalized Minkowski distance between two points.
-
-$(( |X₁ - Y₁|p + |X₂ - Y₂|p + ... + |Xn - Yn|p) ¹/ₚ) / n$
+$$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
* p float: The p parameter defines the type of distance to be calculated:
- - p = 1: **Manhattan** distance — sum of absolute differences.
- - p = 2: **Euclidean** distance — sum of squared differences (square root).
- - p > 2: **Minkowski** distance with an increasing penalty as p increases.
+ * p = 1: **Manhattan** distance — sum of absolute differences.
+ * p = 2: **Euclidean** distance — sum of squared differences (square root).
+ * p > 2: **Minkowski** distance with an increasing penalty as p increases.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -107,12 +110,14 @@ def compute_metric_distance(
Function to calculate the distance between two points by the chosen ``metric``.
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
* metric (``int``): Distance metric to be used. Available options: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)]
* p (``float``): Parameter for the Minkowski distance (used only if `metric` is "minkowski").
**Returns:**
+
* Distance (``double``) between the two points with the selected metric.
---
@@ -130,14 +135,15 @@ def min_distance_to_class_vectors(
Calculates the minimum distance between an input vector and the vectors of a class.
-
**Parameters:**
+
* x_class (``npt.NDArray``): Array containing the class vectors to be compared with the input vector. Expected shape: (n_samples, n_features).
* vector_x (``npt.NDArray``): Vector to be compared with the class vectors. Expected shape: (n_features,).
* metric (``int``): Distance metric to be used. Available options: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)]
* p (``float``): Parameter for the Minkowski distance (used only if `metric` is "minkowski").
**Returns:**
+
* float: The minimum distance calculated between the input vector and the class vectors.
* Returns -1.0 if the input dimensions are incompatible.
@@ -148,16 +154,19 @@ Calculates the minimum distance between an input vector and the vectors of a cla
```python
def get_metric_code(metric: str) -> int:
```
+
Returns the numeric code associated with a distance metric.
**Parameters:**
+
* metric (str): Name of the metric. Can be "euclidean", "manhattan", "minkowski" or "hamming".
**Raises**
-----------
+
* ``ValueError``: If the metric provided is not supported
**Returns:**
+
* ``int``: Numeric code corresponding to the metric.
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.1.x/advanced-guides/Utils/Metrics.md b/versioned_docs/version-0.1.x/advanced-guides/Utils/Metrics.md
index c92962b2..29f22166 100644
--- a/versioned_docs/version-0.1.x/advanced-guides/Utils/Metrics.md
+++ b/versioned_docs/version-0.1.x/advanced-guides/Utils/Metrics.md
@@ -8,7 +8,7 @@ author: João Paulo
The metrics file provides utilities to measure, analyze, and compare the performance of the package's algorithms in a standardized way.
-#### def accuracy_score(...)
+## def accuracy_score(...)
```python
def accuracy_score(
@@ -21,16 +21,19 @@ Function to calculate precision accuracy based on lists of true labels and
predicted labels.
**Parameters**:
+
* **_y_true_** (``Union[npt.NDArray, list]``): Ground truth (correct) labels.
Expected to be of the same length as `y_pred`.
* **_y_pred_** (``Union[npt.NDArray, list]``): Predicted labels. Expected to
be of the same length as `y_true`.
Returns:
+
* **_Accuracy_** (``float``): The ratio of correct predictions to the total
number of predictions.
**Raises**:
+
* `ValueError`: If `y_true` or `y_pred` are empty or if they do not have the same length.
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.1.x/advanced-guides/Utils/Multiclass.md b/versioned_docs/version-0.1.x/advanced-guides/Utils/Multiclass.md
index 772e2373..a65fe8d4 100644
--- a/versioned_docs/version-0.1.x/advanced-guides/Utils/Multiclass.md
+++ b/versioned_docs/version-0.1.x/advanced-guides/Utils/Multiclass.md
@@ -8,7 +8,7 @@ author: João Paulo
This file contains internal utility functions designed to simplify data manipulation and processing in multiclass classification scenarios within the AISP package.
-### def slice_index_list_by_class(...)
+## def slice_index_list_by_class(...)
```python
def slice_index_list_by_class(classes: Union[npt.NDArray, list], y: npt.NDArray) -> dict
@@ -19,8 +19,10 @@ according to the output class, to loop through the sample array, only in positio
the output is the class being trained.
**Parameters**:
+
* ***classes*** (``list or npt.NDArray``): list with unique classes.
* ***y*** (npt.NDArray): Receives a ``y``[``N sample``] array with the output classes of the ``X`` sample array.
**returns**:
+
* dict: A dictionary with the list of array positions(``y``), with the classes as key.
diff --git a/versioned_docs/version-0.1.x/advanced-guides/Utils/Sanitizers.md b/versioned_docs/version-0.1.x/advanced-guides/Utils/Sanitizers.md
index 85c3ad8f..34c0132d 100644
--- a/versioned_docs/version-0.1.x/advanced-guides/Utils/Sanitizers.md
+++ b/versioned_docs/version-0.1.x/advanced-guides/Utils/Sanitizers.md
@@ -14,14 +14,14 @@ def sanitize_choice(value: T, valid_choices: Iterable[T], default: T) -> T
The function ``sanitize_choice(...)``, returns the value if it is present in the set of valid choices; otherwise, returns the default value.
-
**Parameters:**
+
* ***value*** (``T``): The value to be checked.
* ***valid_choices*** (``Iterable[T]``): A collection of valid choices.
* ***default***: The default value to be returned if ``value`` is not in ``valid_choices``.
-
**Returns:**
+
* `T`: The original value if valid, or the default value if not.
---
@@ -35,12 +35,13 @@ def sanitize_param(value: T, default: T, condition: Callable[[T], bool]) -> T:
The function ``sanitize_param(...)``, returns the value if it satisfies the specified condition; otherwise, returns the default value.
**Parameters:**
+
* value (``T``): The value to be checked.
* default (``T``): The default value to be returned if the condition is not satisfied.
* condition (``Callable[[T], bool]``): A function that takes a value and returns a boolean, determining if the value is valid.
-
**Returns:**
+
* `T`: The original value if the condition is satisfied, or the default value if not.
---
@@ -54,7 +55,9 @@ def sanitize_seed(seed: Any) -> Optional[int]:
The function ``sanitize_param(...)``, returns the seed if it is a non-negative integer; otherwise, returns None.
**Parameters:**
+
* seed (``Any``): The seed value to be validated.
**Returns:**
-* ``Optional[int]``: The original seed if it is a non-negative integer, or ``None`` if it is invalid.
\ No newline at end of file
+
+* ``Optional[int]``: The original seed if it is a non-negative integer, or ``None`` if it is invalid.
diff --git a/versioned_docs/version-0.1.x/aisp-techniques/Negative Selection/BNSA.md b/versioned_docs/version-0.1.x/aisp-techniques/Negative Selection/BNSA.md
index 6a2ca342..3a4e0e0b 100644
--- a/versioned_docs/version-0.1.x/aisp-techniques/Negative Selection/BNSA.md
+++ b/versioned_docs/version-0.1.x/aisp-techniques/Negative Selection/BNSA.md
@@ -1,6 +1,5 @@
---
id: bnsa
-title: BNSA
sidebar_label: BNSA - Binary Negative Selection Algorithm
sidebar_position: 2
pagination_next: null
@@ -24,7 +23,7 @@ last_update:
# BNSA (Binary Negative Selection Algorithm)
-## Constructor RNSA:
+## Constructor RNSA
The ``BNSA`` (Binary Negative Selection Algorithm) class has the purpose of classifying and identifying anomalies through the self and not self methods.
@@ -45,6 +44,7 @@ class BNSA(
* *N* (``int``): Number of detectors. Defaults to ``100``.
* *aff_thresh* (``float``): The variable ('affinity threshold') represents the percentage of dissimilarity between the T cell and the own samples. The default value is 10% (0.1), while a value of 1.0 represents 100% dissimilarity.
+
:::note
Setting the difference percentage too high can result in the inability to generate detectors for non-self.
:::
@@ -53,8 +53,8 @@ Setting the difference percentage too high can result in the inability to genera
possible infinite loop if a radius is defined that it is not possible to generate non-self detectors. Defaults to ``1000``.
* *seed* (``int``): Seed for the random generation of values in the detectors. Defaults to ``None``.
* no_label_sample_selection (``str``): Method for selecting labels for samples designated as non-members by all non-member detectors. **Available method types:**
- - (``max_average_difference``): Selects the class with the highest average difference among the detectors.
- - (``max_nearest_difference``): Selects the class with the highest difference between the nearest and farthest detector from the sample.
+ * (``max_average_difference``): Selects the class with the highest average difference among the detectors.
+ * (``max_nearest_difference``): Selects the class with the highest difference between the nearest and farthest detector from the sample.
**Other variables initiated:**
@@ -62,10 +62,8 @@ possible infinite loop if a radius is defined that it is not possible to generat
* *classes* (``npt.NDArray``): list of output classes.
-
---
-
### Function fit(...)
The ``fit(...)`` function generates the detectors for non-fits with respect to the samples:
@@ -76,8 +74,9 @@ def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
In it, training is performed according to ``X`` and ``y``, using the negative selection method(``NegativeSelect``).
-**The input parameters are:**
-* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
+**The input parameters are:**
+
+* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
* ``y``: array with the output classes arranged in **N** samples that are related to ``X``.
@@ -95,10 +94,12 @@ The ``predict(...)`` function performs class prediction using the generated dete
def predict(self, X: npt.NDArray) -> npt.NDArray:
```
-**The input parameter is:**
+**The input parameter is:**
+
* ``X``: array with the characteristics for the prediction, with **N** samples (Rows) and **N** columns.
-**Returns:**
+**Returns:**
+
* ``C``: prediction array, with the output classes for the given characteristics.
* ``None``: if there are no detectors.
@@ -128,8 +129,9 @@ The function ``__assign_class_to_non_self_sample(...)``, determines the class of
def __assign_class_to_non_self_sample(self, line: npt.NDArray, c: list):
```
-**The input parameter is:**
+**The input parameter is:**
+
* ***line*** (``npt.NDArray``): Sample to be classified.
* ***c*** (``list``): List of predictions to be updated with the new classification.
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.1.x/aisp-techniques/Negative Selection/README.md b/versioned_docs/version-0.1.x/aisp-techniques/Negative Selection/README.md
index 996fd4e3..80613c26 100644
--- a/versioned_docs/version-0.1.x/aisp-techniques/Negative Selection/README.md
+++ b/versioned_docs/version-0.1.x/aisp-techniques/Negative Selection/README.md
@@ -8,27 +8,33 @@ sidebar_position: 1
# classes
> 1. **[Binary version:](BNSA.md)**
+>
>> The binary algorithm adapted for multiple classes in this project is based on the version proposed by [Forrest et al. (1994)](#2), originally developed for computer security.
>>> **Example:**
->>> + [Mushrooms Database](https://github.com/AIS-Package/aisp/blob/main/examples/BNSA/mushrooms_dataBase_example_en.ipynb)
+>>>
+>>> + [Mushrooms Database](https://github.com/AIS-Package/aisp/blob/main/examples/BNSA/mushrooms_dataBase_example_en.ipynb)
> 2. **[Real-Valued version:](RNSA.md)**
+>
>>This algorithm has two different versions: one based on the canonical version [[1]](#1) and another with variable radius detectors [[3]](#3). Both are adapted to work with multiple classes and have methods for predicting data present in the non-self region of all detectors and classes.
>>> **Examples:**
->>> + [Iris Database](https://github.com/AIS-Package/aisp/blob/main/examples/RNSA/iris_dataBase_example_en.ipynb)
->>> + [Geyser Database](https://github.com/AIS-Package/aisp/blob/main/examples/RNSA/geyser_dataBase_example_en.ipynb)
+>>>
+>>> + [Iris Database](https://github.com/AIS-Package/aisp/blob/main/examples/RNSA/iris_dataBase_example_en.ipynb)
+>>> + [Geyser Database](https://github.com/AIS-Package/aisp/blob/main/examples/RNSA/geyser_dataBase_example_en.ipynb)
-# References
+## References
----
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
+### 1
+>
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
-##### 2
-> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: http://dx.doi.org/10.1109/RISP.1994.296580.
+### 2
+>
+> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: [https://dx.doi.org/10.1109/RISP.1994.296580](https://dx.doi.org/10.1109/RISP.1994.296580).
-##### 3
-> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: http://dx.doi.org/10.1007/978-3-540-24854-5_30.
+### 3
+>
+> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: [https://dx.doi.org/10.1007/978-3-540-24854-5_30](https://dx.doi.org/10.1007/978-3-540-24854-5_30).
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.1.x/aisp-techniques/Negative Selection/RNSA.md b/versioned_docs/version-0.1.x/aisp-techniques/Negative Selection/RNSA.md
index 37444177..40ae6d46 100644
--- a/versioned_docs/version-0.1.x/aisp-techniques/Negative Selection/RNSA.md
+++ b/versioned_docs/version-0.1.x/aisp-techniques/Negative Selection/RNSA.md
@@ -1,6 +1,5 @@
---
id: rnsa
-title: RNSA
sidebar_label: RNSA - Real-Valued Negative Selection Algorithm
sidebar_position: 1
keywords:
@@ -21,7 +20,7 @@ last_update:
# RNSA (Real-Valued Negative Selection Algorithm)
-## Constructor RNSA:
+## Constructor RNSA
The ``RNSA`` (Real-Valued Negative Selection Algorithm) class has the purpose of classifying and identifying anomalies through the self and not self methods.
@@ -44,6 +43,7 @@ class RNSA(
* *N* (``int``): Number of detectors. Defaults to ``100``.
* *r* (``float``): Radius of the detector. Defaults to ``0.05``.
+
:::note
it is important to consider that setting a very low radius for the detector can significantly reduce the detection rate. On the other hand, a very large radius can make it impossible to incorporate the detector into the search space, which can also compromise detection performance. It is essential to find a balance between the radius size and detection efficiency to achieve the best possible results.
:::
@@ -51,32 +51,31 @@ it is important to consider that setting a very low radius for the detector can
* *k* (``int``): Number of neighbors near the randomly generated detectors to perform the distance average calculation. Defaults to ``1``.
* *metric* (``str``): Way to calculate the distance between the detector and the sample:
- * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression: $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + ... + (Y_{n} - Y_{n})^2}$$.
+ * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression: $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$.
- * ``'minkowski'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + ... |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - X_{1}| + |Y_{2} - Y_{2}| + ... + |Y_{n} - Y_{n}|)$$.
+ * ``'minkowski'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
+ * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$.
Defaults to ``'euclidean'``.
-
* *max_discards* (``int``): This parameter indicates the maximum number of consecutive detector discards, aimed at preventing a possible infinite loop in case a radius is defined that cannot generate non-self detectors. Defaults to ``1000``.
* *seed* (``int``): Seed for the random generation of values in the detectors. Defaults to ``None``.
* *algorithm* (``str``), Set the algorithm version:
- * ``'default-NSA'``: Default algorithm with fixed radius.
- * ``'V-detector'``: This algorithm is based on the article "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", by Ji, Z., Dasgupta, D. (2004), and uses a variable radius for anomaly detection in feature spaces.
+ * ``'default-NSA'``: Default algorithm with fixed radius.
+ * ``'V-detector'``: This algorithm is based on the article "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", by Ji, Z., Dasgupta, D. (2004), and uses a variable radius for anomaly detection in feature spaces.
Defaults to ``'default-NSA'``.
* *r_s* (``float``): rₛ Radius of the ``X`` own samples.
+
- ``**kwargs``:
- - *non_self_label* (``str``): This variable stores the label that will be assigned when the data has only one
+ * *non_self_label* (``str``): This variable stores the label that will be assigned when the data has only one
output class, and the sample is classified as not belonging to that class. Defaults to ``'non-self'``.
- - *cell_bounds* (``bool``): If set to ``True``, this option limits the generation of detectors to the space within the plane between 0 and 1. This means that any detector whose radius exceeds this limit is discarded, this variable is only used in the ``V-detector`` algorithm.
- - p (``float``): This parameter stores the value of ``p`` used in the Minkowski distance. The default is ``2``, which represents normalized Euclidean distance. Different values of p lead to different variants of the Minkowski
+ * *cell_bounds* (``bool``): If set to ``True``, this option limits the generation of detectors to the space within the plane between 0 and 1. This means that any detector whose radius exceeds this limit is discarded, this variable is only used in the ``V-detector`` algorithm.
+ * p (``float``): This parameter stores the value of ``p`` used in the Minkowski distance. The default is ``2``, which represents normalized Euclidean distance. Different values of p lead to different variants of the Minkowski
distance [learn more](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
-
**Other variables initiated:**
@@ -96,8 +95,9 @@ def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
In it, training is performed according to ``X`` and ``y``, using the negative selection method(``NegativeSelect``).
-The input parameters are:
-* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
+The input parameters are:
+
+* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
* ``y``: array with the output classes arranged in **N** samples that are related to ``X``.
@@ -115,10 +115,12 @@ The ``predict(...)`` function performs class prediction using the generated dete
def predict(self, X: npt.NDArray) -> npt.NDArray:
```
-**The input parameter is:**
+**The input parameter is:**
+
* ``X``: array with the characteristics for the prediction, with **N** samples (Rows) and **N** columns.
-**Returns:**
+**Returns:**
+
* ``C``: prediction array, with the output classes for the given characteristics.
* ``None``: if there are no detectors.
@@ -149,12 +151,13 @@ def __checks_valid_detector(self, X: npt.NDArray, vector_x: npt.NDArray, samples
```
**The input parameters are:**
+
* ``X``: array with sample characteristics with **N** samples (rows) and **N** characteristics (columns), normalized to values between [0, 1].
* ``vector_x``: Randomly generated candidate detector.
* ``samplesIndexClass``: Array with the indexes of a class.
-
+
**Returns:** ``True`` for detectors that do not have samples inside or ``False`` if they do.
---
@@ -179,9 +182,11 @@ In this function, when there is class ambiguity, it returns the class that has t
```python
def __compare_sample_to_detectors(self, line):
```
+
**The input parameters are:**
+
* line: vector with N-features
-
+
**Returns:** The predicted class with the detectors or None if the sample does not qualify for any class.
---
@@ -193,13 +198,14 @@ Check if the distance between the detector and the samples, minus the radius of
```python
def __detector_is_valid_to_Vdetector(self, distance, vector_x):
```
-
+
**The input parameters are:**
* distance (``float``): minimum distance calculated between all samples.
* vector_x (``numpy.ndarray``): randomly generated candidate detector vector x with values between 0 and 1.
-**Returns:**
+**Returns:**
+
* ``False``: if the calculated radius is smaller than the minimum distance or exceeds the edge of the space, if this option is enabled.
* ``True`` and the distance minus the radius of the samples, if the radius is valid.`
@@ -218,4 +224,3 @@ The input parameters are ``u`` and ``v`` NDArrays, with the coordinates for the
**Returns:** the distance (``double``) between the two points.
---
-
diff --git a/versioned_docs/version-0.1.x/aisp-techniques/README.md b/versioned_docs/version-0.1.x/aisp-techniques/README.md
index 99acc4c6..c8ee79eb 100644
--- a/versioned_docs/version-0.1.x/aisp-techniques/README.md
+++ b/versioned_docs/version-0.1.x/aisp-techniques/README.md
@@ -10,11 +10,11 @@ Classes implemented using the metaphors of artificial immune systems.
---
-### Class module:
+### Class module
> 1. [**Negative selection**](./Negative%20Selection/)
> 2. **Clonal Selection Algorithms**
> 3. **Dendritric Cell**
> 4. **Immune Network Theory**
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.1.x/intro.md b/versioned_docs/version-0.1.x/intro.md
index 6c9ba042..3ed74099 100644
--- a/versioned_docs/version-0.1.x/intro.md
+++ b/versioned_docs/version-0.1.x/intro.md
@@ -20,11 +20,11 @@ keywords:
- Bioinspiration
- Immune Metaphors
---
-# Artificial Immune Systems Package.
+# Artificial Immune Systems Package
-
+
@@ -34,9 +34,9 @@ keywords:
**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).
-### Algorithms implemented:
+### Algorithms implemented
-> - [x] [**Negative Selection.**](/docs/0.1.x/aisp-techniques/Negative%20Selection/)
+> - [x] [**Negative Selection.**](./aisp-techniques/Negative%20Selection/)
> - [ ] *Clonal Selection Algorithms.*
> - [ ] *Dendritic Cells.*
> - [ ] *Immune Network Theory.*
diff --git a/versioned_docs/version-0.2.x/About us.mdx b/versioned_docs/version-0.2.x/About us.mdx
index d7cf4168..9e690c17 100644
--- a/versioned_docs/version-0.2.x/About us.mdx
+++ b/versioned_docs/version-0.2.x/About us.mdx
@@ -29,7 +29,7 @@ The AISP, or Artificial Immune Systems Package, had its origins in a research pr
name='Alison Zille Lopes'
date='2022'
githubUrl='https://github.com/alisonzille'
- lattesUrl='http://lattes.cnpq.br/3294097090760981'
+ lattesUrl='https://lattes.cnpq.br/3294097090760981'
/>
@@ -45,7 +45,7 @@ The AISP, or Artificial Immune Systems Package, had its origins in a research pr
date='2022-2023'
description="I was tasked with implementing version 0.1, which features the BNSA and RNSA negative selection classes, including fixed and variable radius versions."
githubUrl='https://github.com/Joao-Paulo-Silva'
- lattesUrl='http://lattes.cnpq.br/2561057724411407'
+ lattesUrl='https://lattes.cnpq.br/2561057724411407'
/>
\ No newline at end of file
diff --git a/versioned_docs/version-0.2.x/Examples/Classification/csa.md b/versioned_docs/version-0.2.x/Examples/Classification/csa.md
index 138193d6..aba99717 100644
--- a/versioned_docs/version-0.2.x/Examples/Classification/csa.md
+++ b/versioned_docs/version-0.2.x/Examples/Classification/csa.md
@@ -27,30 +27,34 @@ keywords:
- immune recognition
---
-# Clonal Selection Algorithm
-
This page presents a collection of practical examples showcasing how to use the Clonal Selection Algorithm.
## AIRS (Artificial Immune Recognition System)
-
Run notebooks online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclassification%2FAIRS)
---
### Binary Algorithm
-+ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/example_with_randomly_generated_dataset-en.ipynb)
++ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/example_with_randomly_generated_dataset-en.ipynb)
+
> In the example present in this notebook 1000 random samples were generated, arranged in two groups, one for each class.
+ [mushrooms_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/mushrooms_dataBase_example_en.ipynb)
-> It uses the [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), which contains information about edible and poisonous mushrooms.
+
+> It uses the [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), which contains information about edible and poisonous mushrooms.
### Real-Valued Algorithm
-+ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/example_with_randomly_generated_dataset-en.ipynb)
++ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/example_with_randomly_generated_dataset-en.ipynb)
+
> In the example present in this notebook 500 random samples were generated, arranged in two groups, one for each class, we can see the non-self detectors generated below
+
+ [iris_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/iris_dataBase_example_en.ipynb)
+
> Example using the NSA [iris database](https://archive.ics.uci.edu/ml/datasets/iris), which contains four-dimensional samples and three output classes (Setosa, Versicolor and Virginica).
+
+ [geyser_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/geyser_dataBase_example_en.ipynb)
-> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
\ No newline at end of file
+
+> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/versioned_docs/version-0.2.x/Examples/Classification/nsa.md b/versioned_docs/version-0.2.x/Examples/Classification/nsa.md
index 5b3ec4dc..6edef48f 100644
--- a/versioned_docs/version-0.2.x/Examples/Classification/nsa.md
+++ b/versioned_docs/version-0.2.x/Examples/Classification/nsa.md
@@ -33,21 +33,28 @@ Run notebooks online via Binder: [
---
-+ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/example_with_randomly_generated_dataset-en.ipynb)
++ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/example_with_randomly_generated_dataset-en.ipynb)
+
> In the example present in this notebook 1000 random samples were generated, arranged in two groups, one for each class.
+ [mushrooms_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/mushrooms_dataBase_example_en.ipynb)
-> It uses the [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), which contains information about edible and poisonous mushrooms.
-# RNSA (Real-Valued Negative Selection Algorithm)
+> It uses the [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), which contains information about edible and poisonous mushrooms.
+
+## RNSA (Real-Valued Negative Selection Algorithm)
Run notebooks online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclassification%2FRNSA)
---
-+ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/example_with_randomly_generated_dataset-en.ipynb)
++ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/example_with_randomly_generated_dataset-en.ipynb)
+
> In the example present in this notebook 500 random samples were generated, arranged in two groups, one for each class, we can see the non-self detectors generated below
+
+ [iris_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/iris_dataBase_example_en.ipynb)
+
> Example using the NSA [iris database](https://archive.ics.uci.edu/ml/datasets/iris), which contains four-dimensional samples and three output classes (Setosa, Versicolor and Virginica).
+
+ [geyser_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/geyser_dataBase_example_en.ipynb)
-> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
\ No newline at end of file
+
+> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/versioned_docs/version-0.2.x/Getting Started/basic use/AIRS.md b/versioned_docs/version-0.2.x/Getting Started/basic use/AIRS.md
index 7662e30d..56905f5f 100644
--- a/versioned_docs/version-0.2.x/Getting Started/basic use/AIRS.md
+++ b/versioned_docs/version-0.2.x/Getting Started/basic use/AIRS.md
@@ -28,16 +28,15 @@ keywords:
- immune recognition
---
-# Using the AIRS
-
Access the Jupyter notebook with the code available [here](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/example_with_randomly_generated_dataset-en.ipynb)!
-### Importing the Artificial Immune Recognition System
+## Importing the Artificial Immune Recognition System
+
```python
from aisp.csa import AIRS
```
-### Generating dice bubbles for classes randomly.
+## Generating dice bubbles for classes randomly
Using the `make_blobs` function, two sets of data are generated in the form of bubbles, in the range between 0 and 1, representing each class x and y. Then this data is separated into test and training sets.
@@ -53,7 +52,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-### Testing the model AIRS:
+## Testing the model AIRS
Then, it presents the result of the forecast accuracy.
@@ -72,6 +71,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```bash
✔ Set of memory cells for classes (0, 1) successfully generated: ┇██████████┇ 400/400 memory cells for each aᵢ
The accuracy is 1.0
@@ -87,6 +87,6 @@ weighted avg 1.00 1.00 1.00 100
---
-### Memory cell and sample plotting:
+## Memory cell and sample plotting
-
\ No newline at end of file
+
diff --git a/versioned_docs/version-0.2.x/Getting Started/basic use/BNSA.md b/versioned_docs/version-0.2.x/Getting Started/basic use/BNSA.md
index 71b20158..53d3574f 100644
--- a/versioned_docs/version-0.2.x/Getting Started/basic use/BNSA.md
+++ b/versioned_docs/version-0.2.x/Getting Started/basic use/BNSA.md
@@ -22,7 +22,6 @@ keywords:
- Computação Natural
---
-# Applying the BNSA
The present example, available here, aims to demonstrate the application of the binary negative selection algorithm. This algorithm is used to classify samples with discrete characteristics.
Access the Jupyter notebook with the code available [here](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/BNSA/example_with_randomly_generated_dataset-en.ipynb)!
@@ -32,6 +31,7 @@ Access the Jupyter notebook with the code available [here](https://github.com/AI
```python
from aisp.nsa import BNSA
```
+
## Generating samples
Algorithm training and testing needs data samples. Thus, for the demonstration, two random classes were generated, using the following function:
@@ -103,6 +103,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```
✔ Non-self detectors for classes (x, y) successfully generated: ┇██████████┇ 500/500 detectors
The accuracy is 0.93
@@ -131,4 +132,4 @@ plt.ylabel('Estimated')
plt.show()
```
-
\ No newline at end of file
+
diff --git a/versioned_docs/version-0.2.x/Getting Started/basic use/RNSA.md b/versioned_docs/version-0.2.x/Getting Started/basic use/RNSA.md
index c4c942b1..7fad77d5 100644
--- a/versioned_docs/version-0.2.x/Getting Started/basic use/RNSA.md
+++ b/versioned_docs/version-0.2.x/Getting Started/basic use/RNSA.md
@@ -22,16 +22,15 @@ keywords:
- Computação Natural
---
-# Using the RNSA
-
Access the Jupyter notebook with the code available [here](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/example_with_randomly_generated_dataset-en.ipynb)!
-### Importing the Real-Valued Negative Selection Algorithm.
+## Importing the Real-Valued Negative Selection Algorithm
+
```python
from aisp.nsa import RNSA
```
-### Generating dice bubbles for classes randomly.
+## Generating dice bubbles for classes randomly
Using the `make_blobs` function, two sets of data are generated in the form of bubbles, in the range between 0 and 1, representing each class x and y. Then this data is separated into test and training sets.
@@ -47,7 +46,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-### Testing the model `default-NSA`:
+## Testing the model `default-NSA`
Start the model with 500 detectors, each with a radius of 0.06. Then, it presents the result of the forecast accuracy.
@@ -66,6 +65,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```bash
✔ Non-self detectors for classes (0, 1) successfully generated: ┇██████████┇ 1000/1000 detectors
The accuracy is 1.0
@@ -81,13 +81,13 @@ weighted avg 1.00 1.00 1.00 100
---
-### Detector and sample plotting:
+## Detector and sample plotting
-
+
---
-### Testing the model `V-detector`:
+## Testing the model `V-detector`
Start the model with 50 detectors, where the minimum radius is 0.05 and the sample's own radius is 0.04. It then shows the forecast accuracy result.
@@ -106,6 +106,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```bash
✔ Non-self detectors for classes (0, 1) successfully generated: ┇██████████┇ 40/40 detectors
The accuracy is 1.0
@@ -121,5 +122,6 @@ weighted avg 1.00 1.00 1.00 100
---
-### Detector and sample plotting:
-
\ No newline at end of file
+## Detector and sample plotting
+
+
diff --git a/versioned_docs/version-0.2.x/Getting Started/instalation.md b/versioned_docs/version-0.2.x/Getting Started/instalation.md
index 185fdc7d..bbe5c9cd 100644
--- a/versioned_docs/version-0.2.x/Getting Started/instalation.md
+++ b/versioned_docs/version-0.2.x/Getting Started/instalation.md
@@ -1,7 +1,7 @@
---
sidebar_position: 1
-title: Instalation
-sidebar_label: Instalation
+title: Installation
+sidebar_label: Installation
lastUpdatedAt: 2025/05/17
author: João Paulo
showLastUpdateAuthor: true
@@ -11,8 +11,6 @@ last_update:
author: João Paulo
---
-# **Installation**
-
This page contains information about dependencies, how to install and how to import modules.
## **Dependencies:**
@@ -30,7 +28,7 @@ The package requires [python 3.10](https://www.python.org/downloads/) or higher.
-## **Instalation procedure**
+## **Installation procedure**
The simplest way to install is via ``pip``:
@@ -45,4 +43,3 @@ from aisp.nsa import RNSA, BNSA
nsa = RNSA(N=300, r=0.05)
```
-
diff --git a/versioned_docs/version-0.2.x/advanced-guides/Base Classes Reference/csa/airs.md b/versioned_docs/version-0.2.x/advanced-guides/Base Classes Reference/csa/airs.md
index eab188d1..17286fbf 100644
--- a/versioned_docs/version-0.2.x/advanced-guides/Base Classes Reference/csa/airs.md
+++ b/versioned_docs/version-0.2.x/advanced-guides/Base Classes Reference/csa/airs.md
@@ -15,7 +15,7 @@ therefore are considered essential for the overall functioning of the system.
---
-### def _check_and_raise_exceptions_fit(...):
+## def _check_and_raise_exceptions_fit(...)
Verify the fit parameters and throw exceptions if the verification is not successful.
@@ -30,22 +30,23 @@ def _check_and_raise_exceptions_fit(
):
```
-
**Parameters**:
-* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, [``N samples`` (rows)][``N features`` (columns)].
-* ***y*** (``npt.NDArray``): Array of target classes of ``X`` with [``N samples`` (lines)].
-* ***algorithm*** (``Literal["continuous-features", "binary-features"], optional``): Specifies the type of algorithm to use, depending
+
+* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, \[``N samples`` (rows)\]\[``N features`` (columns)].
+* ***y*** (``npt.NDArray``): Array of target classes of ``X`` with \[``N samples`` (lines)].
+* ***algorithm*** (``Literal["continuous-features", "binary-features"], optional``): Specifies the type of algorithm to use, depending
on whether the input data has continuous or binary features.
**Raises**
+
* `TypeError`:
If X or y are not ndarrays or have incompatible shapes.
* `ValueError`
- If _class_ is BNSA and X contains values that are not composed only of 0 and 1.
+ If *class* is BNSA and X contains values that are not composed only of 0 and 1.
---
-### def _check_and_raise_exceptions_fit(...):
+## def _check_and_raise_exceptions_predict(...)
Verify the fit parameters and throw exceptions if the verification is not successful.
@@ -60,18 +61,20 @@ def _check_and_raise_exceptions_predict(
) -> None:
```
-
**Parameters**:
-* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, [``N samples`` rows)][``N features`` (columns)].
+
+* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, \[``N samples`` (rows)\]\[``N features`` (columns)].
* ***expected*** (``int``): Expected number of features per sample (columns in X).
-* ***algorithm*** (``Literal["continuous-features", "binary-features"], optional``): Specifies the type of algorithm to use, depending
+* ***algorithm*** (``Literal["continuous-features", "binary-features"], optional``): Specifies the type of algorithm to use, depending
on whether the input data has continuous or binary features.
**Raises**
+
* ``TypeError``
If X is not a ndarray or list.
* `FeatureDimensionMismatch`
If the number of features in X does not match the expected number.
* `ValueError`
If algorithm is binary-features and X contains values that are not composed only of 0 and 1.
----
\ No newline at end of file
+
+---
diff --git a/versioned_docs/version-0.2.x/advanced-guides/Base Classes Reference/nsa.md b/versioned_docs/version-0.2.x/advanced-guides/Base Classes Reference/nsa.md
index 544d26a6..307eeb4f 100644
--- a/versioned_docs/version-0.2.x/advanced-guides/Base Classes Reference/nsa.md
+++ b/versioned_docs/version-0.2.x/advanced-guides/Base Classes Reference/nsa.md
@@ -12,11 +12,12 @@ The ``BaseNSA`` class contains utility functions with the ``protected`` modifier
---
-## Protected Functions:
+## Protected Functions
---
-### Function _check_and_raise_exceptions_fit(...):
+### Function _check_and_raise_exceptions_fit(...)
+
```python
def _check_and_raise_exceptions_fit(
X: npt.NDArray = None,
@@ -24,20 +25,24 @@ def _check_and_raise_exceptions_fit(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Function responsible for verifying fit function parameters and throwing exceptions if the verification is not successful.
**Parameters**:
-* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, [``N samples`` (rows)][``N features`` (columns)].
-* ***y*** (``npt.NDArray``): Array of target classes of ``X`` with [``N samples`` (lines)].
-* ***_class_*** (Literal[RNSA, BNSA], optional): Current class. Defaults to 'RNSA'.
+
+* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, \[``N samples`` (rows)\]\[``N features`` (columns)].
+* ***y*** (``npt.NDArray``): Array of target classes of ``X`` with \[``N samples`` (lines)].
+* ****class**** (Literal[RNSA, BNSA], optional): Current class. Defaults to 'RNSA'.
**Raises**
+
* ``TypeError``: If X or y are not ndarrays or have incompatible shapes.
-* ``ValueError``: If _class_ is BNSA and X contains values that are not composed only of 0 and 1.
+* ``ValueError``: If *class* is BNSA and X contains values that are not composed only of 0 and 1.
---
-### Function _check_and_raise_exceptions_predict(...):
+### Function _check_and_raise_exceptions_predict(...)
+
```python
def _check_and_raise_exceptions_predict(
X: npt.NDArray = None,
@@ -45,14 +50,17 @@ def _check_and_raise_exceptions_predict(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Function responsible for verifying predict function parameters and throwing exceptions if the verification is not successful.
**Parameters**:
-* ***X*** (``npt.NDArray``): Input array for prediction, containing the samples and their characteristics, [``N samples`` (rows)][``N features`` (columns)].
+
+* ***X*** (``npt.NDArray``): Input array for prediction, containing the samples and their characteristics, \[``N samples`` (rows)\]\[``N features`` (columns)].
* ***expected*** (``int``): Expected number of features per sample (columns in X).
-* _class_ (``Literal[RNSA, BNSA], optional``): Current class. Defaults to 'RNSA'.
+* *class* (``Literal[RNSA, BNSA], optional``): Current class. Defaults to 'RNSA'.
**Raises**
+
* ``TypeError``: If X is not an ndarray or list.
* ``FeatureDimensionMismatch``: If the number of features in X does not match the expected number.
-* ``ValueError``: If _class_ is BNSA and X contains values that are not composed only of 0 and 1.
\ No newline at end of file
+* ``ValueError``: If *class* is BNSA and X contains values that are not composed only of 0 and 1.
diff --git a/versioned_docs/version-0.2.x/advanced-guides/Base module/Classifier.md b/versioned_docs/version-0.2.x/advanced-guides/Base module/Classifier.md
index 49e030ab..412208ef 100644
--- a/versioned_docs/version-0.2.x/advanced-guides/Base module/Classifier.md
+++ b/versioned_docs/version-0.2.x/advanced-guides/Base module/Classifier.md
@@ -1,20 +1,18 @@
---
sidebar_position: 1
-title: Classification
sidebar_label: BaseClassifier
lastUpdatedAt: 2025/04/04
author: João Paulo
---
-# Base class for classification algorithm.
+# Base class for classification algorithm
-## ``class BaseClassifier(ABC)``:
+## ``class BaseClassifier(ABC)``
Base class for classification algorithms, defining the abstract methods ``fit`` and ``predict``, and implementing the ``get_params`` method.
## Abstract methods
-
### def fit(...)
```python
@@ -25,10 +23,8 @@ Fit the model to the training data.
Implementation:
-- [RNSA](/docs/0.2.x/aisp-techniques/Negative%20Selection/rnsa#Function-fit)
-- [BNSA](/docs/0.2.x/aisp-techniques/Negative%20Selection/bnsa#Function-fit)
-
-
+- [RNSA](../../aisp-techniques/Negative%20Selection/RNSA.md#Function-fit)
+- [BNSA](../../aisp-techniques/Negative%20Selection/BNSA.md#Function-fit)
### def predict(...)
@@ -40,34 +36,34 @@ Performs label prediction for the given data.
Implementation:
-- [RNSA](/docs/0.2.x/aisp-techniques/Negative%20Selection/rnsa#Function-predict)
-- [BNSA](/docs/0.2.x/aisp-techniques/Negative%20Selection/bnsa#Function-predict)
+- [RNSA](../../aisp-techniques/Negative%20Selection/RNSA.md#Function-predict)
+- [BNSA](../../aisp-techniques/Negative%20Selection/BNSA.md#Function-predict)
---
## Methods
-
### def score(...)
```python
def score(self, X: npt.NDArray, y: list) -> float
```
+
Score function calculates forecast accuracy.
-This function performs the prediction of X and checks how many elements are equal between vector y and y_predicted.
+This function performs the prediction of X and checks how many elements are equal between vector y and y_predicted.
This function was added for compatibility with some scikit-learn functions.
**Parameters**:
-+ ***X***: ``np.ndarray``
+
+- ***X***: ``np.ndarray``
Feature set with shape (n_samples, n_features).
-+ ***y***: ``np.ndarray``
+- ***y***: ``np.ndarray``
True values with shape (n_samples,).
**Returns**:
-+ accuracy: ``float`` The accuracy of the model.
-
+- accuracy: ``float`` The accuracy of the model.
### Function _slice_index_list_by_class(...)
@@ -86,11 +82,9 @@ Returns a dictionary with the classes as key and the indices in ``X`` of the sam
```python
def get_params(self, deep: bool = True) -> dict:
```
+
The get_params function Returns a dictionary with the object's main parameters.
This function is required to ensure compatibility with scikit-learn functions.
---
-
-
-
diff --git a/versioned_docs/version-0.2.x/advanced-guides/Base module/Mutation.md b/versioned_docs/version-0.2.x/advanced-guides/Base module/Mutation.md
index a68f7738..eaf18676 100644
--- a/versioned_docs/version-0.2.x/advanced-guides/Base module/Mutation.md
+++ b/versioned_docs/version-0.2.x/advanced-guides/Base module/Mutation.md
@@ -75,4 +75,4 @@ This function creates `n` clones of the input vector and applies random mutation
### Returns
-* `clone_set` (`npt.NDArray[np.float64]`): Array with shape `(n, len(vector))` containing the `n` mutated clones of the original vector.
\ No newline at end of file
+* `clone_set` (`npt.NDArray[np.float64]`): Array with shape `(n, len(vector))` containing the `n` mutated clones of the original vector.
diff --git a/versioned_docs/version-0.2.x/advanced-guides/Core/Negative Selection.md b/versioned_docs/version-0.2.x/advanced-guides/Core/Negative Selection.md
index e5b80d60..a85f9771 100644
--- a/versioned_docs/version-0.2.x/advanced-guides/Core/Negative Selection.md
+++ b/versioned_docs/version-0.2.x/advanced-guides/Core/Negative Selection.md
@@ -8,7 +8,7 @@ last_update:
The functions perform detector checks and utilize Numba decorators for Just-In-Time compilation
-### Function check_detector_bnsa_validity(...):
+## Function check_detector_bnsa_validity(...)
```python
def check_detector_bnsa_validity(
@@ -20,18 +20,19 @@ def check_detector_bnsa_validity(
Checks the validity of a candidate detector (vector_x) against samples from a class (x_class) using the Hamming distance. A detector is considered INVALID if its distance to any sample in ``x_class`` is less than or equal to ``aff_thresh``.
-
**Parameters**:
+
* x_class (``npt.NDArray``): Array containing the class samples. Expected shape: (n_samples, n_features).
* vector_x (``npt.NDArray``): Array representing the detector. Expected shape: (n_features,).
* aff_thresh (``float``): Affinity threshold.
**returns**:
+
* True if the detector is valid, False otherwise.
---
-### Function bnsa_class_prediction(...):
+## Function bnsa_class_prediction(...)
```python
def bnsa_class_prediction(
@@ -40,21 +41,23 @@ def bnsa_class_prediction(
aff_thresh: float
) -> int:
```
-Defines the class of a sample from the non-self detectors.
+Defines the class of a sample from the non-self detectors.
**Parameters**:
+
* features (``npt.NDArray``): binary sample to be classified (shape: [n_features]).
* class_detectors (``npt.NDArray``): Array containing the detectors of all classes
(shape: [n_classes, n_detectors, n_features]).
* aff_thresh (``float``): Affinity threshold that determines whether a detector recognizes the sample as non-self.
**returns**:
+
* int: Index of the predicted class. Returns -1 if it is non-self for all classes.
---
-### Function check_detector_rnsa_validity(...):
+## Function check_detector_rnsa_validity(...)
```python
def check_detector_rnsa_validity(
@@ -65,9 +68,11 @@ def check_detector_rnsa_validity(
p: float
) -> bool:
```
+
Checks the validity of a candidate detector (vector_x) against samples from a class (x_class) using the Hamming distance. A detector is considered INVALID if its distance to any sample in ``x_class`` is less than or equal to ``aff_thresh``.
**Parameters**:
+
* x_class (``npt.NDArray``): Array containing the class samples. Expected shape: (n_samples, n_features).
* vector_x (``npt.NDArray``): Array representing the detector. Expected shape: (n_features,).
* threshold (``float``): threshold.
@@ -75,6 +80,7 @@ Checks the validity of a candidate detector (vector_x) against samples from a cl
* p (``float``): Parameter for the Minkowski distance (used only if `metric` is "minkowski").
**returns**:
+
* int: Index of the predicted class. Returns -1 if it is non-self for all classes.
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.2.x/advanced-guides/Utils/Distance.md b/versioned_docs/version-0.2.x/advanced-guides/Utils/Distance.md
index f3d61352..31981a44 100644
--- a/versioned_docs/version-0.2.x/advanced-guides/Utils/Distance.md
+++ b/versioned_docs/version-0.2.x/advanced-guides/Utils/Distance.md
@@ -15,15 +15,16 @@ def hamming(u: npt.NDArray, v: npt.NDArray) -> np.float64:
```
The function to calculate the normalized Hamming distance between two points.
-
-$((x₁ ≠ x₂) + (y₁ ≠ y₂) + ... + (yn ≠ yn)) / n$
+$$\frac{(x_1 \neq y_1) + (x_2 \neq y_2) + \cdots + (x_n \neq y_n)}{n}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -36,15 +37,15 @@ def euclidean(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64]) -> np.floa
Function to calculate the normalized Euclidean distance between two points.
-$√( (x₁ - x₂)² + (y₁ - y₂)² + ... + (yn - yn)²)$
-
-
+$$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -56,15 +57,16 @@ def cityblock(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64]) -> np.floa
```
Function to calculate the normalized Manhattan distance between two points.
-
-$(|x₁ - x₂| + |y₁ - y₂| + ... + |yn - yn|) / n$
+$$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -76,19 +78,20 @@ def minkowski(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64], p: float =
```
Function to calculate the normalized Minkowski distance between two points.
-
-$(( |X₁ - Y₁|p + |X₂ - Y₂|p + ... + |Xn - Yn|p) ¹/ₚ) / n$
+$$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
* p float: The p parameter defines the type of distance to be calculated:
- - p = 1: **Manhattan** distance — sum of absolute differences.
- - p = 2: **Euclidean** distance — sum of squared differences (square root).
- - p > 2: **Minkowski** distance with an increasing penalty as p increases.
+ * p = 1: **Manhattan** distance — sum of absolute differences.
+ * p = 2: **Euclidean** distance — sum of squared differences (square root).
+ * p > 2: **Minkowski** distance with an increasing penalty as p increases.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -107,12 +110,14 @@ def compute_metric_distance(
Function to calculate the distance between two points by the chosen ``metric``.
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
* metric (``int``): Distance metric to be used. Available options: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)]
* p (``float``): Parameter for the Minkowski distance (used only if `metric` is "minkowski").
**Returns:**
+
* Distance (``double``) between the two points with the selected metric.
---
@@ -130,14 +135,15 @@ def min_distance_to_class_vectors(
Calculates the minimum distance between an input vector and the vectors of a class.
-
**Parameters:**
+
* x_class (``npt.NDArray``): Array containing the class vectors to be compared with the input vector. Expected shape: (n_samples, n_features).
* vector_x (``npt.NDArray``): Vector to be compared with the class vectors. Expected shape: (n_features,).
* metric (``int``): Distance metric to be used. Available options: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)]
* p (``float``): Parameter for the Minkowski distance (used only if `metric` is "minkowski").
**Returns:**
+
* float: The minimum distance calculated between the input vector and the class vectors.
* Returns -1.0 if the input dimensions are incompatible.
@@ -148,16 +154,19 @@ Calculates the minimum distance between an input vector and the vectors of a cla
```python
def get_metric_code(metric: str) -> int:
```
+
Returns the numeric code associated with a distance metric.
**Parameters:**
+
* metric (str): Name of the metric. Can be "euclidean", "manhattan", "minkowski" or "hamming".
**Raises**
-----------
+
* ``ValueError``: If the metric provided is not supported
**Returns:**
+
* ``int``: Numeric code corresponding to the metric.
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.2.x/advanced-guides/Utils/Metrics.md b/versioned_docs/version-0.2.x/advanced-guides/Utils/Metrics.md
index c92962b2..33a4004b 100644
--- a/versioned_docs/version-0.2.x/advanced-guides/Utils/Metrics.md
+++ b/versioned_docs/version-0.2.x/advanced-guides/Utils/Metrics.md
@@ -8,7 +8,7 @@ author: João Paulo
The metrics file provides utilities to measure, analyze, and compare the performance of the package's algorithms in a standardized way.
-#### def accuracy_score(...)
+### def accuracy_score(...)
```python
def accuracy_score(
@@ -21,16 +21,19 @@ Function to calculate precision accuracy based on lists of true labels and
predicted labels.
**Parameters**:
+
* **_y_true_** (``Union[npt.NDArray, list]``): Ground truth (correct) labels.
Expected to be of the same length as `y_pred`.
* **_y_pred_** (``Union[npt.NDArray, list]``): Predicted labels. Expected to
be of the same length as `y_true`.
Returns:
+
* **_Accuracy_** (``float``): The ratio of correct predictions to the total
number of predictions.
**Raises**:
+
* `ValueError`: If `y_true` or `y_pred` are empty or if they do not have the same length.
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.2.x/advanced-guides/Utils/Multiclass.md b/versioned_docs/version-0.2.x/advanced-guides/Utils/Multiclass.md
index 772e2373..83c58b1d 100644
--- a/versioned_docs/version-0.2.x/advanced-guides/Utils/Multiclass.md
+++ b/versioned_docs/version-0.2.x/advanced-guides/Utils/Multiclass.md
@@ -19,8 +19,10 @@ according to the output class, to loop through the sample array, only in positio
the output is the class being trained.
**Parameters**:
+
* ***classes*** (``list or npt.NDArray``): list with unique classes.
* ***y*** (npt.NDArray): Receives a ``y``[``N sample``] array with the output classes of the ``X`` sample array.
**returns**:
+
* dict: A dictionary with the list of array positions(``y``), with the classes as key.
diff --git a/versioned_docs/version-0.2.x/advanced-guides/Utils/Sanitizers.md b/versioned_docs/version-0.2.x/advanced-guides/Utils/Sanitizers.md
index 85c3ad8f..34c0132d 100644
--- a/versioned_docs/version-0.2.x/advanced-guides/Utils/Sanitizers.md
+++ b/versioned_docs/version-0.2.x/advanced-guides/Utils/Sanitizers.md
@@ -14,14 +14,14 @@ def sanitize_choice(value: T, valid_choices: Iterable[T], default: T) -> T
The function ``sanitize_choice(...)``, returns the value if it is present in the set of valid choices; otherwise, returns the default value.
-
**Parameters:**
+
* ***value*** (``T``): The value to be checked.
* ***valid_choices*** (``Iterable[T]``): A collection of valid choices.
* ***default***: The default value to be returned if ``value`` is not in ``valid_choices``.
-
**Returns:**
+
* `T`: The original value if valid, or the default value if not.
---
@@ -35,12 +35,13 @@ def sanitize_param(value: T, default: T, condition: Callable[[T], bool]) -> T:
The function ``sanitize_param(...)``, returns the value if it satisfies the specified condition; otherwise, returns the default value.
**Parameters:**
+
* value (``T``): The value to be checked.
* default (``T``): The default value to be returned if the condition is not satisfied.
* condition (``Callable[[T], bool]``): A function that takes a value and returns a boolean, determining if the value is valid.
-
**Returns:**
+
* `T`: The original value if the condition is satisfied, or the default value if not.
---
@@ -54,7 +55,9 @@ def sanitize_seed(seed: Any) -> Optional[int]:
The function ``sanitize_param(...)``, returns the seed if it is a non-negative integer; otherwise, returns None.
**Parameters:**
+
* seed (``Any``): The seed value to be validated.
**Returns:**
-* ``Optional[int]``: The original seed if it is a non-negative integer, or ``None`` if it is invalid.
\ No newline at end of file
+
+* ``Optional[int]``: The original seed if it is a non-negative integer, or ``None`` if it is invalid.
diff --git a/versioned_docs/version-0.2.x/advanced-guides/Utils/Validation.md b/versioned_docs/version-0.2.x/advanced-guides/Utils/Validation.md
index c0e4e944..fdbcb573 100644
--- a/versioned_docs/version-0.2.x/advanced-guides/Utils/Validation.md
+++ b/versioned_docs/version-0.2.x/advanced-guides/Utils/Validation.md
@@ -21,7 +21,9 @@ This function analyzes the input vector and classifies its data as one of the su
* `vector` (`npt.NDArray`): An array containing the data to be classified.
**Returns**
+
* `FeatureType` (`Literal["binary-features", "continuous-features", "ranged-features"]`): The detected type of data in the vector.
**Raises**
-* `UnsupportedDataTypeError`: Raised if the vector contains an unsupported data type.
\ No newline at end of file
+
+* `UnsupportedDataTypeError`: Raised if the vector contains an unsupported data type.
diff --git a/versioned_docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/Cell.md b/versioned_docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/Cell.md
index 9b474ef2..383356d6 100644
--- a/versioned_docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/Cell.md
+++ b/versioned_docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/Cell.md
@@ -17,20 +17,20 @@ lastUpdatedAt: 2025/05/25
author: João Paulo
---
-# Célula-B de memória
+It represents a memory B-cell.
-Representa uma célula-B de memória.
-
-### Constructor:
+### Constructor
Parameters:
+
* **vector** (``Optional[npt.NDArray]``): A feature vector of the cell. Defaults to None.
---
-### Function hyper_clonal_mutate(...):
+### Function hyper_clonal_mutate(...)
Parameters:
+
* **n** (``int``): The number of clones to be generated from mutations in the original cell.
* **feature_type** (``Literal["continuous-features", "binary-features", "ranged-features"]``): Specifies the type of
algorithm to use based on the nature of the input features
@@ -49,4 +49,4 @@ def hyper_clonal_mutate(
) -> npt.NDArray
```
-Returns an array containing N mutated vectors from the original cell.
\ No newline at end of file
+Returns an array containing N mutated vectors from the original cell.
diff --git a/versioned_docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/airs/README.md b/versioned_docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/airs/README.md
index 095920fc..3964bbe7 100644
--- a/versioned_docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/airs/README.md
+++ b/versioned_docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/airs/README.md
@@ -15,7 +15,7 @@ author: João Paulo
# AIRS - Artificial Immune Recognition System
-The ``AIRS`` class aims to perform classification using metaphors of selection and clonal expansion.
+The ``AIRS`` class aims to perform classification using metaphors of selection and clonal expansion.
This implementation is inspired by AIRS2, a simplified version of the original AIRS algorithm.
Introducing adaptations to handle continuous and binary datasets.
@@ -34,36 +34,37 @@ Based on Algorithm 16.5 from Brabazon et al. [1](#1).
:::
-## AIRS Constructor:
-
+## AIRS Constructor
**Attributes:**
-* **n_resources** (``float``): Total amount of available resources. Defaults to 10.
-* **rate_clonal** (``float``): Maximum number of possible clones of a class. This quantity is multiplied by (cell stimulus * rate_hypermutation) to define the number of clones. Defaults to 10.
-* **rate_hypermutation** (``int``): The rate of mutated clones derived from rate_clonal as a scalar factor. Defaults to 0.75.
-* **affinity_threshold_scalar** (``float``): Normalized affinity threshold. Defaults to 0.75.
-* **k** (``int``): The number of K nearest neighbors that will be used to choose a label in the prediction. Defaults to 10.
-* **max_iters** (``int``): Maximum number of interactions in the refinement process of the ARB set exposed to aᵢ. Defaults to 100.
-* **resource_amplified** (``float``): Resource consumption amplifier is multiplied with the incentive to subtract resources. Defaults to 1.0 without amplification.
-* **metric** (Literal["manhattan", "minkowski", "euclidean"]): Way to calculate the distance between the detector and the sample:
- * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression:
- $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + ... + (Y_{n} - Y_{n})^2}$$
- * ``'minkowski'`` ➜ The calculation of the distance is given by the expression:
- $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + ... |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - X_{1}| + |Y_{2} - Y_{2}| + ... + |Y_{n} - Y_{n}|)$$.
+
+- **n_resources** (``float``): Total amount of available resources. Defaults to 10.
+- **rate_clonal** (``float``): Maximum number of possible clones of a class. This quantity is multiplied by (cell stimulus * rate_hypermutation) to define the number of clones. Defaults to 10.
+- **rate_hypermutation** (``int``): The rate of mutated clones derived from rate_clonal as a scalar factor. Defaults to 0.75.
+- **affinity_threshold_scalar** (``float``): Normalized affinity threshold. Defaults to 0.75.
+- **k** (``int``): The number of K nearest neighbors that will be used to choose a label in the prediction. Defaults to 10.
+- **max_iters** (``int``): Maximum number of interactions in the refinement process of the ARB set exposed to aᵢ. Defaults to 100.
+- **resource_amplified** (``float``): Resource consumption amplifier is multiplied with the incentive to subtract resources. Defaults to 1.0 without amplification.
+- **metric** (Literal["manhattan", "minkowski", "euclidean"]): Way to calculate the distance between the detector and the sample:
+ - ``'Euclidean'`` ➜ The calculation of the distance is given by the expression:
+ $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$
+ - ``'minkowski'`` ➜ The calculation of the distance is given by the expression:
+ $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
+ - ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$.
Defaults to **"Euclidean"**.
-* **seed** (``Optional[int]``): Seed for the random generation of detector values. Defaults to None.
+- **seed** (``Optional[int]``): Seed for the random generation of detector values. Defaults to None.
- ``**kwargs``:
- - **p** (``float``): This parameter stores the value of ``p`` used in the Minkowski distance.
+ - **p** (``float``): This parameter stores the value of ``p`` used in the Minkowski distance.
The default is ``2``, which means normalized Euclidean distance. Different values of p lead to different variants of the Minkowski distance. [Learn more](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
**Other initialized variables:**
-* **cells_memory** (``dict``): This variable stores a list of memory cells by class.
-* **affinity_threshold** (``dict``): Defines the affinity threshold between antigens.
-* **classes** (``npt.NDArray``): List of output classes.
+
+- **cells_memory** (``dict``): This variable stores a list of memory cells by class.
+- **affinity_threshold** (``dict``): Defines the affinity threshold between antigens.
+- **classes** (``npt.NDArray``): List of output classes.
---
@@ -76,12 +77,14 @@ The ``fit(...)`` function generates detectors for the non-owners relative to the
```python
def fit(self, X: npt.NDArray, y: npt.NDArray):
```
+
It performs the training according to ``X`` and ``y``, using the method Artificial Immune Recognition System (``AIRS``).
**Input parameters:**
-* **X**: Array with sample features, with **N** samples (rows) and **N** features (columns), normalized to values between [0, 1].
-* **y**: Array with output classes corresponding to **N** samples related to ``X``.
-* **verbose**: Boolean, default ``True``, determines if the feedback from the detector generation will be printed.
+
+- **X**: Array with sample features, with **N** samples (rows) and **N** features (columns), normalized to values between [0, 1].
+- **y**: Array with output classes corresponding to **N** samples related to ``X``.
+- **verbose**: Boolean, default ``True``, determines if the feedback from the detector generation will be printed.
*Returns the class instance.*
@@ -96,15 +99,17 @@ def predict(self, X: npt.NDArray) -> npt.NDArray:
```
**Input parameter:**
-* **X**: Array with the features for prediction, with **N** samples (rows) and **N** columns.
+
+- **X**: Array with the features for prediction, with **N** samples (rows) and **N** columns.
**Returns:**
-* **C**: An array of predictions with the output classes for the given features.
-* **None**: If there are no detectors.
+
+- **C**: An array of predictions with the output classes for the given features.
+- **None**: If there are no detectors.
---
-### Function score(...):
+### Function score(...)
The ``score(...)`` function calculates the accuracy of the trained model by making predictions and calculating the accuracy.
@@ -118,13 +123,14 @@ Returns accuracy as a ``float``.
## Private Methods
-### Function _refinement_arb(...):
+### Function _refinement_arb(...)
The function "_refinement_arb(...)" refines the ARB set until the average stimulation value exceeds the defined threshold (``affinity_threshold_scalar``).
Parameters:
-* **c_match** (``Cell``): Cell with the highest stimulation relative to aᵢ.
-* **arb_list** (``List[_ARB]``): ARB set.
+
+- **c_match** (``Cell``): Cell with the highest stimulation relative to aᵢ.
+- **arb_list** (``List[_ARB]``): ARB set.
```python
def _refinement_arb(self, ai: npt.NDArray, c_match: Cell, arb_list: List[_ARB]) -> _ARB:
@@ -134,7 +140,7 @@ Returns the cell (_ARB) with the highest ARB stimulation.
---
-### Function _cells_affinity_threshold(...):
+### Function _cells_affinity_threshold(...)
The function "_cells_affinity_threshold(...)" calculates the affinity threshold based on the average affinity between training instances, where aᵢ and aⱼ are a pair of antigens, and affinity is measured by distance (Euclidean, Manhattan, Minkowski, Hamming).
**Following the formula:**
@@ -145,7 +151,8 @@ $$
$$
Parameters:
-* **antigens_list** (``NDArray``): List of training antigens.
+
+- **antigens_list** (``NDArray``): List of training antigens.
```python
def _cells_affinity_threshold(self, antigens_list: npt.NDArray):
@@ -153,13 +160,14 @@ def _cells_affinity_threshold(self, antigens_list: npt.NDArray):
---
-### Function _affinity(...):
+### Function _affinity(...)
The function "_affinity(...)" calculates the stimulus between two vectors using metrics.
Parameters:
-* **u** (``npt.NDArray``): Coordinates of the first point.
-* **v** (``npt.NDArray``): Coordinates of the second point.
+
+- **u** (``npt.NDArray``): Coordinates of the first point.
+- **v** (``npt.NDArray``): Coordinates of the second point.
```python
def _affinity(self, u: npt.NDArray, v: npt.NDArray) -> float:
@@ -169,12 +177,13 @@ Returns the stimulus rate between the vectors.
---
-### Function _init_memory_c(...):
+### Function _init_memory_c(...)
The function "_init_memory_c(...)" initializes memory cells by randomly selecting `n_antigens_selected` from the list of training antigens.
Parameters:
-* **antigens_list** (``NDArray``): List of training antigens.
+
+- **antigens_list** (``NDArray``): List of training antigens.
```python
def _init_memory_c(self, antigens_list: npt.NDArray) -> List[Cell]:
@@ -182,10 +191,10 @@ def _init_memory_c(self, antigens_list: npt.NDArray) -> List[Cell]:
---
-
-# References
+## References
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
\ No newline at end of file
+### 1
+>
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
diff --git a/versioned_docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/airs/abr.md b/versioned_docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/airs/abr.md
index 74ef0d7f..7e3a7380 100644
--- a/versioned_docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/airs/abr.md
+++ b/versioned_docs/version-0.2.x/aisp-techniques/Clonal Selection Algorithms/airs/abr.md
@@ -25,16 +25,18 @@ Individual from the set of recognizing cells (ABR), inherits characteristics fro
:::
-### Constructor:
+### Constructor
Parameters:
+
* vector (``npt.NDArray``): A feature vector of the cell. Defaults to None.
---
-### Function consume_resource(...):
+### Function consume_resource(...)
Parameters:
+
* n_resource (```float```) : The initial amount of resources.
* amplified (``float``): Amplifier for resource consumption by the cell. It is multiplied by the cell's stimulus. The default value is 1.
diff --git a/versioned_docs/version-0.2.x/aisp-techniques/Negative Selection/BNSA.md b/versioned_docs/version-0.2.x/aisp-techniques/Negative Selection/BNSA.md
index 6a2ca342..3a4e0e0b 100644
--- a/versioned_docs/version-0.2.x/aisp-techniques/Negative Selection/BNSA.md
+++ b/versioned_docs/version-0.2.x/aisp-techniques/Negative Selection/BNSA.md
@@ -1,6 +1,5 @@
---
id: bnsa
-title: BNSA
sidebar_label: BNSA - Binary Negative Selection Algorithm
sidebar_position: 2
pagination_next: null
@@ -24,7 +23,7 @@ last_update:
# BNSA (Binary Negative Selection Algorithm)
-## Constructor RNSA:
+## Constructor RNSA
The ``BNSA`` (Binary Negative Selection Algorithm) class has the purpose of classifying and identifying anomalies through the self and not self methods.
@@ -45,6 +44,7 @@ class BNSA(
* *N* (``int``): Number of detectors. Defaults to ``100``.
* *aff_thresh* (``float``): The variable ('affinity threshold') represents the percentage of dissimilarity between the T cell and the own samples. The default value is 10% (0.1), while a value of 1.0 represents 100% dissimilarity.
+
:::note
Setting the difference percentage too high can result in the inability to generate detectors for non-self.
:::
@@ -53,8 +53,8 @@ Setting the difference percentage too high can result in the inability to genera
possible infinite loop if a radius is defined that it is not possible to generate non-self detectors. Defaults to ``1000``.
* *seed* (``int``): Seed for the random generation of values in the detectors. Defaults to ``None``.
* no_label_sample_selection (``str``): Method for selecting labels for samples designated as non-members by all non-member detectors. **Available method types:**
- - (``max_average_difference``): Selects the class with the highest average difference among the detectors.
- - (``max_nearest_difference``): Selects the class with the highest difference between the nearest and farthest detector from the sample.
+ * (``max_average_difference``): Selects the class with the highest average difference among the detectors.
+ * (``max_nearest_difference``): Selects the class with the highest difference between the nearest and farthest detector from the sample.
**Other variables initiated:**
@@ -62,10 +62,8 @@ possible infinite loop if a radius is defined that it is not possible to generat
* *classes* (``npt.NDArray``): list of output classes.
-
---
-
### Function fit(...)
The ``fit(...)`` function generates the detectors for non-fits with respect to the samples:
@@ -76,8 +74,9 @@ def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
In it, training is performed according to ``X`` and ``y``, using the negative selection method(``NegativeSelect``).
-**The input parameters are:**
-* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
+**The input parameters are:**
+
+* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
* ``y``: array with the output classes arranged in **N** samples that are related to ``X``.
@@ -95,10 +94,12 @@ The ``predict(...)`` function performs class prediction using the generated dete
def predict(self, X: npt.NDArray) -> npt.NDArray:
```
-**The input parameter is:**
+**The input parameter is:**
+
* ``X``: array with the characteristics for the prediction, with **N** samples (Rows) and **N** columns.
-**Returns:**
+**Returns:**
+
* ``C``: prediction array, with the output classes for the given characteristics.
* ``None``: if there are no detectors.
@@ -128,8 +129,9 @@ The function ``__assign_class_to_non_self_sample(...)``, determines the class of
def __assign_class_to_non_self_sample(self, line: npt.NDArray, c: list):
```
-**The input parameter is:**
+**The input parameter is:**
+
* ***line*** (``npt.NDArray``): Sample to be classified.
* ***c*** (``list``): List of predictions to be updated with the new classification.
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.2.x/aisp-techniques/Negative Selection/README.md b/versioned_docs/version-0.2.x/aisp-techniques/Negative Selection/README.md
index 996fd4e3..31e29ec0 100644
--- a/versioned_docs/version-0.2.x/aisp-techniques/Negative Selection/README.md
+++ b/versioned_docs/version-0.2.x/aisp-techniques/Negative Selection/README.md
@@ -18,17 +18,17 @@ sidebar_position: 1
>>> + [Iris Database](https://github.com/AIS-Package/aisp/blob/main/examples/RNSA/iris_dataBase_example_en.ipynb)
>>> + [Geyser Database](https://github.com/AIS-Package/aisp/blob/main/examples/RNSA/geyser_dataBase_example_en.ipynb)
-# References
+## References
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
+### 1
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
-##### 2
-> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: http://dx.doi.org/10.1109/RISP.1994.296580.
+### 2
+> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: [https://dx.doi.org/10.1109/RISP.1994.296580](https://dx.doi.org/10.1109/RISP.1994.296580).
-##### 3
-> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: http://dx.doi.org/10.1007/978-3-540-24854-5_30.
+### 3
+> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: [https://dx.doi.org/10.1007/978-3-540-24854-5_30](https://dx.doi.org/10.1007/978-3-540-24854-5_30).
---
\ No newline at end of file
diff --git a/versioned_docs/version-0.2.x/aisp-techniques/Negative Selection/RNSA.md b/versioned_docs/version-0.2.x/aisp-techniques/Negative Selection/RNSA.md
index 37444177..40ae6d46 100644
--- a/versioned_docs/version-0.2.x/aisp-techniques/Negative Selection/RNSA.md
+++ b/versioned_docs/version-0.2.x/aisp-techniques/Negative Selection/RNSA.md
@@ -1,6 +1,5 @@
---
id: rnsa
-title: RNSA
sidebar_label: RNSA - Real-Valued Negative Selection Algorithm
sidebar_position: 1
keywords:
@@ -21,7 +20,7 @@ last_update:
# RNSA (Real-Valued Negative Selection Algorithm)
-## Constructor RNSA:
+## Constructor RNSA
The ``RNSA`` (Real-Valued Negative Selection Algorithm) class has the purpose of classifying and identifying anomalies through the self and not self methods.
@@ -44,6 +43,7 @@ class RNSA(
* *N* (``int``): Number of detectors. Defaults to ``100``.
* *r* (``float``): Radius of the detector. Defaults to ``0.05``.
+
:::note
it is important to consider that setting a very low radius for the detector can significantly reduce the detection rate. On the other hand, a very large radius can make it impossible to incorporate the detector into the search space, which can also compromise detection performance. It is essential to find a balance between the radius size and detection efficiency to achieve the best possible results.
:::
@@ -51,32 +51,31 @@ it is important to consider that setting a very low radius for the detector can
* *k* (``int``): Number of neighbors near the randomly generated detectors to perform the distance average calculation. Defaults to ``1``.
* *metric* (``str``): Way to calculate the distance between the detector and the sample:
- * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression: $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + ... + (Y_{n} - Y_{n})^2}$$.
+ * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression: $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$.
- * ``'minkowski'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + ... |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - X_{1}| + |Y_{2} - Y_{2}| + ... + |Y_{n} - Y_{n}|)$$.
+ * ``'minkowski'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
+ * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$.
Defaults to ``'euclidean'``.
-
* *max_discards* (``int``): This parameter indicates the maximum number of consecutive detector discards, aimed at preventing a possible infinite loop in case a radius is defined that cannot generate non-self detectors. Defaults to ``1000``.
* *seed* (``int``): Seed for the random generation of values in the detectors. Defaults to ``None``.
* *algorithm* (``str``), Set the algorithm version:
- * ``'default-NSA'``: Default algorithm with fixed radius.
- * ``'V-detector'``: This algorithm is based on the article "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", by Ji, Z., Dasgupta, D. (2004), and uses a variable radius for anomaly detection in feature spaces.
+ * ``'default-NSA'``: Default algorithm with fixed radius.
+ * ``'V-detector'``: This algorithm is based on the article "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", by Ji, Z., Dasgupta, D. (2004), and uses a variable radius for anomaly detection in feature spaces.
Defaults to ``'default-NSA'``.
* *r_s* (``float``): rₛ Radius of the ``X`` own samples.
+
- ``**kwargs``:
- - *non_self_label* (``str``): This variable stores the label that will be assigned when the data has only one
+ * *non_self_label* (``str``): This variable stores the label that will be assigned when the data has only one
output class, and the sample is classified as not belonging to that class. Defaults to ``'non-self'``.
- - *cell_bounds* (``bool``): If set to ``True``, this option limits the generation of detectors to the space within the plane between 0 and 1. This means that any detector whose radius exceeds this limit is discarded, this variable is only used in the ``V-detector`` algorithm.
- - p (``float``): This parameter stores the value of ``p`` used in the Minkowski distance. The default is ``2``, which represents normalized Euclidean distance. Different values of p lead to different variants of the Minkowski
+ * *cell_bounds* (``bool``): If set to ``True``, this option limits the generation of detectors to the space within the plane between 0 and 1. This means that any detector whose radius exceeds this limit is discarded, this variable is only used in the ``V-detector`` algorithm.
+ * p (``float``): This parameter stores the value of ``p`` used in the Minkowski distance. The default is ``2``, which represents normalized Euclidean distance. Different values of p lead to different variants of the Minkowski
distance [learn more](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
-
**Other variables initiated:**
@@ -96,8 +95,9 @@ def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
In it, training is performed according to ``X`` and ``y``, using the negative selection method(``NegativeSelect``).
-The input parameters are:
-* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
+The input parameters are:
+
+* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
* ``y``: array with the output classes arranged in **N** samples that are related to ``X``.
@@ -115,10 +115,12 @@ The ``predict(...)`` function performs class prediction using the generated dete
def predict(self, X: npt.NDArray) -> npt.NDArray:
```
-**The input parameter is:**
+**The input parameter is:**
+
* ``X``: array with the characteristics for the prediction, with **N** samples (Rows) and **N** columns.
-**Returns:**
+**Returns:**
+
* ``C``: prediction array, with the output classes for the given characteristics.
* ``None``: if there are no detectors.
@@ -149,12 +151,13 @@ def __checks_valid_detector(self, X: npt.NDArray, vector_x: npt.NDArray, samples
```
**The input parameters are:**
+
* ``X``: array with sample characteristics with **N** samples (rows) and **N** characteristics (columns), normalized to values between [0, 1].
* ``vector_x``: Randomly generated candidate detector.
* ``samplesIndexClass``: Array with the indexes of a class.
-
+
**Returns:** ``True`` for detectors that do not have samples inside or ``False`` if they do.
---
@@ -179,9 +182,11 @@ In this function, when there is class ambiguity, it returns the class that has t
```python
def __compare_sample_to_detectors(self, line):
```
+
**The input parameters are:**
+
* line: vector with N-features
-
+
**Returns:** The predicted class with the detectors or None if the sample does not qualify for any class.
---
@@ -193,13 +198,14 @@ Check if the distance between the detector and the samples, minus the radius of
```python
def __detector_is_valid_to_Vdetector(self, distance, vector_x):
```
-
+
**The input parameters are:**
* distance (``float``): minimum distance calculated between all samples.
* vector_x (``numpy.ndarray``): randomly generated candidate detector vector x with values between 0 and 1.
-**Returns:**
+**Returns:**
+
* ``False``: if the calculated radius is smaller than the minimum distance or exceeds the edge of the space, if this option is enabled.
* ``True`` and the distance minus the radius of the samples, if the radius is valid.`
@@ -218,4 +224,3 @@ The input parameters are ``u`` and ``v`` NDArrays, with the coordinates for the
**Returns:** the distance (``double``) between the two points.
---
-
diff --git a/versioned_docs/version-0.2.x/intro.md b/versioned_docs/version-0.2.x/intro.md
index 7548ce19..b30c3af1 100644
--- a/versioned_docs/version-0.2.x/intro.md
+++ b/versioned_docs/version-0.2.x/intro.md
@@ -20,11 +20,11 @@ keywords:
- Bioinspiration
- Immune Metaphors
---
-# Artificial Immune Systems Package.
+# Artificial Immune Systems Package
-
+
@@ -34,9 +34,9 @@ keywords:
**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).
-### Algorithms implemented:
+### Algorithms implemented
-> - [x] [**Negative Selection.**](/docs/0.2.x/aisp-techniques/Negative%20Selection/)
-> - [x] [**Clonal Selection Algorithms.**](/docs/0.2.x/aisp-techniques/Clonal%20Selection%20Algorithms/)
+> - [x] [**Negative Selection.**](./aisp-techniques/Negative%20Selection/)
+> - [x] [**Clonal Selection Algorithms.**](./aisp-techniques/Clonal%20Selection%20Algorithms/)
> - [ ] *Dendritic Cells.*
> - [ ] *Immune Network Theory.*
diff --git a/versioned_docs/version-0.3.x/about-us.mdx b/versioned_docs/version-0.3.x/about-us.mdx
index 81059da4..0d837149 100644
--- a/versioned_docs/version-0.3.x/about-us.mdx
+++ b/versioned_docs/version-0.3.x/about-us.mdx
@@ -28,7 +28,7 @@ The AISP, or Artificial Immune Systems Package, had its origins in a research pr
name='Alison Zille Lopes'
date='2022'
githubUrl='https://github.com/alisonzille'
- lattesUrl='http://lattes.cnpq.br/3294097090760981'
+ lattesUrl='https://lattes.cnpq.br/3294097090760981'
/>
@@ -44,7 +44,7 @@ The AISP, or Artificial Immune Systems Package, had its origins in a research pr
date='2022-2023'
description="I was tasked with implementing version 0.1, which features the BNSA and RNSA negative selection classes, including fixed and variable radius versions."
githubUrl='https://github.com/Joao-Paulo-Silva'
- lattesUrl='http://lattes.cnpq.br/2561057724411407'
+ lattesUrl='https://lattes.cnpq.br/2561057724411407'
/>
\ No newline at end of file
diff --git a/versioned_docs/version-0.3.x/advanced-guides/Core/negative-selection.md b/versioned_docs/version-0.3.x/advanced-guides/Core/negative-selection.md
index e5b80d60..a85f9771 100644
--- a/versioned_docs/version-0.3.x/advanced-guides/Core/negative-selection.md
+++ b/versioned_docs/version-0.3.x/advanced-guides/Core/negative-selection.md
@@ -8,7 +8,7 @@ last_update:
The functions perform detector checks and utilize Numba decorators for Just-In-Time compilation
-### Function check_detector_bnsa_validity(...):
+## Function check_detector_bnsa_validity(...)
```python
def check_detector_bnsa_validity(
@@ -20,18 +20,19 @@ def check_detector_bnsa_validity(
Checks the validity of a candidate detector (vector_x) against samples from a class (x_class) using the Hamming distance. A detector is considered INVALID if its distance to any sample in ``x_class`` is less than or equal to ``aff_thresh``.
-
**Parameters**:
+
* x_class (``npt.NDArray``): Array containing the class samples. Expected shape: (n_samples, n_features).
* vector_x (``npt.NDArray``): Array representing the detector. Expected shape: (n_features,).
* aff_thresh (``float``): Affinity threshold.
**returns**:
+
* True if the detector is valid, False otherwise.
---
-### Function bnsa_class_prediction(...):
+## Function bnsa_class_prediction(...)
```python
def bnsa_class_prediction(
@@ -40,21 +41,23 @@ def bnsa_class_prediction(
aff_thresh: float
) -> int:
```
-Defines the class of a sample from the non-self detectors.
+Defines the class of a sample from the non-self detectors.
**Parameters**:
+
* features (``npt.NDArray``): binary sample to be classified (shape: [n_features]).
* class_detectors (``npt.NDArray``): Array containing the detectors of all classes
(shape: [n_classes, n_detectors, n_features]).
* aff_thresh (``float``): Affinity threshold that determines whether a detector recognizes the sample as non-self.
**returns**:
+
* int: Index of the predicted class. Returns -1 if it is non-self for all classes.
---
-### Function check_detector_rnsa_validity(...):
+## Function check_detector_rnsa_validity(...)
```python
def check_detector_rnsa_validity(
@@ -65,9 +68,11 @@ def check_detector_rnsa_validity(
p: float
) -> bool:
```
+
Checks the validity of a candidate detector (vector_x) against samples from a class (x_class) using the Hamming distance. A detector is considered INVALID if its distance to any sample in ``x_class`` is less than or equal to ``aff_thresh``.
**Parameters**:
+
* x_class (``npt.NDArray``): Array containing the class samples. Expected shape: (n_samples, n_features).
* vector_x (``npt.NDArray``): Array representing the detector. Expected shape: (n_features,).
* threshold (``float``): threshold.
@@ -75,6 +80,7 @@ Checks the validity of a candidate detector (vector_x) against samples from a cl
* p (``float``): Parameter for the Minkowski distance (used only if `metric` is "minkowski").
**returns**:
+
* int: Index of the predicted class. Returns -1 if it is non-self for all classes.
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.3.x/advanced-guides/Utils/Distance.md b/versioned_docs/version-0.3.x/advanced-guides/Utils/Distance.md
index f3d61352..31981a44 100644
--- a/versioned_docs/version-0.3.x/advanced-guides/Utils/Distance.md
+++ b/versioned_docs/version-0.3.x/advanced-guides/Utils/Distance.md
@@ -15,15 +15,16 @@ def hamming(u: npt.NDArray, v: npt.NDArray) -> np.float64:
```
The function to calculate the normalized Hamming distance between two points.
-
-$((x₁ ≠ x₂) + (y₁ ≠ y₂) + ... + (yn ≠ yn)) / n$
+$$\frac{(x_1 \neq y_1) + (x_2 \neq y_2) + \cdots + (x_n \neq y_n)}{n}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -36,15 +37,15 @@ def euclidean(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64]) -> np.floa
Function to calculate the normalized Euclidean distance between two points.
-$√( (x₁ - x₂)² + (y₁ - y₂)² + ... + (yn - yn)²)$
-
-
+$$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -56,15 +57,16 @@ def cityblock(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64]) -> np.floa
```
Function to calculate the normalized Manhattan distance between two points.
-
-$(|x₁ - x₂| + |y₁ - y₂| + ... + |yn - yn|) / n$
+$$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -76,19 +78,20 @@ def minkowski(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64], p: float =
```
Function to calculate the normalized Minkowski distance between two points.
-
-$(( |X₁ - Y₁|p + |X₂ - Y₂|p + ... + |Xn - Yn|p) ¹/ₚ) / n$
+$$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
* p float: The p parameter defines the type of distance to be calculated:
- - p = 1: **Manhattan** distance — sum of absolute differences.
- - p = 2: **Euclidean** distance — sum of squared differences (square root).
- - p > 2: **Minkowski** distance with an increasing penalty as p increases.
+ * p = 1: **Manhattan** distance — sum of absolute differences.
+ * p = 2: **Euclidean** distance — sum of squared differences (square root).
+ * p > 2: **Minkowski** distance with an increasing penalty as p increases.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -107,12 +110,14 @@ def compute_metric_distance(
Function to calculate the distance between two points by the chosen ``metric``.
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
* metric (``int``): Distance metric to be used. Available options: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)]
* p (``float``): Parameter for the Minkowski distance (used only if `metric` is "minkowski").
**Returns:**
+
* Distance (``double``) between the two points with the selected metric.
---
@@ -130,14 +135,15 @@ def min_distance_to_class_vectors(
Calculates the minimum distance between an input vector and the vectors of a class.
-
**Parameters:**
+
* x_class (``npt.NDArray``): Array containing the class vectors to be compared with the input vector. Expected shape: (n_samples, n_features).
* vector_x (``npt.NDArray``): Vector to be compared with the class vectors. Expected shape: (n_features,).
* metric (``int``): Distance metric to be used. Available options: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)]
* p (``float``): Parameter for the Minkowski distance (used only if `metric` is "minkowski").
**Returns:**
+
* float: The minimum distance calculated between the input vector and the class vectors.
* Returns -1.0 if the input dimensions are incompatible.
@@ -148,16 +154,19 @@ Calculates the minimum distance between an input vector and the vectors of a cla
```python
def get_metric_code(metric: str) -> int:
```
+
Returns the numeric code associated with a distance metric.
**Parameters:**
+
* metric (str): Name of the metric. Can be "euclidean", "manhattan", "minkowski" or "hamming".
**Raises**
-----------
+
* ``ValueError``: If the metric provided is not supported
**Returns:**
+
* ``int``: Numeric code corresponding to the metric.
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.3.x/advanced-guides/Utils/Metrics.md b/versioned_docs/version-0.3.x/advanced-guides/Utils/Metrics.md
index c92962b2..33a4004b 100644
--- a/versioned_docs/version-0.3.x/advanced-guides/Utils/Metrics.md
+++ b/versioned_docs/version-0.3.x/advanced-guides/Utils/Metrics.md
@@ -8,7 +8,7 @@ author: João Paulo
The metrics file provides utilities to measure, analyze, and compare the performance of the package's algorithms in a standardized way.
-#### def accuracy_score(...)
+### def accuracy_score(...)
```python
def accuracy_score(
@@ -21,16 +21,19 @@ Function to calculate precision accuracy based on lists of true labels and
predicted labels.
**Parameters**:
+
* **_y_true_** (``Union[npt.NDArray, list]``): Ground truth (correct) labels.
Expected to be of the same length as `y_pred`.
* **_y_pred_** (``Union[npt.NDArray, list]``): Predicted labels. Expected to
be of the same length as `y_true`.
Returns:
+
* **_Accuracy_** (``float``): The ratio of correct predictions to the total
number of predictions.
**Raises**:
+
* `ValueError`: If `y_true` or `y_pred` are empty or if they do not have the same length.
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.3.x/advanced-guides/Utils/Multiclass.md b/versioned_docs/version-0.3.x/advanced-guides/Utils/Multiclass.md
index 772e2373..83c58b1d 100644
--- a/versioned_docs/version-0.3.x/advanced-guides/Utils/Multiclass.md
+++ b/versioned_docs/version-0.3.x/advanced-guides/Utils/Multiclass.md
@@ -19,8 +19,10 @@ according to the output class, to loop through the sample array, only in positio
the output is the class being trained.
**Parameters**:
+
* ***classes*** (``list or npt.NDArray``): list with unique classes.
* ***y*** (npt.NDArray): Receives a ``y``[``N sample``] array with the output classes of the ``X`` sample array.
**returns**:
+
* dict: A dictionary with the list of array positions(``y``), with the classes as key.
diff --git a/versioned_docs/version-0.3.x/advanced-guides/Utils/Sanitizers.md b/versioned_docs/version-0.3.x/advanced-guides/Utils/Sanitizers.md
index 85c3ad8f..34c0132d 100644
--- a/versioned_docs/version-0.3.x/advanced-guides/Utils/Sanitizers.md
+++ b/versioned_docs/version-0.3.x/advanced-guides/Utils/Sanitizers.md
@@ -14,14 +14,14 @@ def sanitize_choice(value: T, valid_choices: Iterable[T], default: T) -> T
The function ``sanitize_choice(...)``, returns the value if it is present in the set of valid choices; otherwise, returns the default value.
-
**Parameters:**
+
* ***value*** (``T``): The value to be checked.
* ***valid_choices*** (``Iterable[T]``): A collection of valid choices.
* ***default***: The default value to be returned if ``value`` is not in ``valid_choices``.
-
**Returns:**
+
* `T`: The original value if valid, or the default value if not.
---
@@ -35,12 +35,13 @@ def sanitize_param(value: T, default: T, condition: Callable[[T], bool]) -> T:
The function ``sanitize_param(...)``, returns the value if it satisfies the specified condition; otherwise, returns the default value.
**Parameters:**
+
* value (``T``): The value to be checked.
* default (``T``): The default value to be returned if the condition is not satisfied.
* condition (``Callable[[T], bool]``): A function that takes a value and returns a boolean, determining if the value is valid.
-
**Returns:**
+
* `T`: The original value if the condition is satisfied, or the default value if not.
---
@@ -54,7 +55,9 @@ def sanitize_seed(seed: Any) -> Optional[int]:
The function ``sanitize_param(...)``, returns the seed if it is a non-negative integer; otherwise, returns None.
**Parameters:**
+
* seed (``Any``): The seed value to be validated.
**Returns:**
-* ``Optional[int]``: The original seed if it is a non-negative integer, or ``None`` if it is invalid.
\ No newline at end of file
+
+* ``Optional[int]``: The original seed if it is a non-negative integer, or ``None`` if it is invalid.
diff --git a/versioned_docs/version-0.3.x/advanced-guides/Utils/Validation.md b/versioned_docs/version-0.3.x/advanced-guides/Utils/Validation.md
index c0e4e944..fdbcb573 100644
--- a/versioned_docs/version-0.3.x/advanced-guides/Utils/Validation.md
+++ b/versioned_docs/version-0.3.x/advanced-guides/Utils/Validation.md
@@ -21,7 +21,9 @@ This function analyzes the input vector and classifies its data as one of the su
* `vector` (`npt.NDArray`): An array containing the data to be classified.
**Returns**
+
* `FeatureType` (`Literal["binary-features", "continuous-features", "ranged-features"]`): The detected type of data in the vector.
**Raises**
-* `UnsupportedDataTypeError`: Raised if the vector contains an unsupported data type.
\ No newline at end of file
+
+* `UnsupportedDataTypeError`: Raised if the vector contains an unsupported data type.
diff --git a/versioned_docs/version-0.3.x/advanced-guides/base-classes-reference/csa/airs.md b/versioned_docs/version-0.3.x/advanced-guides/base-classes-reference/csa/airs.md
index 6bb93a08..54954e61 100644
--- a/versioned_docs/version-0.3.x/advanced-guides/base-classes-reference/csa/airs.md
+++ b/versioned_docs/version-0.3.x/advanced-guides/base-classes-reference/csa/airs.md
@@ -26,7 +26,7 @@ therefore are considered essential for the overall functioning of the system.
---
-### def _check_and_raise_exceptions_fit(...):
+### def _check_and_raise_exceptions_fit(...)
Verify the fit parameters and throw exceptions if the verification is not successful.
@@ -41,22 +41,23 @@ def _check_and_raise_exceptions_fit(
):
```
-
**Parameters**:
-* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, [``N samples`` (rows)][``N features`` (columns)].
-* ***y*** (``npt.NDArray``): Array of target classes of ``X`` with [``N samples`` (lines)].
-* ***algorithm*** (``Literal["continuous-features", "binary-features"], optional``): Specifies the type of algorithm to use, depending
+
+* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, \[``N samples`` (rows)\]\[``N features`` (columns)].
+* ***y*** (``npt.NDArray``): Array of target classes of ``X`` with \[``N samples`` (lines)].
+* ***algorithm*** (``Literal["continuous-features", "binary-features"], optional``): Specifies the type of algorithm to use, depending
on whether the input data has continuous or binary features.
**Raises**
+
* `TypeError`:
If X or y are not ndarrays or have incompatible shapes.
* `ValueError`
- If _class_ is BNSA and X contains values that are not composed only of 0 and 1.
+ If *class* is BNSA and X contains values that are not composed only of 0 and 1.
---
-### def _check_and_raise_exceptions_fit(...):
+### def _check_and_raise_exceptions_predict(...)
Verify the fit parameters and throw exceptions if the verification is not successful.
@@ -71,18 +72,20 @@ def _check_and_raise_exceptions_predict(
) -> None:
```
-
**Parameters**:
-* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, [``N samples`` rows)][``N features`` (columns)].
+
+* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, \[``N samples`` (rows)\]\[``N features`` (columns)].
* ***expected*** (``int``): Expected number of features per sample (columns in X).
-* ***algorithm*** (``Literal["continuous-features", "binary-features"], optional``): Specifies the type of algorithm to use, depending
+* ***algorithm*** (``Literal["continuous-features", "binary-features"], optional``): Specifies the type of algorithm to use, depending
on whether the input data has continuous or binary features.
**Raises**
+
* ``TypeError``
If X is not a ndarray or list.
* `FeatureDimensionMismatch`
If the number of features in X does not match the expected number.
* `ValueError`
If algorithm is binary-features and X contains values that are not composed only of 0 and 1.
----
\ No newline at end of file
+
+---
diff --git a/versioned_docs/version-0.3.x/advanced-guides/base-classes-reference/ina/ainet.md b/versioned_docs/version-0.3.x/advanced-guides/base-classes-reference/ina/ainet.md
index 201d6c3b..7a21c8b5 100644
--- a/versioned_docs/version-0.3.x/advanced-guides/base-classes-reference/ina/ainet.md
+++ b/versioned_docs/version-0.3.x/advanced-guides/base-classes-reference/ina/ainet.md
@@ -33,7 +33,7 @@ def _check_and_raise_exceptions_fit(X: npt.NDArray)
**Parameters**:
-* ***X*** (`npt.NDArray`): Training array, containing the samples and their characteristics, \[`N samples` (rows)]\[`N features` (columns)].
+* ***X*** (`npt.NDArray`): Training array, containing the samples and their characteristics, \\[`N samples` (rows)]\\[`N features` (columns)].
**Raises**:
@@ -56,7 +56,7 @@ def _check_and_raise_exceptions_predict(
**Parameters**:
-* ***X*** (`npt.NDArray`): Input array for prediction, containing the samples and their characteristics, \[`N samples` (rows)]\[`N features` (columns)].
+* ***X*** (`npt.NDArray`): Input array for prediction, containing the samples and their characteristics, \\[`N samples` (rows)]\\[`N features` (columns)].
* ***expected*** (`int`, default=0): Expected number of features per sample (columns in X).
* ***feature_type*** (`FeatureType`, default="continuous-features"): Specifies the type of features: "continuous-features", "binary-features", or "ranged-features".
diff --git a/versioned_docs/version-0.3.x/advanced-guides/base-classes-reference/nsa.md b/versioned_docs/version-0.3.x/advanced-guides/base-classes-reference/nsa.md
index 3317e175..021c4575 100644
--- a/versioned_docs/version-0.3.x/advanced-guides/base-classes-reference/nsa.md
+++ b/versioned_docs/version-0.3.x/advanced-guides/base-classes-reference/nsa.md
@@ -23,11 +23,12 @@ keywords:
The ``BaseNSA`` class contains utility functions with the ``protected`` modifier that can be inherited by various classes for ease of use. It includes functions for distance calculation, data separation to improve training and prediction efficiency, accuracy measurement and other functions.
-### Protected Functions:
+### Protected Functions
---
-#### Function _check_and_raise_exceptions_fit(...):
+#### Function _check_and_raise_exceptions_fit(...)
+
```python
def _check_and_raise_exceptions_fit(
X: npt.NDArray = None,
@@ -35,20 +36,24 @@ def _check_and_raise_exceptions_fit(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Function responsible for verifying fit function parameters and throwing exceptions if the verification is not successful.
**Parameters**:
-* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, [``N samples`` (rows)][``N features`` (columns)].
-* ***y*** (``npt.NDArray``): Array of target classes of ``X`` with [``N samples`` (lines)].
-* ***_class_*** (Literal[RNSA, BNSA], optional): Current class. Defaults to 'RNSA'.
+
+* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, \[``N samples`` (rows)\]\[``N features`` (columns)].
+* ***y*** (``npt.NDArray``): Array of target classes of ``X`` with \[``N samples`` (lines)].
+* ****class**** (Literal[RNSA, BNSA], optional): Current class. Defaults to 'RNSA'.
**Raises**
+
* ``TypeError``: If X or y are not ndarrays or have incompatible shapes.
-* ``ValueError``: If _class_ is BNSA and X contains values that are not composed only of 0 and 1.
+* ``ValueError``: If *class* is BNSA and X contains values that are not composed only of 0 and 1.
---
-#### Function _check_and_raise_exceptions_predict(...):
+#### Function _check_and_raise_exceptions_predict(...)
+
```python
def _check_and_raise_exceptions_predict(
X: npt.NDArray = None,
@@ -56,17 +61,20 @@ def _check_and_raise_exceptions_predict(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Function responsible for verifying predict function parameters and throwing exceptions if the verification is not successful.
**Parameters**:
-* ***X*** (``npt.NDArray``): Input array for prediction, containing the samples and their characteristics, [``N samples`` (rows)][``N features`` (columns)].
+
+* ***X*** (``npt.NDArray``): Input array for prediction, containing the samples and their characteristics, \[``N samples`` (rows)\]\[``N features`` (columns)].
* ***expected*** (``int``): Expected number of features per sample (columns in X).
-* _class_ (``Literal[RNSA, BNSA], optional``): Current class. Defaults to 'RNSA'.
+* *class* (``Literal[RNSA, BNSA], optional``): Current class. Defaults to 'RNSA'.
**Raises**
+
* ``TypeError``: If X is not an ndarray or list.
* ``FeatureDimensionMismatch``: If the number of features in X does not match the expected number.
-* ``ValueError``: If _class_ is BNSA and X contains values that are not composed only of 0 and 1.
+* ``ValueError``: If *class* is BNSA and X contains values that are not composed only of 0 and 1.
---
@@ -77,4 +85,4 @@ Represents a non-self detector of the RNSA class.
**Attributes:**
* ***position*** (``np.ndarray``): Detector feature vector.
-* ***radius*** (``float, optional``): Detector radius, used in the V-detector algorithm.
\ No newline at end of file
+* ***radius*** (``float, optional``): Detector radius, used in the V-detector algorithm.
diff --git a/versioned_docs/version-0.3.x/advanced-guides/base-module/Classifier.md b/versioned_docs/version-0.3.x/advanced-guides/base-module/Classifier.md
index 9b1e1ada..697cd21b 100644
--- a/versioned_docs/version-0.3.x/advanced-guides/base-module/Classifier.md
+++ b/versioned_docs/version-0.3.x/advanced-guides/base-module/Classifier.md
@@ -21,13 +21,12 @@ keywords:
- BNSA
---
-## ``class BaseClassifier(ABC, Base)``:
+## ``class BaseClassifier(ABC, Base)``
Base class for classification algorithms, defining the abstract methods ``fit`` and ``predict``, and implementing the ``get_params`` method.
## Abstract methods
-
### def fit(...)
```python
@@ -38,11 +37,9 @@ Fit the model to the training data.
Implementation:
-- [RNSA](/docs/aisp-techniques/negative-selection/rnsa#Function-fit)
-- [BNSA](/docs/aisp-techniques/negative-selection/bnsa#Function-fit)
-- [AIRS](/docs/aisp-techniques/clonal-selection-algorithms/airs/#Function-fit)
-
-
+- [RNSA](../../aisp-techniques/negative-selection/RNSA.md#Function-fit)
+- [BNSA](../../aisp-techniques/negative-selection/BNSA.md#Function-fit)
+- [AIRS](../../aisp-techniques/clonal-selection-algorithms/airs/#Function-fit)
### def predict(...)
@@ -54,35 +51,35 @@ Performs label prediction for the given data.
Implementation:
-- [RNSA](/docs/aisp-techniques/negative-selection/rnsa#Function-predict)
-- [BNSA](/docs/aisp-techniques/negative-selection/bnsa#Function-predict)
-- [AIRS](/docs/aisp-techniques/clonal-selection-algorithms/airs/#Function-predict)
+- [RNSA](../../aisp-techniques/negative-selection/RNSA.md#Function-predict)
+- [BNSA](../../aisp-techniques/negative-selection/BNSA.md#Function-predict)
+- [AIRS](../../aisp-techniques/clonal-selection-algorithms/airs/#Function-predict)
---
## Methods
-
### def score(...)
```python
def score(self, X: npt.NDArray, y: list) -> float
```
+
Score function calculates forecast accuracy.
-This function performs the prediction of X and checks how many elements are equal between vector y and y_predicted.
+This function performs the prediction of X and checks how many elements are equal between vector y and y_predicted.
This function was added for compatibility with some scikit-learn functions.
**Parameters**:
-+ ***X***: ``np.ndarray``
+
+- ***X***: ``np.ndarray``
Feature set with shape (n_samples, n_features).
-+ ***y***: ``np.ndarray``
+- ***y***: ``np.ndarray``
True values with shape (n_samples,).
**Returns**:
-+ accuracy: ``float`` The accuracy of the model.
-
+- accuracy: ``float`` The accuracy of the model.
### Function _slice_index_list_by_class(...)
@@ -93,4 +90,3 @@ def __slice_index_list_by_class(self, y: npt.NDArray) -> dict:
```
Returns a dictionary with the classes as key and the indices in ``X`` of the samples.
-
diff --git a/versioned_docs/version-0.3.x/advanced-guides/base-module/Clusterer.md b/versioned_docs/version-0.3.x/advanced-guides/base-module/Clusterer.md
index 68487813..565b9c96 100644
--- a/versioned_docs/version-0.3.x/advanced-guides/base-module/Clusterer.md
+++ b/versioned_docs/version-0.3.x/advanced-guides/base-module/Clusterer.md
@@ -52,7 +52,7 @@ This abstract method must be implemented by subclasses.
**Implementation**:
-* [AiNet](/docs/aisp-techniques/immune-network-theory/ainet#Function-fit)
+* [AiNet](../../aisp-techniques/immune-network-theory/AiNet.md#Function-fit)
---
@@ -77,7 +77,7 @@ This abstract method must be implemented by subclasses.
**Implementation**:
-* [AiNet](/docs/aisp-techniques/immune-network-theory/ainet#Function-predict)
+* [AiNet](../../aisp-techniques/immune-network-theory/AiNet.md#Function-predict)
---
diff --git a/versioned_docs/version-0.3.x/advanced-guides/base-module/Mutation.md b/versioned_docs/version-0.3.x/advanced-guides/base-module/Mutation.md
index 97b1cfee..a1b685ea 100644
--- a/versioned_docs/version-0.3.x/advanced-guides/base-module/Mutation.md
+++ b/versioned_docs/version-0.3.x/advanced-guides/base-module/Mutation.md
@@ -17,8 +17,6 @@ keywords:
- Vector Mutation
---
-# Mutation
-
Contains functions that generate sets of mutated clones from continuous or binary vectors, simulating the clonal expansion process in artificial immune systems.
## clone_and_mutate_continuous
@@ -94,4 +92,4 @@ This function creates `n` clones of the input vector and applies random mutation
### Returns
-* `clone_set` (`npt.NDArray[np.float64]`): Array with shape `(n, len(vector))` containing the `n` mutated clones of the original vector.
\ No newline at end of file
+* `clone_set` (`npt.NDArray[np.float64]`): Array with shape `(n, len(vector))` containing the `n` mutated clones of the original vector.
diff --git a/versioned_docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/Cell.md b/versioned_docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/Cell.md
index 9b474ef2..46989d19 100644
--- a/versioned_docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/Cell.md
+++ b/versioned_docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/Cell.md
@@ -17,20 +17,20 @@ lastUpdatedAt: 2025/05/25
author: João Paulo
---
-# Célula-B de memória
+It represents a memory B-cell.
-Representa uma célula-B de memória.
-
-### Constructor:
+## Constructor
Parameters:
+
* **vector** (``Optional[npt.NDArray]``): A feature vector of the cell. Defaults to None.
---
-### Function hyper_clonal_mutate(...):
+## Function hyper_clonal_mutate(...)
Parameters:
+
* **n** (``int``): The number of clones to be generated from mutations in the original cell.
* **feature_type** (``Literal["continuous-features", "binary-features", "ranged-features"]``): Specifies the type of
algorithm to use based on the nature of the input features
@@ -49,4 +49,4 @@ def hyper_clonal_mutate(
) -> npt.NDArray
```
-Returns an array containing N mutated vectors from the original cell.
\ No newline at end of file
+Returns an array containing N mutated vectors from the original cell.
diff --git a/versioned_docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/airs/README.md b/versioned_docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/airs/README.md
index 012ac7ab..ec591bfb 100644
--- a/versioned_docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/airs/README.md
+++ b/versioned_docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/airs/README.md
@@ -14,7 +14,7 @@ author: João Paulo
# AIRS - Artificial Immune Recognition System
-The ``AIRS`` class aims to perform classification using metaphors of selection and clonal expansion.
+The ``AIRS`` class aims to perform classification using metaphors of selection and clonal expansion.
This implementation is inspired by AIRS2, a simplified version of the original AIRS algorithm.
Introducing adaptations to handle continuous and binary datasets.
@@ -33,36 +33,37 @@ Based on Algorithm 16.5 from Brabazon et al. [1](#1).
:::
-## AIRS Constructor:
-
+## AIRS Constructor
**Attributes:**
-* **n_resources** (``float``): Total amount of available resources. Defaults to 10.
-* **rate_clonal** (``float``): Maximum number of possible clones of a class. This quantity is multiplied by (cell stimulus * rate_hypermutation) to define the number of clones. Defaults to 10.
-* **rate_hypermutation** (``int``): The rate of mutated clones derived from rate_clonal as a scalar factor. Defaults to 0.75.
-* **affinity_threshold_scalar** (``float``): Normalized affinity threshold. Defaults to 0.75.
-* **k** (``int``): The number of K nearest neighbors that will be used to choose a label in the prediction. Defaults to 10.
-* **max_iters** (``int``): Maximum number of interactions in the refinement process of the ARB set exposed to aᵢ. Defaults to 100.
-* **resource_amplified** (``float``): Resource consumption amplifier is multiplied with the incentive to subtract resources. Defaults to 1.0 without amplification.
-* **metric** (Literal["manhattan", "minkowski", "euclidean"]): Way to calculate the distance between the detector and the sample:
- * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression:
- $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + ... + (Y_{n} - Y_{n})^2}$$
- * ``'minkowski'`` ➜ The calculation of the distance is given by the expression:
- $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + ... |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - X_{1}| + |Y_{2} - Y_{2}| + ... + |Y_{n} - Y_{n}|)$$.
+
+- **n_resources** (``float``): Total amount of available resources. Defaults to 10.
+- **rate_clonal** (``float``): Maximum number of possible clones of a class. This quantity is multiplied by (cell stimulus * rate_hypermutation) to define the number of clones. Defaults to 10.
+- **rate_hypermutation** (``int``): The rate of mutated clones derived from rate_clonal as a scalar factor. Defaults to 0.75.
+- **affinity_threshold_scalar** (``float``): Normalized affinity threshold. Defaults to 0.75.
+- **k** (``int``): The number of K nearest neighbors that will be used to choose a label in the prediction. Defaults to 10.
+- **max_iters** (``int``): Maximum number of interactions in the refinement process of the ARB set exposed to aᵢ. Defaults to 100.
+- **resource_amplified** (``float``): Resource consumption amplifier is multiplied with the incentive to subtract resources. Defaults to 1.0 without amplification.
+- **metric** (Literal["manhattan", "minkowski", "euclidean"]): Way to calculate the distance between the detector and the sample:
+ - ``'Euclidean'`` ➜ The calculation of the distance is given by the expression:
+ $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$
+ - ``'minkowski'`` ➜ The calculation of the distance is given by the expression:
+ $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
+ - ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$.
Defaults to **"Euclidean"**.
-* **seed** (``Optional[int]``): Seed for the random generation of detector values. Defaults to None.
+- **seed** (``Optional[int]``): Seed for the random generation of detector values. Defaults to None.
- ``**kwargs``:
- - **p** (``float``): This parameter stores the value of ``p`` used in the Minkowski distance.
+ - **p** (``float``): This parameter stores the value of ``p`` used in the Minkowski distance.
The default is ``2``, which means normalized Euclidean distance. Different values of p lead to different variants of the Minkowski distance. [Learn more](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
**Other initialized variables:**
-* **cells_memory** (``dict``): This variable stores a list of memory cells by class.
-* **affinity_threshold** (``dict``): Defines the affinity threshold between antigens.
-* **classes** (``npt.NDArray``): List of output classes.
+
+- **cells_memory** (``dict``): This variable stores a list of memory cells by class.
+- **affinity_threshold** (``dict``): Defines the affinity threshold between antigens.
+- **classes** (``npt.NDArray``): List of output classes.
---
@@ -75,12 +76,14 @@ The ``fit(...)`` function generates detectors for the non-owners relative to the
```python
def fit(self, X: npt.NDArray, y: npt.NDArray):
```
+
It performs the training according to ``X`` and ``y``, using the method Artificial Immune Recognition System (``AIRS``).
**Input parameters:**
-* **X**: Array with sample features, with **N** samples (rows) and **N** features (columns), normalized to values between [0, 1].
-* **y**: Array with output classes corresponding to **N** samples related to ``X``.
-* **verbose**: Boolean, default ``True``, determines if the feedback from the detector generation will be printed.
+
+- **X**: Array with sample features, with **N** samples (rows) and **N** features (columns), normalized to values between [0, 1].
+- **y**: Array with output classes corresponding to **N** samples related to ``X``.
+- **verbose**: Boolean, default ``True``, determines if the feedback from the detector generation will be printed.
*Returns the class instance.*
@@ -95,15 +98,17 @@ def predict(self, X: npt.NDArray) -> npt.NDArray:
```
**Input parameter:**
-* **X**: Array with the features for prediction, with **N** samples (rows) and **N** columns.
+
+- **X**: Array with the features for prediction, with **N** samples (rows) and **N** columns.
**Returns:**
-* **C**: An array of predictions with the output classes for the given features.
-* **None**: If there are no detectors.
+
+- **C**: An array of predictions with the output classes for the given features.
+- **None**: If there are no detectors.
---
-### Function score(...):
+### Function score(...)
The ``score(...)`` function calculates the accuracy of the trained model by making predictions and calculating the accuracy.
@@ -117,13 +122,14 @@ Returns accuracy as a ``float``.
## Private Methods
-### Function _refinement_arb(...):
+### Function _refinement_arb(...)
The function "_refinement_arb(...)" refines the ARB set until the average stimulation value exceeds the defined threshold (``affinity_threshold_scalar``).
Parameters:
-* **c_match** (``Cell``): Cell with the highest stimulation relative to aᵢ.
-* **arb_list** (``List[_ARB]``): ARB set.
+
+- **c_match** (``Cell``): Cell with the highest stimulation relative to aᵢ.
+- **arb_list** (``List[_ARB]``): ARB set.
```python
def _refinement_arb(self, ai: npt.NDArray, c_match: Cell, arb_list: List[_ARB]) -> _ARB:
@@ -133,7 +139,7 @@ Returns the cell (_ARB) with the highest ARB stimulation.
---
-### Function _cells_affinity_threshold(...):
+### Function _cells_affinity_threshold(...)
The function "_cells_affinity_threshold(...)" calculates the affinity threshold based on the average affinity between training instances, where aᵢ and aⱼ are a pair of antigens, and affinity is measured by distance (Euclidean, Manhattan, Minkowski, Hamming).
**Following the formula:**
@@ -144,7 +150,8 @@ $$
$$
Parameters:
-* **antigens_list** (``NDArray``): List of training antigens.
+
+- **antigens_list** (``NDArray``): List of training antigens.
```python
def _cells_affinity_threshold(self, antigens_list: npt.NDArray):
@@ -152,13 +159,14 @@ def _cells_affinity_threshold(self, antigens_list: npt.NDArray):
---
-### Function _affinity(...):
+### Function _affinity(...)
The function "_affinity(...)" calculates the stimulus between two vectors using metrics.
Parameters:
-* **u** (``npt.NDArray``): Coordinates of the first point.
-* **v** (``npt.NDArray``): Coordinates of the second point.
+
+- **u** (``npt.NDArray``): Coordinates of the first point.
+- **v** (``npt.NDArray``): Coordinates of the second point.
```python
def _affinity(self, u: npt.NDArray, v: npt.NDArray) -> float:
@@ -168,12 +176,13 @@ Returns the stimulus rate between the vectors.
---
-### Function _init_memory_c(...):
+### Function _init_memory_c(...)
The function "_init_memory_c(...)" initializes memory cells by randomly selecting `n_antigens_selected` from the list of training antigens.
Parameters:
-* **antigens_list** (``NDArray``): List of training antigens.
+
+- **antigens_list** (``NDArray``): List of training antigens.
```python
def _init_memory_c(self, antigens_list: npt.NDArray) -> List[Cell]:
@@ -181,10 +190,10 @@ def _init_memory_c(self, antigens_list: npt.NDArray) -> List[Cell]:
---
-
-# References
+## References
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
\ No newline at end of file
+### 1
+>
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
diff --git a/versioned_docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/airs/abr.md b/versioned_docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/airs/abr.md
index d60358f7..13ad2b94 100644
--- a/versioned_docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/airs/abr.md
+++ b/versioned_docs/version-0.3.x/aisp-techniques/clonal-selection-algorithms/airs/abr.md
@@ -25,16 +25,18 @@ Individual from the set of recognizing cells (ABR), inherits characteristics fro
:::
-### Constructor:
+### Constructor
Parameters:
+
* vector (``npt.NDArray``): A feature vector of the cell. Defaults to None.
---
-### Function consume_resource(...):
+### Function consume_resource(...)
Parameters:
+
* n_resource (```float```) : The initial amount of resources.
* amplified (``float``): Amplifier for resource consumption by the cell. It is multiplied by the cell's stimulus. The default value is 1.
diff --git a/versioned_docs/version-0.3.x/aisp-techniques/immune-network-theory/AiNet.md b/versioned_docs/version-0.3.x/aisp-techniques/immune-network-theory/AiNet.md
index 581ecf11..0ccdc92c 100644
--- a/versioned_docs/version-0.3.x/aisp-techniques/immune-network-theory/AiNet.md
+++ b/versioned_docs/version-0.3.x/aisp-techniques/immune-network-theory/AiNet.md
@@ -1,6 +1,5 @@
---
id: ainet
-title: AiNet
sidebar_label: AiNet - Clustering and Compression
sidebar_position: 1
pagination_next: null
@@ -28,26 +27,25 @@ lastUpdatedAt: 2025/08/19
author: João Paulo
---
-# AiNet - Artificial Immune Network para Clustering and Compression.
+# AiNet - Artificial Immune Network para Clustering and Compression
The AiNet class aims to perform clustering using metaphors inspired by immune network theory.
This class implements the aiNet algorithm, an artificial immune network model designed for
clustering and data compression tasks. The aiNet algorithm uses principles from immune
network theory, clonal selection, and affinity maturation to compress high-dimensional
-datasets [1](#1).
+datasets [1](#1).
For clustering, the class uses SciPy's implementation of the [**Minimum Spanning Tree**
(MST)](#2) to remove the most distant nodes and separate the groups
:::info
-**``AiNet``** extends the **[``BaseAiNet`` class](/docs/advanced-guides/base-classes-reference/ina/ainet)**, inheriting its base functionality.
+**``AiNet``** extends the **[``BaseAiNet`` class](../../advanced-guides/base-classes-reference/ina/ainet.md)**, inheriting its base functionality.
:::
## Constructor
-
```python
class AiNet(
self,
@@ -68,6 +66,7 @@ class AiNet(
```
**Attributes:**
+
* **N** (``int``): Number of memory cells (antibodies) in the population. Defaults to 50.
* **n_clone** (``int``): Number of clones generated per selected memory cell. Defaults to 10.
* **top_clonal_memory_size** (``Optional[int]``): Number of highest-affinity antibodies selected for cloning. Defaults to 5.
@@ -78,20 +77,21 @@ class AiNet(
* **max_iterations** (``int``): Maximum number of training iterations. Defaults to 10.
* **k** (``int``): Number of nearest neighbors used for label prediction. Defaults to 3.
* **metric** (Literal["manhattan", "minkowski", "euclidean"]): Way to calculate the distance between the detector and the sample:
- * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression:
- $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + ... + (Y_{n} - Y_{n})^2}$$
- * ``'minkowski'`` ➜ The calculation of the distance is given by the expression:
- $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + ... |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - X_{1}| + |Y_{2} - Y_{2}| + ... + |Y_{n} - Y_{n}|)$$.
+ * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression:
+ $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$
+ * ``'minkowski'`` ➜ The calculation of the distance is given by the expression:
+ $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
+ * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$.
Defaults to **"Euclidean"**.
* **seed** (``Optional[int]``): Seed for random number generation. Defaults to None.
* **use_mst_clustering** (``bool``): Whether to perform MST-based clustering. Defaults to True.
* **kwargs**:
- * **p** (``float``): Parameter for Minkowski distance. Defaults to 2.
+ * **p** (``float``): Parameter for Minkowski distance. Defaults to 2.
**Other initialized variables:**
+
* **_population_antibodies** (``npt.NDArray``): Stores the current set of antibodies.
* **_memory_network** (``dict``): Dictionary mapping clusters to antibodies.
* **_mst_structure** (``scipy.sparse.csr_matrix``): MST adjacency structure.
@@ -109,7 +109,7 @@ Trains the AiNet model on input data:
```python
def fit(self, X: npt.NDArray, verbose: bool = True):
-````
+```
**Input parameters:**
@@ -165,7 +165,7 @@ Initializes antibody population randomly.
```python
def _init_population_antibodies(self) -> npt.NDArray:
-````
+```
**Returns:** Initialized antibodies (`npt.NDArray`).
@@ -302,12 +302,14 @@ def _build_mst(self):
---
-# References
+## References
-##### 1
+### 1
+>
> De Castro, Leandro & José, Fernando & von Zuben, Antonio Augusto. (2001). aiNet: An Artificial Immune Network for Data Analysis.
-> Available at: [https://www.researchgate.net/publication/228378350_aiNet_An_Artificial_Immune_Network_for_Data_Analysis](https://www.researchgate.net/publication/228378350_aiNet_An_Artificial_Immune_Network_for_Data_Analysis)
+> Available at: [https://www.researchgate.net/publication/228378350_aiNet_An_Artificial_Immune_Network_for_Data_Analysis](https://www.researchgate.net/publication/228378350_aiNet_An_Artificial_Immune_Network_for_Data_Analysis)
-##### 2
+### 2
+>
> SciPy Documentation. *Minimum Spanning Tree*.
-> Available at: [https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree)
\ No newline at end of file
+> Available at: [https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree)
diff --git a/versioned_docs/version-0.3.x/aisp-techniques/immune-network-theory/README.mdx b/versioned_docs/version-0.3.x/aisp-techniques/immune-network-theory/README.mdx
index 76ad1ad2..148e0fbe 100644
--- a/versioned_docs/version-0.3.x/aisp-techniques/immune-network-theory/README.mdx
+++ b/versioned_docs/version-0.3.x/aisp-techniques/immune-network-theory/README.mdx
@@ -31,9 +31,9 @@ The Artificial Immune Network can be applied in different contexts, such as:
-# References
+## References
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
+### 1
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
diff --git a/versioned_docs/version-0.3.x/aisp-techniques/negative-selection/BNSA.md b/versioned_docs/version-0.3.x/aisp-techniques/negative-selection/BNSA.md
index 6a2ca342..3a4e0e0b 100644
--- a/versioned_docs/version-0.3.x/aisp-techniques/negative-selection/BNSA.md
+++ b/versioned_docs/version-0.3.x/aisp-techniques/negative-selection/BNSA.md
@@ -1,6 +1,5 @@
---
id: bnsa
-title: BNSA
sidebar_label: BNSA - Binary Negative Selection Algorithm
sidebar_position: 2
pagination_next: null
@@ -24,7 +23,7 @@ last_update:
# BNSA (Binary Negative Selection Algorithm)
-## Constructor RNSA:
+## Constructor RNSA
The ``BNSA`` (Binary Negative Selection Algorithm) class has the purpose of classifying and identifying anomalies through the self and not self methods.
@@ -45,6 +44,7 @@ class BNSA(
* *N* (``int``): Number of detectors. Defaults to ``100``.
* *aff_thresh* (``float``): The variable ('affinity threshold') represents the percentage of dissimilarity between the T cell and the own samples. The default value is 10% (0.1), while a value of 1.0 represents 100% dissimilarity.
+
:::note
Setting the difference percentage too high can result in the inability to generate detectors for non-self.
:::
@@ -53,8 +53,8 @@ Setting the difference percentage too high can result in the inability to genera
possible infinite loop if a radius is defined that it is not possible to generate non-self detectors. Defaults to ``1000``.
* *seed* (``int``): Seed for the random generation of values in the detectors. Defaults to ``None``.
* no_label_sample_selection (``str``): Method for selecting labels for samples designated as non-members by all non-member detectors. **Available method types:**
- - (``max_average_difference``): Selects the class with the highest average difference among the detectors.
- - (``max_nearest_difference``): Selects the class with the highest difference between the nearest and farthest detector from the sample.
+ * (``max_average_difference``): Selects the class with the highest average difference among the detectors.
+ * (``max_nearest_difference``): Selects the class with the highest difference between the nearest and farthest detector from the sample.
**Other variables initiated:**
@@ -62,10 +62,8 @@ possible infinite loop if a radius is defined that it is not possible to generat
* *classes* (``npt.NDArray``): list of output classes.
-
---
-
### Function fit(...)
The ``fit(...)`` function generates the detectors for non-fits with respect to the samples:
@@ -76,8 +74,9 @@ def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
In it, training is performed according to ``X`` and ``y``, using the negative selection method(``NegativeSelect``).
-**The input parameters are:**
-* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
+**The input parameters are:**
+
+* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
* ``y``: array with the output classes arranged in **N** samples that are related to ``X``.
@@ -95,10 +94,12 @@ The ``predict(...)`` function performs class prediction using the generated dete
def predict(self, X: npt.NDArray) -> npt.NDArray:
```
-**The input parameter is:**
+**The input parameter is:**
+
* ``X``: array with the characteristics for the prediction, with **N** samples (Rows) and **N** columns.
-**Returns:**
+**Returns:**
+
* ``C``: prediction array, with the output classes for the given characteristics.
* ``None``: if there are no detectors.
@@ -128,8 +129,9 @@ The function ``__assign_class_to_non_self_sample(...)``, determines the class of
def __assign_class_to_non_self_sample(self, line: npt.NDArray, c: list):
```
-**The input parameter is:**
+**The input parameter is:**
+
* ***line*** (``npt.NDArray``): Sample to be classified.
* ***c*** (``list``): List of predictions to be updated with the new classification.
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.3.x/aisp-techniques/negative-selection/README.md b/versioned_docs/version-0.3.x/aisp-techniques/negative-selection/README.md
index 325d8e55..be74a482 100644
--- a/versioned_docs/version-0.3.x/aisp-techniques/negative-selection/README.md
+++ b/versioned_docs/version-0.3.x/aisp-techniques/negative-selection/README.md
@@ -6,30 +6,37 @@ sidebar_position: 1
**Negative selection** is the process in which the immune system maturates T-cells, also known as T-lymphocytes, which make them capable of detecting non-self. Thus, the Negative Selection Algorithm (NSA) uses hyperspheres symbolizing the detectors in an N-dimensional data space. [[1]](#1)
-# classes
+## classes
> 1. **[Binary version:](BNSA.md)**
+>
>> The binary algorithm adapted for multiple classes in this project is based on the version proposed by [Forrest et al. (1994)](#2), originally developed for computer security.
>>> **Example:**
->>> + [Mushrooms Database](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/BNSA/mushrooms_dataBase_example_en.ipynb)
+>>>
+>>> + [Mushrooms Database](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/BNSA/mushrooms_dataBase_example_en.ipynb)
> 2. **[Real-Valued version:](RNSA.md)**
+>
>>This algorithm has two different versions: one based on the canonical version [[1]](#1) and another with variable radius detectors [[3]](#3). Both are adapted to work with multiple classes and have methods for predicting data present in the non-self region of all detectors and classes.
>>> **Examples:**
->>> + [Iris Database](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/iris_dataBase_example_en.ipynb)
->>> + [Geyser Database](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/geyser_dataBase_example_en.ipynb)
+>>>
+>>> + [Iris Database](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/iris_dataBase_example_en.ipynb)
+>>> + [Geyser Database](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/geyser_dataBase_example_en.ipynb)
-# References
+## References
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
+### 1
+>
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
-##### 2
-> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: http://dx.doi.org/10.1109/RISP.1994.296580.
+### 2
+>
+> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: [https://dx.doi.org/10.1109/RISP.1994.296580](https://dx.doi.org/10.1109/RISP.1994.296580).
-##### 3
-> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: http://dx.doi.org/10.1007/978-3-540-24854-5_30.
+### 3
+>
+> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: [https://dx.doi.org/10.1007/978-3-540-24854-5_30](https://dx.doi.org/10.1007/978-3-540-24854-5_30).
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.3.x/aisp-techniques/negative-selection/RNSA.md b/versioned_docs/version-0.3.x/aisp-techniques/negative-selection/RNSA.md
index 37444177..1787b8ea 100644
--- a/versioned_docs/version-0.3.x/aisp-techniques/negative-selection/RNSA.md
+++ b/versioned_docs/version-0.3.x/aisp-techniques/negative-selection/RNSA.md
@@ -1,6 +1,5 @@
---
id: rnsa
-title: RNSA
sidebar_label: RNSA - Real-Valued Negative Selection Algorithm
sidebar_position: 1
keywords:
@@ -21,7 +20,7 @@ last_update:
# RNSA (Real-Valued Negative Selection Algorithm)
-## Constructor RNSA:
+## Constructor RNSA
The ``RNSA`` (Real-Valued Negative Selection Algorithm) class has the purpose of classifying and identifying anomalies through the self and not self methods.
@@ -44,6 +43,7 @@ class RNSA(
* *N* (``int``): Number of detectors. Defaults to ``100``.
* *r* (``float``): Radius of the detector. Defaults to ``0.05``.
+
:::note
it is important to consider that setting a very low radius for the detector can significantly reduce the detection rate. On the other hand, a very large radius can make it impossible to incorporate the detector into the search space, which can also compromise detection performance. It is essential to find a balance between the radius size and detection efficiency to achieve the best possible results.
:::
@@ -51,32 +51,31 @@ it is important to consider that setting a very low radius for the detector can
* *k* (``int``): Number of neighbors near the randomly generated detectors to perform the distance average calculation. Defaults to ``1``.
* *metric* (``str``): Way to calculate the distance between the detector and the sample:
- * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression: $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + ... + (Y_{n} - Y_{n})^2}$$.
+ * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression: $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$.
- * ``'minkowski'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + ... |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - X_{1}| + |Y_{2} - Y_{2}| + ... + |Y_{n} - Y_{n}|)$$.
+ * ``'minkowski'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
+ * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$.
Defaults to ``'euclidean'``.
-
* *max_discards* (``int``): This parameter indicates the maximum number of consecutive detector discards, aimed at preventing a possible infinite loop in case a radius is defined that cannot generate non-self detectors. Defaults to ``1000``.
* *seed* (``int``): Seed for the random generation of values in the detectors. Defaults to ``None``.
* *algorithm* (``str``), Set the algorithm version:
- * ``'default-NSA'``: Default algorithm with fixed radius.
- * ``'V-detector'``: This algorithm is based on the article "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", by Ji, Z., Dasgupta, D. (2004), and uses a variable radius for anomaly detection in feature spaces.
+ * ``'default-NSA'``: Default algorithm with fixed radius.
+ * ``'V-detector'``: This algorithm is based on the article "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", by Ji, Z., Dasgupta, D. (2004), and uses a variable radius for anomaly detection in feature spaces.
Defaults to ``'default-NSA'``.
* *r_s* (``float``): rₛ Radius of the ``X`` own samples.
-- ``**kwargs``:
- - *non_self_label* (``str``): This variable stores the label that will be assigned when the data has only one
+
+* ``**kwargs``:
+ * *non_self_label* (``str``): This variable stores the label that will be assigned when the data has only one
output class, and the sample is classified as not belonging to that class. Defaults to ``'non-self'``.
- - *cell_bounds* (``bool``): If set to ``True``, this option limits the generation of detectors to the space within the plane between 0 and 1. This means that any detector whose radius exceeds this limit is discarded, this variable is only used in the ``V-detector`` algorithm.
- - p (``float``): This parameter stores the value of ``p`` used in the Minkowski distance. The default is ``2``, which represents normalized Euclidean distance. Different values of p lead to different variants of the Minkowski
+ * *cell_bounds* (``bool``): If set to ``True``, this option limits the generation of detectors to the space within the plane between 0 and 1. This means that any detector whose radius exceeds this limit is discarded, this variable is only used in the ``V-detector`` algorithm.
+ * p (``float``): This parameter stores the value of ``p`` used in the Minkowski distance. The default is ``2``, which represents normalized Euclidean distance. Different values of p lead to different variants of the Minkowski
distance [learn more](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
-
**Other variables initiated:**
@@ -96,8 +95,9 @@ def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
In it, training is performed according to ``X`` and ``y``, using the negative selection method(``NegativeSelect``).
-The input parameters are:
-* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
+The input parameters are:
+
+* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
* ``y``: array with the output classes arranged in **N** samples that are related to ``X``.
@@ -115,10 +115,12 @@ The ``predict(...)`` function performs class prediction using the generated dete
def predict(self, X: npt.NDArray) -> npt.NDArray:
```
-**The input parameter is:**
+**The input parameter is:**
+
* ``X``: array with the characteristics for the prediction, with **N** samples (Rows) and **N** columns.
-**Returns:**
+**Returns:**
+
* ``C``: prediction array, with the output classes for the given characteristics.
* ``None``: if there are no detectors.
@@ -149,12 +151,13 @@ def __checks_valid_detector(self, X: npt.NDArray, vector_x: npt.NDArray, samples
```
**The input parameters are:**
+
* ``X``: array with sample characteristics with **N** samples (rows) and **N** characteristics (columns), normalized to values between [0, 1].
* ``vector_x``: Randomly generated candidate detector.
* ``samplesIndexClass``: Array with the indexes of a class.
-
+
**Returns:** ``True`` for detectors that do not have samples inside or ``False`` if they do.
---
@@ -179,9 +182,11 @@ In this function, when there is class ambiguity, it returns the class that has t
```python
def __compare_sample_to_detectors(self, line):
```
+
**The input parameters are:**
+
* line: vector with N-features
-
+
**Returns:** The predicted class with the detectors or None if the sample does not qualify for any class.
---
@@ -193,13 +198,14 @@ Check if the distance between the detector and the samples, minus the radius of
```python
def __detector_is_valid_to_Vdetector(self, distance, vector_x):
```
-
+
**The input parameters are:**
* distance (``float``): minimum distance calculated between all samples.
* vector_x (``numpy.ndarray``): randomly generated candidate detector vector x with values between 0 and 1.
-**Returns:**
+**Returns:**
+
* ``False``: if the calculated radius is smaller than the minimum distance or exceeds the edge of the space, if this option is enabled.
* ``True`` and the distance minus the radius of the samples, if the radius is valid.`
@@ -218,4 +224,3 @@ The input parameters are ``u`` and ``v`` NDArrays, with the coordinates for the
**Returns:** the distance (``double``) between the two points.
---
-
diff --git a/versioned_docs/version-0.3.x/examples/Classification/csa.md b/versioned_docs/version-0.3.x/examples/Classification/csa.md
index 138193d6..aba99717 100644
--- a/versioned_docs/version-0.3.x/examples/Classification/csa.md
+++ b/versioned_docs/version-0.3.x/examples/Classification/csa.md
@@ -27,30 +27,34 @@ keywords:
- immune recognition
---
-# Clonal Selection Algorithm
-
This page presents a collection of practical examples showcasing how to use the Clonal Selection Algorithm.
## AIRS (Artificial Immune Recognition System)
-
Run notebooks online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclassification%2FAIRS)
---
### Binary Algorithm
-+ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/example_with_randomly_generated_dataset-en.ipynb)
++ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/example_with_randomly_generated_dataset-en.ipynb)
+
> In the example present in this notebook 1000 random samples were generated, arranged in two groups, one for each class.
+ [mushrooms_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/mushrooms_dataBase_example_en.ipynb)
-> It uses the [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), which contains information about edible and poisonous mushrooms.
+
+> It uses the [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), which contains information about edible and poisonous mushrooms.
### Real-Valued Algorithm
-+ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/example_with_randomly_generated_dataset-en.ipynb)
++ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/example_with_randomly_generated_dataset-en.ipynb)
+
> In the example present in this notebook 500 random samples were generated, arranged in two groups, one for each class, we can see the non-self detectors generated below
+
+ [iris_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/iris_dataBase_example_en.ipynb)
+
> Example using the NSA [iris database](https://archive.ics.uci.edu/ml/datasets/iris), which contains four-dimensional samples and three output classes (Setosa, Versicolor and Virginica).
+
+ [geyser_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/geyser_dataBase_example_en.ipynb)
-> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
\ No newline at end of file
+
+> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/versioned_docs/version-0.3.x/examples/Classification/nsa.md b/versioned_docs/version-0.3.x/examples/Classification/nsa.md
index bbafa10a..89981dd5 100644
--- a/versioned_docs/version-0.3.x/examples/Classification/nsa.md
+++ b/versioned_docs/version-0.3.x/examples/Classification/nsa.md
@@ -33,21 +33,28 @@ Run notebooks online via Binder: [
---
-+ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/BNSA/example_with_randomly_generated_dataset-en.ipynb)
++ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/BNSA/example_with_randomly_generated_dataset-en.ipynb)
+
> In the example present in this notebook 1000 random samples were generated, arranged in two groups, one for each class.
+ [mushrooms_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/BNSA/mushrooms_dataBase_example_en.ipynb)
-> It uses the [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), which contains information about edible and poisonous mushrooms.
-# RNSA (Real-Valued Negative Selection Algorithm)
+> It uses the [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), which contains information about edible and poisonous mushrooms.
+
+## RNSA (Real-Valued Negative Selection Algorithm)
Run notebooks online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclassification%2FRNSA)
---
-+ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/example_with_randomly_generated_dataset-en.ipynb)
++ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/example_with_randomly_generated_dataset-en.ipynb)
+
> In the example present in this notebook 500 random samples were generated, arranged in two groups, one for each class, we can see the non-self detectors generated below
+
+ [iris_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/iris_dataBase_example_en.ipynb)
+
> Example using the NSA [iris database](https://archive.ics.uci.edu/ml/datasets/iris), which contains four-dimensional samples and three output classes (Setosa, Versicolor and Virginica).
+
+ [geyser_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/geyser_dataBase_example_en.ipynb)
-> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
\ No newline at end of file
+
+> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/versioned_docs/version-0.3.x/examples/Clustering/ina.md b/versioned_docs/version-0.3.x/examples/Clustering/ina.md
index 7e98acdd..26ef03c8 100644
--- a/versioned_docs/version-0.3.x/examples/Clustering/ina.md
+++ b/versioned_docs/version-0.3.x/examples/Clustering/ina.md
@@ -18,23 +18,22 @@ keywords:
- geyser dataset
---
-# Immune Network Algorithms
-
On this page, you will find a collection of practical examples that demonstrate how to use the Immune Network Algorithm classes implemented in our package.
-
Run notebooks online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclustering%2FAiNet)
## AiNet (Artificial Immune Network)
-
---
+ [Random datasets](https://github.com/AIS-Package/aisp/blob/main/examples/en/clustering/AiNet/example_with_randomly_generated_dataset.ipynb)
+
> In this notebook AiNet is demonstrated on three synthetic datasets:
-> - **Blobs:** well-defined spherical clusters, easy to separate.
-> - **Moons:** non-linear clusters, illustrating more complex decision boundaries.
-> - **Circles:** two concentric circles, showing the capability of handling non-linear separation.
+>
+> + **Blobs:** well-defined spherical clusters, easy to separate.
+> + **Moons:** non-linear clusters, illustrating more complex decision boundaries.
+> + **Circles:** two concentric circles, showing the capability of handling non-linear separation.
+ [geyser_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/clustering/AiNet/geyser_dataBase_example.ipynb)
-> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
\ No newline at end of file
+
+> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/versioned_docs/version-0.3.x/getting-started/basic-use/AIRS.md b/versioned_docs/version-0.3.x/getting-started/basic-use/AIRS.md
index b748b6f7..660c15e4 100644
--- a/versioned_docs/version-0.3.x/getting-started/basic-use/AIRS.md
+++ b/versioned_docs/version-0.3.x/getting-started/basic-use/AIRS.md
@@ -31,12 +31,13 @@ Access the Jupyter notebook with the code available [here](https://github.com/AI
Run notebook online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclassification%2FAIRS%2Fexample_with_randomly_generated_dataset-en.ipynb)
-### Importing the Artificial Immune Recognition System
+## Importing the Artificial Immune Recognition System
+
```python
from aisp.csa import AIRS
```
-### Generating dice bubbles for classes randomly.
+## Generating dice bubbles for classes randomly
Using the `make_blobs` function, two sets of data are generated in the form of bubbles, in the range between 0 and 1, representing each class x and y. Then this data is separated into test and training sets.
@@ -52,7 +53,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-### Testing the model AIRS:
+## Testing the model AIRS
Then, it presents the result of the forecast accuracy.
@@ -71,6 +72,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```bash
✔ Set of memory cells for classes (0, 1) successfully generated: ┇██████████┇ 400/400 memory cells for each aᵢ
The accuracy is 1.0
@@ -86,6 +88,6 @@ weighted avg 1.00 1.00 1.00 100
---
-### Memory cell and sample plotting:
+## Memory cell and sample plotting
-
\ No newline at end of file
+
diff --git a/versioned_docs/version-0.3.x/getting-started/basic-use/AiNet.mdx b/versioned_docs/version-0.3.x/getting-started/basic-use/AiNet.mdx
index a633063a..b770c3ea 100644
--- a/versioned_docs/version-0.3.x/getting-started/basic-use/AiNet.mdx
+++ b/versioned_docs/version-0.3.x/getting-started/basic-use/AiNet.mdx
@@ -263,4 +263,4 @@ Silhouette Coefficient: 0.112
plot_immune_network(samples, predict_y, model, title_prefix="Circles - ")
```
-
+
diff --git a/versioned_docs/version-0.3.x/getting-started/basic-use/BNSA.md b/versioned_docs/version-0.3.x/getting-started/basic-use/BNSA.md
index 0605f25d..4b58e8f7 100644
--- a/versioned_docs/version-0.3.x/getting-started/basic-use/BNSA.md
+++ b/versioned_docs/version-0.3.x/getting-started/basic-use/BNSA.md
@@ -27,12 +27,12 @@ Access the Jupyter notebook with the code available [here](https://github.com/AI
Run notebook online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclassification%2FBNSA%2Fexample_with_randomly_generated_dataset-en.ipynb)
-
## Importing the BNSA algorithm
```python
from aisp.nsa import BNSA
```
+
## Generating samples
Algorithm training and testing needs data samples. Thus, for the demonstration, two random classes were generated, using the following function:
@@ -104,6 +104,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```
✔ Non-self detectors for classes (x, y) successfully generated: ┇██████████┇ 500/500 detectors
The accuracy is 0.93
@@ -132,4 +133,4 @@ plt.ylabel('Estimated')
plt.show()
```
-
\ No newline at end of file
+
diff --git a/versioned_docs/version-0.3.x/getting-started/basic-use/RNSA.md b/versioned_docs/version-0.3.x/getting-started/basic-use/RNSA.md
index 2e4dad0f..489a05cc 100644
--- a/versioned_docs/version-0.3.x/getting-started/basic-use/RNSA.md
+++ b/versioned_docs/version-0.3.x/getting-started/basic-use/RNSA.md
@@ -23,15 +23,15 @@ keywords:
Access the Jupyter notebook with the code available [here](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/example_with_randomly_generated_dataset-en.ipynb)!
-
Run notebook online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclassification%2FRNSA%2Fexample_with_randomly_generated_dataset-en.ipynb)
-### Importing the Real-Valued Negative Selection Algorithm.
+## Importing the Real-Valued Negative Selection Algorithm
+
```python
from aisp.nsa import RNSA
```
-### Generating dice bubbles for classes randomly.
+## Generating dice bubbles for classes randomly
Using the `make_blobs` function, two sets of data are generated in the form of bubbles, in the range between 0 and 1, representing each class x and y. Then this data is separated into test and training sets.
@@ -47,7 +47,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-### Testing the model `default-NSA`:
+## Testing the model `default-NSA`
Start the model with 500 detectors, each with a radius of 0.06. Then, it presents the result of the forecast accuracy.
@@ -66,6 +66,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```bash
✔ Non-self detectors for classes (0, 1) successfully generated: ┇██████████┇ 1000/1000 detectors
The accuracy is 1.0
@@ -81,13 +82,13 @@ weighted avg 1.00 1.00 1.00 100
---
-### Detector and sample plotting:
+## Detector and sample plotting
-
+
---
-### Testing the model `V-detector`:
+## Testing the model `V-detector`
Start the model with 50 detectors, where the minimum radius is 0.05 and the sample's own radius is 0.04. It then shows the forecast accuracy result.
@@ -106,6 +107,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```bash
✔ Non-self detectors for classes (0, 1) successfully generated: ┇██████████┇ 40/40 detectors
The accuracy is 1.0
@@ -121,5 +123,6 @@ weighted avg 1.00 1.00 1.00 100
---
-### Detector and sample plotting:
-
\ No newline at end of file
+## V-Detector and sample plotting
+
+
diff --git a/versioned_docs/version-0.3.x/getting-started/instalation.md b/versioned_docs/version-0.3.x/getting-started/instalation.md
index 88dbed58..bbe5c9cd 100644
--- a/versioned_docs/version-0.3.x/getting-started/instalation.md
+++ b/versioned_docs/version-0.3.x/getting-started/instalation.md
@@ -28,7 +28,7 @@ The package requires [python 3.10](https://www.python.org/downloads/) or higher.
-## **Instalation procedure**
+## **Installation procedure**
The simplest way to install is via ``pip``:
@@ -43,4 +43,3 @@ from aisp.nsa import RNSA, BNSA
nsa = RNSA(N=300, r=0.05)
```
-
diff --git a/versioned_docs/version-0.3.x/intro.md b/versioned_docs/version-0.3.x/intro.md
index 0f446c3a..178a8f7d 100644
--- a/versioned_docs/version-0.3.x/intro.md
+++ b/versioned_docs/version-0.3.x/intro.md
@@ -20,11 +20,11 @@ keywords:
- Bioinspiration
- Immune Metaphors
---
-# Artificial Immune Systems Package.
+# Artificial Immune Systems Package
-
+
@@ -34,9 +34,9 @@ keywords:
**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).
-### Algorithms implemented:
+### Algorithms implemented
-> - [x] [**Negative Selection.**](/docs/aisp-techniques/negative-selection/)
-> - [x] [**Clonal Selection Algorithms.**](/docs/aisp-techniques/clonal-selection-algorithms/)
-> - [x] [**Immune Network Theory.**](/docs/aisp-techniques/immune-network-theory/)
+> - [x] [**Negative Selection.**](./aisp-techniques/negative-selection/)
+> - [x] [**Clonal Selection Algorithms.**](./aisp-techniques/clonal-selection-algorithms/)
+> - [x] [**Immune Network Theory.**](./aisp-techniques/immune-network-theory/)
> - [ ] *Danger Theory*
diff --git a/versioned_docs/version-0.4.x/about-us.mdx b/versioned_docs/version-0.4.x/about-us.mdx
index 81059da4..0d837149 100644
--- a/versioned_docs/version-0.4.x/about-us.mdx
+++ b/versioned_docs/version-0.4.x/about-us.mdx
@@ -28,7 +28,7 @@ The AISP, or Artificial Immune Systems Package, had its origins in a research pr
name='Alison Zille Lopes'
date='2022'
githubUrl='https://github.com/alisonzille'
- lattesUrl='http://lattes.cnpq.br/3294097090760981'
+ lattesUrl='https://lattes.cnpq.br/3294097090760981'
/>
@@ -44,7 +44,7 @@ The AISP, or Artificial Immune Systems Package, had its origins in a research pr
date='2022-2023'
description="I was tasked with implementing version 0.1, which features the BNSA and RNSA negative selection classes, including fixed and variable radius versions."
githubUrl='https://github.com/Joao-Paulo-Silva'
- lattesUrl='http://lattes.cnpq.br/2561057724411407'
+ lattesUrl='https://lattes.cnpq.br/2561057724411407'
/>
\ No newline at end of file
diff --git a/versioned_docs/version-0.4.x/advanced-guides/Core/negative-selection.md b/versioned_docs/version-0.4.x/advanced-guides/Core/negative-selection.md
index e5b80d60..a85f9771 100644
--- a/versioned_docs/version-0.4.x/advanced-guides/Core/negative-selection.md
+++ b/versioned_docs/version-0.4.x/advanced-guides/Core/negative-selection.md
@@ -8,7 +8,7 @@ last_update:
The functions perform detector checks and utilize Numba decorators for Just-In-Time compilation
-### Function check_detector_bnsa_validity(...):
+## Function check_detector_bnsa_validity(...)
```python
def check_detector_bnsa_validity(
@@ -20,18 +20,19 @@ def check_detector_bnsa_validity(
Checks the validity of a candidate detector (vector_x) against samples from a class (x_class) using the Hamming distance. A detector is considered INVALID if its distance to any sample in ``x_class`` is less than or equal to ``aff_thresh``.
-
**Parameters**:
+
* x_class (``npt.NDArray``): Array containing the class samples. Expected shape: (n_samples, n_features).
* vector_x (``npt.NDArray``): Array representing the detector. Expected shape: (n_features,).
* aff_thresh (``float``): Affinity threshold.
**returns**:
+
* True if the detector is valid, False otherwise.
---
-### Function bnsa_class_prediction(...):
+## Function bnsa_class_prediction(...)
```python
def bnsa_class_prediction(
@@ -40,21 +41,23 @@ def bnsa_class_prediction(
aff_thresh: float
) -> int:
```
-Defines the class of a sample from the non-self detectors.
+Defines the class of a sample from the non-self detectors.
**Parameters**:
+
* features (``npt.NDArray``): binary sample to be classified (shape: [n_features]).
* class_detectors (``npt.NDArray``): Array containing the detectors of all classes
(shape: [n_classes, n_detectors, n_features]).
* aff_thresh (``float``): Affinity threshold that determines whether a detector recognizes the sample as non-self.
**returns**:
+
* int: Index of the predicted class. Returns -1 if it is non-self for all classes.
---
-### Function check_detector_rnsa_validity(...):
+## Function check_detector_rnsa_validity(...)
```python
def check_detector_rnsa_validity(
@@ -65,9 +68,11 @@ def check_detector_rnsa_validity(
p: float
) -> bool:
```
+
Checks the validity of a candidate detector (vector_x) against samples from a class (x_class) using the Hamming distance. A detector is considered INVALID if its distance to any sample in ``x_class`` is less than or equal to ``aff_thresh``.
**Parameters**:
+
* x_class (``npt.NDArray``): Array containing the class samples. Expected shape: (n_samples, n_features).
* vector_x (``npt.NDArray``): Array representing the detector. Expected shape: (n_features,).
* threshold (``float``): threshold.
@@ -75,6 +80,7 @@ Checks the validity of a candidate detector (vector_x) against samples from a cl
* p (``float``): Parameter for the Minkowski distance (used only if `metric` is "minkowski").
**returns**:
+
* int: Index of the predicted class. Returns -1 if it is non-self for all classes.
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.4.x/advanced-guides/Utils/Display.md b/versioned_docs/version-0.4.x/advanced-guides/Utils/Display.md
index df7dfba6..51c3bbdb 100644
--- a/versioned_docs/version-0.4.x/advanced-guides/Utils/Display.md
+++ b/versioned_docs/version-0.4.x/advanced-guides/Utils/Display.md
@@ -149,4 +149,4 @@ def finish(self) -> None
End the table display, printing the bottom border and total time.
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.4.x/advanced-guides/Utils/Distance.md b/versioned_docs/version-0.4.x/advanced-guides/Utils/Distance.md
index f3d61352..31981a44 100644
--- a/versioned_docs/version-0.4.x/advanced-guides/Utils/Distance.md
+++ b/versioned_docs/version-0.4.x/advanced-guides/Utils/Distance.md
@@ -15,15 +15,16 @@ def hamming(u: npt.NDArray, v: npt.NDArray) -> np.float64:
```
The function to calculate the normalized Hamming distance between two points.
-
-$((x₁ ≠ x₂) + (y₁ ≠ y₂) + ... + (yn ≠ yn)) / n$
+$$\frac{(x_1 \neq y_1) + (x_2 \neq y_2) + \cdots + (x_n \neq y_n)}{n}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -36,15 +37,15 @@ def euclidean(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64]) -> np.floa
Function to calculate the normalized Euclidean distance between two points.
-$√( (x₁ - x₂)² + (y₁ - y₂)² + ... + (yn - yn)²)$
-
-
+$$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -56,15 +57,16 @@ def cityblock(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64]) -> np.floa
```
Function to calculate the normalized Manhattan distance between two points.
-
-$(|x₁ - x₂| + |y₁ - y₂| + ... + |yn - yn|) / n$
+$$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -76,19 +78,20 @@ def minkowski(u: npt.NDArray[np.float64], v: npt.NDArray[np.float64], p: float =
```
Function to calculate the normalized Minkowski distance between two points.
-
-$(( |X₁ - Y₁|p + |X₂ - Y₂|p + ... + |Xn - Yn|p) ¹/ₚ) / n$
+$$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
* p float: The p parameter defines the type of distance to be calculated:
- - p = 1: **Manhattan** distance — sum of absolute differences.
- - p = 2: **Euclidean** distance — sum of squared differences (square root).
- - p > 2: **Minkowski** distance with an increasing penalty as p increases.
+ * p = 1: **Manhattan** distance — sum of absolute differences.
+ * p = 2: **Euclidean** distance — sum of squared differences (square root).
+ * p > 2: **Minkowski** distance with an increasing penalty as p increases.
**Returns:**
+
* Distance (``float``) between the two points.
---
@@ -107,12 +110,14 @@ def compute_metric_distance(
Function to calculate the distance between two points by the chosen ``metric``.
**Parameters:**
+
* u (``npt.NDArray``): Coordinates of the first point.
* v (``npt.NDArray``): Coordinates of the second point.
* metric (``int``): Distance metric to be used. Available options: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)]
* p (``float``): Parameter for the Minkowski distance (used only if `metric` is "minkowski").
**Returns:**
+
* Distance (``double``) between the two points with the selected metric.
---
@@ -130,14 +135,15 @@ def min_distance_to_class_vectors(
Calculates the minimum distance between an input vector and the vectors of a class.
-
**Parameters:**
+
* x_class (``npt.NDArray``): Array containing the class vectors to be compared with the input vector. Expected shape: (n_samples, n_features).
* vector_x (``npt.NDArray``): Vector to be compared with the class vectors. Expected shape: (n_features,).
* metric (``int``): Distance metric to be used. Available options: [0 (Euclidean), 1 (Manhattan), 2 (Minkowski)]
* p (``float``): Parameter for the Minkowski distance (used only if `metric` is "minkowski").
**Returns:**
+
* float: The minimum distance calculated between the input vector and the class vectors.
* Returns -1.0 if the input dimensions are incompatible.
@@ -148,16 +154,19 @@ Calculates the minimum distance between an input vector and the vectors of a cla
```python
def get_metric_code(metric: str) -> int:
```
+
Returns the numeric code associated with a distance metric.
**Parameters:**
+
* metric (str): Name of the metric. Can be "euclidean", "manhattan", "minkowski" or "hamming".
**Raises**
-----------
+
* ``ValueError``: If the metric provided is not supported
**Returns:**
+
* ``int``: Numeric code corresponding to the metric.
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.4.x/advanced-guides/Utils/Metrics.md b/versioned_docs/version-0.4.x/advanced-guides/Utils/Metrics.md
index c92962b2..33a4004b 100644
--- a/versioned_docs/version-0.4.x/advanced-guides/Utils/Metrics.md
+++ b/versioned_docs/version-0.4.x/advanced-guides/Utils/Metrics.md
@@ -8,7 +8,7 @@ author: João Paulo
The metrics file provides utilities to measure, analyze, and compare the performance of the package's algorithms in a standardized way.
-#### def accuracy_score(...)
+### def accuracy_score(...)
```python
def accuracy_score(
@@ -21,16 +21,19 @@ Function to calculate precision accuracy based on lists of true labels and
predicted labels.
**Parameters**:
+
* **_y_true_** (``Union[npt.NDArray, list]``): Ground truth (correct) labels.
Expected to be of the same length as `y_pred`.
* **_y_pred_** (``Union[npt.NDArray, list]``): Predicted labels. Expected to
be of the same length as `y_true`.
Returns:
+
* **_Accuracy_** (``float``): The ratio of correct predictions to the total
number of predictions.
**Raises**:
+
* `ValueError`: If `y_true` or `y_pred` are empty or if they do not have the same length.
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.4.x/advanced-guides/Utils/Multiclass.md b/versioned_docs/version-0.4.x/advanced-guides/Utils/Multiclass.md
index 772e2373..83c58b1d 100644
--- a/versioned_docs/version-0.4.x/advanced-guides/Utils/Multiclass.md
+++ b/versioned_docs/version-0.4.x/advanced-guides/Utils/Multiclass.md
@@ -19,8 +19,10 @@ according to the output class, to loop through the sample array, only in positio
the output is the class being trained.
**Parameters**:
+
* ***classes*** (``list or npt.NDArray``): list with unique classes.
* ***y*** (npt.NDArray): Receives a ``y``[``N sample``] array with the output classes of the ``X`` sample array.
**returns**:
+
* dict: A dictionary with the list of array positions(``y``), with the classes as key.
diff --git a/versioned_docs/version-0.4.x/advanced-guides/Utils/Sanitizers.md b/versioned_docs/version-0.4.x/advanced-guides/Utils/Sanitizers.md
index a7d113cd..b57a8053 100644
--- a/versioned_docs/version-0.4.x/advanced-guides/Utils/Sanitizers.md
+++ b/versioned_docs/version-0.4.x/advanced-guides/Utils/Sanitizers.md
@@ -14,14 +14,14 @@ def sanitize_choice(value: T, valid_choices: Iterable[T], default: T) -> T
The function ``sanitize_choice(...)``, returns the value if it is present in the set of valid choices; otherwise, returns the default value.
-
**Parameters:**
+
* ***value*** (``T``): The value to be checked.
* ***valid_choices*** (``Iterable[T]``): A collection of valid choices.
* ***default***: The default value to be returned if ``value`` is not in ``valid_choices``.
-
**Returns:**
+
* `T`: The original value if valid, or the default value if not.
---
@@ -35,12 +35,13 @@ def sanitize_param(value: T, default: T, condition: Callable[[T], bool]) -> T:
The function ``sanitize_param(...)``, returns the value if it satisfies the specified condition; otherwise, returns the default value.
**Parameters:**
+
* value (``T``): The value to be checked.
* default (``T``): The default value to be returned if the condition is not satisfied.
* condition (``Callable[[T], bool]``): A function that takes a value and returns a boolean, determining if the value is valid.
-
**Returns:**
+
* `T`: The original value if the condition is satisfied, or the default value if not.
---
@@ -54,9 +55,11 @@ def sanitize_seed(seed: Any) -> Optional[int]:
The function ``sanitize_param(...)``, returns the seed if it is a non-negative integer; otherwise, returns None.
**Parameters:**
+
* seed (``Any``): The seed value to be validated.
**Returns:**
+
* ``Optional[int]``: The original seed if it is a non-negative integer, or ``None`` if it is invalid.
---
@@ -73,10 +76,10 @@ def sanitize_bounds(
The function ``sanitize_bounds(...)``, validate and normalize feature bounds.
**Parameters:**
+
* ***bounds*** (``Any``): he input bounds, which must be either None or a dictionary with 'low' and 'high' keys.
* ***problem_size*** (``int``): The expected length for the normalized bounds lists, corresponding to the number of features in the problem.
-
**Returns:**
-* `Dict[str, list]`: Dictionary ``{'low': [low_1, ..., low_N], 'high': [high_1, ..., high_N]}``.
+* `Dict[str, list]`: Dictionary ``{'low': [low_1, ..., low_N], 'high': [high_1, ..., high_N]}``.
diff --git a/versioned_docs/version-0.4.x/advanced-guides/Utils/Validation.md b/versioned_docs/version-0.4.x/advanced-guides/Utils/Validation.md
index c0e4e944..fdbcb573 100644
--- a/versioned_docs/version-0.4.x/advanced-guides/Utils/Validation.md
+++ b/versioned_docs/version-0.4.x/advanced-guides/Utils/Validation.md
@@ -21,7 +21,9 @@ This function analyzes the input vector and classifies its data as one of the su
* `vector` (`npt.NDArray`): An array containing the data to be classified.
**Returns**
+
* `FeatureType` (`Literal["binary-features", "continuous-features", "ranged-features"]`): The detected type of data in the vector.
**Raises**
-* `UnsupportedDataTypeError`: Raised if the vector contains an unsupported data type.
\ No newline at end of file
+
+* `UnsupportedDataTypeError`: Raised if the vector contains an unsupported data type.
diff --git a/versioned_docs/version-0.4.x/advanced-guides/base-classes-reference/csa/airs.md b/versioned_docs/version-0.4.x/advanced-guides/base-classes-reference/csa/airs.md
index 6bb93a08..f6d5006f 100644
--- a/versioned_docs/version-0.4.x/advanced-guides/base-classes-reference/csa/airs.md
+++ b/versioned_docs/version-0.4.x/advanced-guides/base-classes-reference/csa/airs.md
@@ -26,7 +26,7 @@ therefore are considered essential for the overall functioning of the system.
---
-### def _check_and_raise_exceptions_fit(...):
+### def _check_and_raise_exceptions_fit(...)
Verify the fit parameters and throw exceptions if the verification is not successful.
@@ -41,24 +41,25 @@ def _check_and_raise_exceptions_fit(
):
```
-
**Parameters**:
-* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, [``N samples`` (rows)][``N features`` (columns)].
-* ***y*** (``npt.NDArray``): Array of target classes of ``X`` with [``N samples`` (lines)].
-* ***algorithm*** (``Literal["continuous-features", "binary-features"], optional``): Specifies the type of algorithm to use, depending
+
+* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, \[``N samples`` (rows)\]\[``N features`` (columns)].
+* ***y*** (``npt.NDArray``): Array of target classes of ``X`` with \[``N samples`` (lines)].
+* ***algorithm*** (``Literal["continuous-features", "binary-features"], optional``): Specifies the type of algorithm to use, depending
on whether the input data has continuous or binary features.
**Raises**
+
* `TypeError`:
If X or y are not ndarrays or have incompatible shapes.
* `ValueError`
- If _class_ is BNSA and X contains values that are not composed only of 0 and 1.
+ If *class* is BNSA and X contains values that are not composed only of 0 and 1.
---
-### def _check_and_raise_exceptions_fit(...):
+### def _check_and_raise_exceptions_predict(...)
- Verify the fit parameters and throw exceptions if the verification is not successful.
+ Verify the predict parameters and throw exceptions if the verification is not successful.
```python
@staticmethod
@@ -71,18 +72,20 @@ def _check_and_raise_exceptions_predict(
) -> None:
```
-
**Parameters**:
-* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, [``N samples`` rows)][``N features`` (columns)].
+
+* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, \[``N samples`` (rows)\]\[``N features`` (columns)].
* ***expected*** (``int``): Expected number of features per sample (columns in X).
-* ***algorithm*** (``Literal["continuous-features", "binary-features"], optional``): Specifies the type of algorithm to use, depending
+* ***algorithm*** (``Literal["continuous-features", "binary-features"], optional``): Specifies the type of algorithm to use, depending
on whether the input data has continuous or binary features.
**Raises**
+
* ``TypeError``
If X is not a ndarray or list.
* `FeatureDimensionMismatch`
If the number of features in X does not match the expected number.
* `ValueError`
If algorithm is binary-features and X contains values that are not composed only of 0 and 1.
----
\ No newline at end of file
+
+---
diff --git a/versioned_docs/version-0.4.x/advanced-guides/base-classes-reference/ina/ainet.md b/versioned_docs/version-0.4.x/advanced-guides/base-classes-reference/ina/ainet.md
index 201d6c3b..7a21c8b5 100644
--- a/versioned_docs/version-0.4.x/advanced-guides/base-classes-reference/ina/ainet.md
+++ b/versioned_docs/version-0.4.x/advanced-guides/base-classes-reference/ina/ainet.md
@@ -33,7 +33,7 @@ def _check_and_raise_exceptions_fit(X: npt.NDArray)
**Parameters**:
-* ***X*** (`npt.NDArray`): Training array, containing the samples and their characteristics, \[`N samples` (rows)]\[`N features` (columns)].
+* ***X*** (`npt.NDArray`): Training array, containing the samples and their characteristics, \\[`N samples` (rows)]\\[`N features` (columns)].
**Raises**:
@@ -56,7 +56,7 @@ def _check_and_raise_exceptions_predict(
**Parameters**:
-* ***X*** (`npt.NDArray`): Input array for prediction, containing the samples and their characteristics, \[`N samples` (rows)]\[`N features` (columns)].
+* ***X*** (`npt.NDArray`): Input array for prediction, containing the samples and their characteristics, \\[`N samples` (rows)]\\[`N features` (columns)].
* ***expected*** (`int`, default=0): Expected number of features per sample (columns in X).
* ***feature_type*** (`FeatureType`, default="continuous-features"): Specifies the type of features: "continuous-features", "binary-features", or "ranged-features".
diff --git a/versioned_docs/version-0.4.x/advanced-guides/base-classes-reference/nsa.md b/versioned_docs/version-0.4.x/advanced-guides/base-classes-reference/nsa.md
index 3317e175..021c4575 100644
--- a/versioned_docs/version-0.4.x/advanced-guides/base-classes-reference/nsa.md
+++ b/versioned_docs/version-0.4.x/advanced-guides/base-classes-reference/nsa.md
@@ -23,11 +23,12 @@ keywords:
The ``BaseNSA`` class contains utility functions with the ``protected`` modifier that can be inherited by various classes for ease of use. It includes functions for distance calculation, data separation to improve training and prediction efficiency, accuracy measurement and other functions.
-### Protected Functions:
+### Protected Functions
---
-#### Function _check_and_raise_exceptions_fit(...):
+#### Function _check_and_raise_exceptions_fit(...)
+
```python
def _check_and_raise_exceptions_fit(
X: npt.NDArray = None,
@@ -35,20 +36,24 @@ def _check_and_raise_exceptions_fit(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Function responsible for verifying fit function parameters and throwing exceptions if the verification is not successful.
**Parameters**:
-* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, [``N samples`` (rows)][``N features`` (columns)].
-* ***y*** (``npt.NDArray``): Array of target classes of ``X`` with [``N samples`` (lines)].
-* ***_class_*** (Literal[RNSA, BNSA], optional): Current class. Defaults to 'RNSA'.
+
+* ***X*** (``npt.NDArray``): Training array, containing the samples and their characteristics, \[``N samples`` (rows)\]\[``N features`` (columns)].
+* ***y*** (``npt.NDArray``): Array of target classes of ``X`` with \[``N samples`` (lines)].
+* ****class**** (Literal[RNSA, BNSA], optional): Current class. Defaults to 'RNSA'.
**Raises**
+
* ``TypeError``: If X or y are not ndarrays or have incompatible shapes.
-* ``ValueError``: If _class_ is BNSA and X contains values that are not composed only of 0 and 1.
+* ``ValueError``: If *class* is BNSA and X contains values that are not composed only of 0 and 1.
---
-#### Function _check_and_raise_exceptions_predict(...):
+#### Function _check_and_raise_exceptions_predict(...)
+
```python
def _check_and_raise_exceptions_predict(
X: npt.NDArray = None,
@@ -56,17 +61,20 @@ def _check_and_raise_exceptions_predict(
_class_: Literal["RNSA", "BNSA"] = "RNSA",
) -> None:
```
+
Function responsible for verifying predict function parameters and throwing exceptions if the verification is not successful.
**Parameters**:
-* ***X*** (``npt.NDArray``): Input array for prediction, containing the samples and their characteristics, [``N samples`` (rows)][``N features`` (columns)].
+
+* ***X*** (``npt.NDArray``): Input array for prediction, containing the samples and their characteristics, \[``N samples`` (rows)\]\[``N features`` (columns)].
* ***expected*** (``int``): Expected number of features per sample (columns in X).
-* _class_ (``Literal[RNSA, BNSA], optional``): Current class. Defaults to 'RNSA'.
+* *class* (``Literal[RNSA, BNSA], optional``): Current class. Defaults to 'RNSA'.
**Raises**
+
* ``TypeError``: If X is not an ndarray or list.
* ``FeatureDimensionMismatch``: If the number of features in X does not match the expected number.
-* ``ValueError``: If _class_ is BNSA and X contains values that are not composed only of 0 and 1.
+* ``ValueError``: If *class* is BNSA and X contains values that are not composed only of 0 and 1.
---
@@ -77,4 +85,4 @@ Represents a non-self detector of the RNSA class.
**Attributes:**
* ***position*** (``np.ndarray``): Detector feature vector.
-* ***radius*** (``float, optional``): Detector radius, used in the V-detector algorithm.
\ No newline at end of file
+* ***radius*** (``float, optional``): Detector radius, used in the V-detector algorithm.
diff --git a/versioned_docs/version-0.4.x/advanced-guides/base-module/Classifier.md b/versioned_docs/version-0.4.x/advanced-guides/base-module/Classifier.md
index 9b1e1ada..697cd21b 100644
--- a/versioned_docs/version-0.4.x/advanced-guides/base-module/Classifier.md
+++ b/versioned_docs/version-0.4.x/advanced-guides/base-module/Classifier.md
@@ -21,13 +21,12 @@ keywords:
- BNSA
---
-## ``class BaseClassifier(ABC, Base)``:
+## ``class BaseClassifier(ABC, Base)``
Base class for classification algorithms, defining the abstract methods ``fit`` and ``predict``, and implementing the ``get_params`` method.
## Abstract methods
-
### def fit(...)
```python
@@ -38,11 +37,9 @@ Fit the model to the training data.
Implementation:
-- [RNSA](/docs/aisp-techniques/negative-selection/rnsa#Function-fit)
-- [BNSA](/docs/aisp-techniques/negative-selection/bnsa#Function-fit)
-- [AIRS](/docs/aisp-techniques/clonal-selection-algorithms/airs/#Function-fit)
-
-
+- [RNSA](../../aisp-techniques/negative-selection/RNSA.md#Function-fit)
+- [BNSA](../../aisp-techniques/negative-selection/BNSA.md#Function-fit)
+- [AIRS](../../aisp-techniques/clonal-selection-algorithms/airs/#Function-fit)
### def predict(...)
@@ -54,35 +51,35 @@ Performs label prediction for the given data.
Implementation:
-- [RNSA](/docs/aisp-techniques/negative-selection/rnsa#Function-predict)
-- [BNSA](/docs/aisp-techniques/negative-selection/bnsa#Function-predict)
-- [AIRS](/docs/aisp-techniques/clonal-selection-algorithms/airs/#Function-predict)
+- [RNSA](../../aisp-techniques/negative-selection/RNSA.md#Function-predict)
+- [BNSA](../../aisp-techniques/negative-selection/BNSA.md#Function-predict)
+- [AIRS](../../aisp-techniques/clonal-selection-algorithms/airs/#Function-predict)
---
## Methods
-
### def score(...)
```python
def score(self, X: npt.NDArray, y: list) -> float
```
+
Score function calculates forecast accuracy.
-This function performs the prediction of X and checks how many elements are equal between vector y and y_predicted.
+This function performs the prediction of X and checks how many elements are equal between vector y and y_predicted.
This function was added for compatibility with some scikit-learn functions.
**Parameters**:
-+ ***X***: ``np.ndarray``
+
+- ***X***: ``np.ndarray``
Feature set with shape (n_samples, n_features).
-+ ***y***: ``np.ndarray``
+- ***y***: ``np.ndarray``
True values with shape (n_samples,).
**Returns**:
-+ accuracy: ``float`` The accuracy of the model.
-
+- accuracy: ``float`` The accuracy of the model.
### Function _slice_index_list_by_class(...)
@@ -93,4 +90,3 @@ def __slice_index_list_by_class(self, y: npt.NDArray) -> dict:
```
Returns a dictionary with the classes as key and the indices in ``X`` of the samples.
-
diff --git a/versioned_docs/version-0.4.x/advanced-guides/base-module/Clusterer.md b/versioned_docs/version-0.4.x/advanced-guides/base-module/Clusterer.md
index 68487813..565b9c96 100644
--- a/versioned_docs/version-0.4.x/advanced-guides/base-module/Clusterer.md
+++ b/versioned_docs/version-0.4.x/advanced-guides/base-module/Clusterer.md
@@ -52,7 +52,7 @@ This abstract method must be implemented by subclasses.
**Implementation**:
-* [AiNet](/docs/aisp-techniques/immune-network-theory/ainet#Function-fit)
+* [AiNet](../../aisp-techniques/immune-network-theory/AiNet.md#Function-fit)
---
@@ -77,7 +77,7 @@ This abstract method must be implemented by subclasses.
**Implementation**:
-* [AiNet](/docs/aisp-techniques/immune-network-theory/ainet#Function-predict)
+* [AiNet](../../aisp-techniques/immune-network-theory/AiNet.md#Function-predict)
---
diff --git a/versioned_docs/version-0.4.x/advanced-guides/base-module/Mutation.md b/versioned_docs/version-0.4.x/advanced-guides/base-module/Mutation.md
index a280bfbc..f7d906db 100644
--- a/versioned_docs/version-0.4.x/advanced-guides/base-module/Mutation.md
+++ b/versioned_docs/version-0.4.x/advanced-guides/base-module/Mutation.md
@@ -17,8 +17,6 @@ keywords:
- Vector Mutation
---
-# Mutation
-
Contains functions that generate sets of mutated clones from continuous or binary vectors, simulating the clonal expansion process in artificial immune systems.
## clone_and_mutate_continuous
@@ -122,4 +120,3 @@ This function creates `n` clones of the input permutation vector and applies ran
### Returns
* `clone_set` (`npt.NDArray[np.int64]`): Array with shape `(n, len(vector))` containing the `n` mutated clones of the original vector.
-
diff --git a/versioned_docs/version-0.4.x/advanced-guides/base-module/Optimizer.md b/versioned_docs/version-0.4.x/advanced-guides/base-module/Optimizer.md
index 568e8bb3..3e0d99cf 100644
--- a/versioned_docs/version-0.4.x/advanced-guides/base-module/Optimizer.md
+++ b/versioned_docs/version-0.4.x/advanced-guides/base-module/Optimizer.md
@@ -83,7 +83,8 @@ def _record_best(self, cost: float, best_solution: Any) -> None
Record a new cost value and update the best solution if improved.
**Parameters**:
- * ***cost***: `float` - Cost value to be added to the history.
+
+* ***cost***: `float` - Cost value to be added to the history.
---
@@ -97,7 +98,8 @@ Generate a formatted summary report of the optimization process. The report incl
its associated cost, and the evolution of cost values per iteration.
**Returns**:
- * **report**: `str` - A formatted string containing the optimization summary.
+
+* **report**: `str` - A formatted string containing the optimization summary.
---
@@ -110,12 +112,14 @@ def register(self, alias: str, function: Callable[..., Any]) -> None
Register a function dynamically in the optimizer instance.
**Parameters**:
- * ***alias***: `str` - Name used to access the function as an attribute.
- * ***function***: `Callable[..., Any]` - Callable to be registered.
+
+* ***alias***: `str` - Name used to access the function as an attribute.
+* ***function***: `Callable[..., Any]` - Callable to be registered.
**Raises**:
- * **TypeError**: If `function` is not callable.
- * **AttributeError**: If `alias` is protected and cannot be modified, or if `alias` does not exist in the
+
+* **TypeError**: If `function` is not callable.
+* **AttributeError**: If `alias` is protected and cannot be modified, or if `alias` does not exist in the
optimizer class.
---
@@ -141,13 +145,14 @@ def optimize(self, max_iters: int = 50, n_iter_no_change=10, verbose: bool = Tru
Execute the optimization process. This method must be implemented by the subclass to define how the optimization strategy explores the search space.
**Parameters**:
- * ***max_iters***: `int` - Maximum number of iterations.
- * ***n_iter_no_change***: `int`, default=10 - The maximum number of iterations without updating the best solution.
- * ***verbose***: `bool`, default=True - Flag to enable or disable detailed output during optimization.
+
+* ***max_iters***: `int` - Maximum number of iterations.
+* ***n_iter_no_change***: `int`, default=10 - The maximum number of iterations without updating the best solution.
+* ***verbose***: `bool`, default=True - Flag to enable or disable detailed output during optimization.
**Implementation**:
-* [Clonalg](/docs/aisp-techniques/clonal-selection-algorithms/clonalg#Function-optimize)
+* [Clonalg](../../aisp-techniques/clonal-selection-algorithms/clonalg.md#Function-optimize)
---
@@ -160,7 +165,9 @@ def affinity_function(self, solution: Any) -> float
Evaluate the affinity of a candidate solution. This method must be implemented by the subclass to define the problem-specific.
**Parameters**:
- * ***solution***: `Any` - Candidate solution to be evaluated.
+
+* ***solution***: `Any` - Candidate solution to be evaluated.
**Returns**:
- * **cost**: `float` - Cost value associated with the given solution.
+
+* **cost**: `float` - Cost value associated with the given solution.
diff --git a/versioned_docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/Cell.md b/versioned_docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/Cell.md
index 9b474ef2..46989d19 100644
--- a/versioned_docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/Cell.md
+++ b/versioned_docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/Cell.md
@@ -17,20 +17,20 @@ lastUpdatedAt: 2025/05/25
author: João Paulo
---
-# Célula-B de memória
+It represents a memory B-cell.
-Representa uma célula-B de memória.
-
-### Constructor:
+## Constructor
Parameters:
+
* **vector** (``Optional[npt.NDArray]``): A feature vector of the cell. Defaults to None.
---
-### Function hyper_clonal_mutate(...):
+## Function hyper_clonal_mutate(...)
Parameters:
+
* **n** (``int``): The number of clones to be generated from mutations in the original cell.
* **feature_type** (``Literal["continuous-features", "binary-features", "ranged-features"]``): Specifies the type of
algorithm to use based on the nature of the input features
@@ -49,4 +49,4 @@ def hyper_clonal_mutate(
) -> npt.NDArray
```
-Returns an array containing N mutated vectors from the original cell.
\ No newline at end of file
+Returns an array containing N mutated vectors from the original cell.
diff --git a/versioned_docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/airs/README.md b/versioned_docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/airs/README.md
index 012ac7ab..ec591bfb 100644
--- a/versioned_docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/airs/README.md
+++ b/versioned_docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/airs/README.md
@@ -14,7 +14,7 @@ author: João Paulo
# AIRS - Artificial Immune Recognition System
-The ``AIRS`` class aims to perform classification using metaphors of selection and clonal expansion.
+The ``AIRS`` class aims to perform classification using metaphors of selection and clonal expansion.
This implementation is inspired by AIRS2, a simplified version of the original AIRS algorithm.
Introducing adaptations to handle continuous and binary datasets.
@@ -33,36 +33,37 @@ Based on Algorithm 16.5 from Brabazon et al. [1](#1).
:::
-## AIRS Constructor:
-
+## AIRS Constructor
**Attributes:**
-* **n_resources** (``float``): Total amount of available resources. Defaults to 10.
-* **rate_clonal** (``float``): Maximum number of possible clones of a class. This quantity is multiplied by (cell stimulus * rate_hypermutation) to define the number of clones. Defaults to 10.
-* **rate_hypermutation** (``int``): The rate of mutated clones derived from rate_clonal as a scalar factor. Defaults to 0.75.
-* **affinity_threshold_scalar** (``float``): Normalized affinity threshold. Defaults to 0.75.
-* **k** (``int``): The number of K nearest neighbors that will be used to choose a label in the prediction. Defaults to 10.
-* **max_iters** (``int``): Maximum number of interactions in the refinement process of the ARB set exposed to aᵢ. Defaults to 100.
-* **resource_amplified** (``float``): Resource consumption amplifier is multiplied with the incentive to subtract resources. Defaults to 1.0 without amplification.
-* **metric** (Literal["manhattan", "minkowski", "euclidean"]): Way to calculate the distance between the detector and the sample:
- * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression:
- $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + ... + (Y_{n} - Y_{n})^2}$$
- * ``'minkowski'`` ➜ The calculation of the distance is given by the expression:
- $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + ... |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - X_{1}| + |Y_{2} - Y_{2}| + ... + |Y_{n} - Y_{n}|)$$.
+
+- **n_resources** (``float``): Total amount of available resources. Defaults to 10.
+- **rate_clonal** (``float``): Maximum number of possible clones of a class. This quantity is multiplied by (cell stimulus * rate_hypermutation) to define the number of clones. Defaults to 10.
+- **rate_hypermutation** (``int``): The rate of mutated clones derived from rate_clonal as a scalar factor. Defaults to 0.75.
+- **affinity_threshold_scalar** (``float``): Normalized affinity threshold. Defaults to 0.75.
+- **k** (``int``): The number of K nearest neighbors that will be used to choose a label in the prediction. Defaults to 10.
+- **max_iters** (``int``): Maximum number of interactions in the refinement process of the ARB set exposed to aᵢ. Defaults to 100.
+- **resource_amplified** (``float``): Resource consumption amplifier is multiplied with the incentive to subtract resources. Defaults to 1.0 without amplification.
+- **metric** (Literal["manhattan", "minkowski", "euclidean"]): Way to calculate the distance between the detector and the sample:
+ - ``'Euclidean'`` ➜ The calculation of the distance is given by the expression:
+ $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$
+ - ``'minkowski'`` ➜ The calculation of the distance is given by the expression:
+ $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
+ - ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$.
Defaults to **"Euclidean"**.
-* **seed** (``Optional[int]``): Seed for the random generation of detector values. Defaults to None.
+- **seed** (``Optional[int]``): Seed for the random generation of detector values. Defaults to None.
- ``**kwargs``:
- - **p** (``float``): This parameter stores the value of ``p`` used in the Minkowski distance.
+ - **p** (``float``): This parameter stores the value of ``p`` used in the Minkowski distance.
The default is ``2``, which means normalized Euclidean distance. Different values of p lead to different variants of the Minkowski distance. [Learn more](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
**Other initialized variables:**
-* **cells_memory** (``dict``): This variable stores a list of memory cells by class.
-* **affinity_threshold** (``dict``): Defines the affinity threshold between antigens.
-* **classes** (``npt.NDArray``): List of output classes.
+
+- **cells_memory** (``dict``): This variable stores a list of memory cells by class.
+- **affinity_threshold** (``dict``): Defines the affinity threshold between antigens.
+- **classes** (``npt.NDArray``): List of output classes.
---
@@ -75,12 +76,14 @@ The ``fit(...)`` function generates detectors for the non-owners relative to the
```python
def fit(self, X: npt.NDArray, y: npt.NDArray):
```
+
It performs the training according to ``X`` and ``y``, using the method Artificial Immune Recognition System (``AIRS``).
**Input parameters:**
-* **X**: Array with sample features, with **N** samples (rows) and **N** features (columns), normalized to values between [0, 1].
-* **y**: Array with output classes corresponding to **N** samples related to ``X``.
-* **verbose**: Boolean, default ``True``, determines if the feedback from the detector generation will be printed.
+
+- **X**: Array with sample features, with **N** samples (rows) and **N** features (columns), normalized to values between [0, 1].
+- **y**: Array with output classes corresponding to **N** samples related to ``X``.
+- **verbose**: Boolean, default ``True``, determines if the feedback from the detector generation will be printed.
*Returns the class instance.*
@@ -95,15 +98,17 @@ def predict(self, X: npt.NDArray) -> npt.NDArray:
```
**Input parameter:**
-* **X**: Array with the features for prediction, with **N** samples (rows) and **N** columns.
+
+- **X**: Array with the features for prediction, with **N** samples (rows) and **N** columns.
**Returns:**
-* **C**: An array of predictions with the output classes for the given features.
-* **None**: If there are no detectors.
+
+- **C**: An array of predictions with the output classes for the given features.
+- **None**: If there are no detectors.
---
-### Function score(...):
+### Function score(...)
The ``score(...)`` function calculates the accuracy of the trained model by making predictions and calculating the accuracy.
@@ -117,13 +122,14 @@ Returns accuracy as a ``float``.
## Private Methods
-### Function _refinement_arb(...):
+### Function _refinement_arb(...)
The function "_refinement_arb(...)" refines the ARB set until the average stimulation value exceeds the defined threshold (``affinity_threshold_scalar``).
Parameters:
-* **c_match** (``Cell``): Cell with the highest stimulation relative to aᵢ.
-* **arb_list** (``List[_ARB]``): ARB set.
+
+- **c_match** (``Cell``): Cell with the highest stimulation relative to aᵢ.
+- **arb_list** (``List[_ARB]``): ARB set.
```python
def _refinement_arb(self, ai: npt.NDArray, c_match: Cell, arb_list: List[_ARB]) -> _ARB:
@@ -133,7 +139,7 @@ Returns the cell (_ARB) with the highest ARB stimulation.
---
-### Function _cells_affinity_threshold(...):
+### Function _cells_affinity_threshold(...)
The function "_cells_affinity_threshold(...)" calculates the affinity threshold based on the average affinity between training instances, where aᵢ and aⱼ are a pair of antigens, and affinity is measured by distance (Euclidean, Manhattan, Minkowski, Hamming).
**Following the formula:**
@@ -144,7 +150,8 @@ $$
$$
Parameters:
-* **antigens_list** (``NDArray``): List of training antigens.
+
+- **antigens_list** (``NDArray``): List of training antigens.
```python
def _cells_affinity_threshold(self, antigens_list: npt.NDArray):
@@ -152,13 +159,14 @@ def _cells_affinity_threshold(self, antigens_list: npt.NDArray):
---
-### Function _affinity(...):
+### Function _affinity(...)
The function "_affinity(...)" calculates the stimulus between two vectors using metrics.
Parameters:
-* **u** (``npt.NDArray``): Coordinates of the first point.
-* **v** (``npt.NDArray``): Coordinates of the second point.
+
+- **u** (``npt.NDArray``): Coordinates of the first point.
+- **v** (``npt.NDArray``): Coordinates of the second point.
```python
def _affinity(self, u: npt.NDArray, v: npt.NDArray) -> float:
@@ -168,12 +176,13 @@ Returns the stimulus rate between the vectors.
---
-### Function _init_memory_c(...):
+### Function _init_memory_c(...)
The function "_init_memory_c(...)" initializes memory cells by randomly selecting `n_antigens_selected` from the list of training antigens.
Parameters:
-* **antigens_list** (``NDArray``): List of training antigens.
+
+- **antigens_list** (``NDArray``): List of training antigens.
```python
def _init_memory_c(self, antigens_list: npt.NDArray) -> List[Cell]:
@@ -181,10 +190,10 @@ def _init_memory_c(self, antigens_list: npt.NDArray) -> List[Cell]:
---
-
-# References
+## References
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
\ No newline at end of file
+### 1
+>
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
diff --git a/versioned_docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/airs/abr.md b/versioned_docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/airs/abr.md
index d60358f7..13ad2b94 100644
--- a/versioned_docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/airs/abr.md
+++ b/versioned_docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/airs/abr.md
@@ -25,16 +25,18 @@ Individual from the set of recognizing cells (ABR), inherits characteristics fro
:::
-### Constructor:
+### Constructor
Parameters:
+
* vector (``npt.NDArray``): A feature vector of the cell. Defaults to None.
---
-### Function consume_resource(...):
+### Function consume_resource(...)
Parameters:
+
* n_resource (```float```) : The initial amount of resources.
* amplified (``float``): Amplifier for resource consumption by the cell. It is multiplied by the cell's stimulus. The default value is 1.
diff --git a/versioned_docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/clonalg.md b/versioned_docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/clonalg.md
index 13941075..634a0334 100644
--- a/versioned_docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/clonalg.md
+++ b/versioned_docs/version-0.4.x/aisp-techniques/clonal-selection-algorithms/clonalg.md
@@ -31,7 +31,6 @@ specific implementation. This adaptation aims to generalize CLONALG to minimizat
maximization tasks, in addition to supporting continuous, discrete, and permutation problems.
:::
-
---
## CLONALG Constructor
@@ -70,11 +69,13 @@ def optimize(
This method execute the optimization process and return the population.
**Input parameters:**
+
* **max_iters**: `int`, default=50 - The maximum number of interactions.
* **n_iter_no_change**: `int`, default=10 - The maximum number of iterations without an improvement in the best solution.
* **verbose**: `bool`, default=True - A flag to enable or disable detailed output during the optimization process.
**Returns:**
+
* `npt.NDArray`: The best antibody population after clonal expansion.
---
@@ -88,9 +89,11 @@ def affinity_function(self, solution: npt.NDArray) -> np.float64:
This method evaluates the affinity of a candidate solution. It raises a `NotImplementedError` if no affinity function has been provided to the class instance.
**Input parameters:**
+
* **solution**: `npt.NDArray` - The candidate solution to be evaluated.
**Returns:**
+
* `np.float64`: The affinity value associated with the solution.
---
@@ -106,10 +109,12 @@ def _select_top_antibodies(self, n: int, antibodies: list[tuple]) -> list[tuple]
This method selects the top `n` antibodies based on their affinity scores, according to the `mode` (`'min'` or `'max'`).
**Input parameters:**
+
* **n**: `int` - The number of antibodies to select.
* **antibodies**: `list[tuple]` - A list of tuples, where each tuple represents an antibody and its associated score.
**Returns:**
+
* `list[tuple]`: A list containing the `n` selected antibodies.
---
@@ -123,6 +128,7 @@ def _init_population_antibodies(self) -> npt.NDArray:
This method initializes the initial population of antibodies randomly.
**Returns:**
+
* `npt.NDArray`: A list of the initialized antibodies.
---
@@ -136,6 +142,7 @@ def _diversity_introduction(self):
This method introduces new random antibodies into the population to maintain genetic diversity and help prevent premature convergence.
**Returns:**
+
* `npt.NDArray`: An array of new random antibodies.
---
@@ -149,13 +156,14 @@ def _clone_and_mutate(self, antibody: npt.NDArray, n_clone: int, rate_hypermutat
This method generates mutated clones from a single antibody. The mutation strategy depends on the `feature_type` specified during initialization (`'binary-features'`, `'continuous-features'`, `'ranged-features'`, or `'permutation-features'`).
**Input parameters:**
+
* **antibody**: `npt.NDArray` - The original antibody vector to be cloned and mutated.
* **n_clone**: `int` - The number of clones to generate.
* **rate_hypermutation**: `float` - The hypermutation rate.
**Returns:**
- * `npt.NDArray`: An array containing the mutated clones.
+* `npt.NDArray`: An array containing the mutated clones.
---
@@ -168,16 +176,17 @@ def _clone_and_hypermutation(self, population: list[tuple]) -> list:
This method clones and hypermutates a population of antibodies. It returns a list of all clones and their affinities with respect to the cost function.
**Input parameters:**
+
* **population**: `list[tuple]` - The list of antibodies to be evaluated and cloned.
**Returns:**
-* `list`: A list of mutated clones.
+* `list`: A list of mutated clones.
---
+## References
-# References
-
-##### 1
-> BROWNLEE, Jason. Clonal Selection Algorithm. Clever Algorithms: Nature-inspired Programming Recipes., 2011. Available at: https://cleveralgorithms.com/nature-inspired/immune/clonal_selection_algorithm.html
\ No newline at end of file
+### 1
+>
+> BROWNLEE, Jason. Clonal Selection Algorithm. Clever Algorithms: Nature-inspired Programming Recipes., 2011. Available at: [https://cleveralgorithms.com/nature-inspired/immune/clonal_selection_algorithm.html](https://cleveralgorithms.com/nature-inspired/immune/clonal_selection_algorithm.html)
diff --git a/versioned_docs/version-0.4.x/aisp-techniques/immune-network-theory/AiNet.md b/versioned_docs/version-0.4.x/aisp-techniques/immune-network-theory/AiNet.md
index 581ecf11..0ccdc92c 100644
--- a/versioned_docs/version-0.4.x/aisp-techniques/immune-network-theory/AiNet.md
+++ b/versioned_docs/version-0.4.x/aisp-techniques/immune-network-theory/AiNet.md
@@ -1,6 +1,5 @@
---
id: ainet
-title: AiNet
sidebar_label: AiNet - Clustering and Compression
sidebar_position: 1
pagination_next: null
@@ -28,26 +27,25 @@ lastUpdatedAt: 2025/08/19
author: João Paulo
---
-# AiNet - Artificial Immune Network para Clustering and Compression.
+# AiNet - Artificial Immune Network para Clustering and Compression
The AiNet class aims to perform clustering using metaphors inspired by immune network theory.
This class implements the aiNet algorithm, an artificial immune network model designed for
clustering and data compression tasks. The aiNet algorithm uses principles from immune
network theory, clonal selection, and affinity maturation to compress high-dimensional
-datasets [1](#1).
+datasets [1](#1).
For clustering, the class uses SciPy's implementation of the [**Minimum Spanning Tree**
(MST)](#2) to remove the most distant nodes and separate the groups
:::info
-**``AiNet``** extends the **[``BaseAiNet`` class](/docs/advanced-guides/base-classes-reference/ina/ainet)**, inheriting its base functionality.
+**``AiNet``** extends the **[``BaseAiNet`` class](../../advanced-guides/base-classes-reference/ina/ainet.md)**, inheriting its base functionality.
:::
## Constructor
-
```python
class AiNet(
self,
@@ -68,6 +66,7 @@ class AiNet(
```
**Attributes:**
+
* **N** (``int``): Number of memory cells (antibodies) in the population. Defaults to 50.
* **n_clone** (``int``): Number of clones generated per selected memory cell. Defaults to 10.
* **top_clonal_memory_size** (``Optional[int]``): Number of highest-affinity antibodies selected for cloning. Defaults to 5.
@@ -78,20 +77,21 @@ class AiNet(
* **max_iterations** (``int``): Maximum number of training iterations. Defaults to 10.
* **k** (``int``): Number of nearest neighbors used for label prediction. Defaults to 3.
* **metric** (Literal["manhattan", "minkowski", "euclidean"]): Way to calculate the distance between the detector and the sample:
- * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression:
- $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + ... + (Y_{n} - Y_{n})^2}$$
- * ``'minkowski'`` ➜ The calculation of the distance is given by the expression:
- $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + ... |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - X_{1}| + |Y_{2} - Y_{2}| + ... + |Y_{n} - Y_{n}|)$$.
+ * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression:
+ $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$
+ * ``'minkowski'`` ➜ The calculation of the distance is given by the expression:
+ $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
+ * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$.
Defaults to **"Euclidean"**.
* **seed** (``Optional[int]``): Seed for random number generation. Defaults to None.
* **use_mst_clustering** (``bool``): Whether to perform MST-based clustering. Defaults to True.
* **kwargs**:
- * **p** (``float``): Parameter for Minkowski distance. Defaults to 2.
+ * **p** (``float``): Parameter for Minkowski distance. Defaults to 2.
**Other initialized variables:**
+
* **_population_antibodies** (``npt.NDArray``): Stores the current set of antibodies.
* **_memory_network** (``dict``): Dictionary mapping clusters to antibodies.
* **_mst_structure** (``scipy.sparse.csr_matrix``): MST adjacency structure.
@@ -109,7 +109,7 @@ Trains the AiNet model on input data:
```python
def fit(self, X: npt.NDArray, verbose: bool = True):
-````
+```
**Input parameters:**
@@ -165,7 +165,7 @@ Initializes antibody population randomly.
```python
def _init_population_antibodies(self) -> npt.NDArray:
-````
+```
**Returns:** Initialized antibodies (`npt.NDArray`).
@@ -302,12 +302,14 @@ def _build_mst(self):
---
-# References
+## References
-##### 1
+### 1
+>
> De Castro, Leandro & José, Fernando & von Zuben, Antonio Augusto. (2001). aiNet: An Artificial Immune Network for Data Analysis.
-> Available at: [https://www.researchgate.net/publication/228378350_aiNet_An_Artificial_Immune_Network_for_Data_Analysis](https://www.researchgate.net/publication/228378350_aiNet_An_Artificial_Immune_Network_for_Data_Analysis)
+> Available at: [https://www.researchgate.net/publication/228378350_aiNet_An_Artificial_Immune_Network_for_Data_Analysis](https://www.researchgate.net/publication/228378350_aiNet_An_Artificial_Immune_Network_for_Data_Analysis)
-##### 2
+### 2
+>
> SciPy Documentation. *Minimum Spanning Tree*.
-> Available at: [https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree)
\ No newline at end of file
+> Available at: [https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.minimum_spanning_tree)
diff --git a/versioned_docs/version-0.4.x/aisp-techniques/immune-network-theory/README.mdx b/versioned_docs/version-0.4.x/aisp-techniques/immune-network-theory/README.mdx
index 76ad1ad2..148e0fbe 100644
--- a/versioned_docs/version-0.4.x/aisp-techniques/immune-network-theory/README.mdx
+++ b/versioned_docs/version-0.4.x/aisp-techniques/immune-network-theory/README.mdx
@@ -31,9 +31,9 @@ The Artificial Immune Network can be applied in different contexts, such as:
-# References
+## References
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
+### 1
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
diff --git a/versioned_docs/version-0.4.x/aisp-techniques/negative-selection/BNSA.md b/versioned_docs/version-0.4.x/aisp-techniques/negative-selection/BNSA.md
index 6a2ca342..3a4e0e0b 100644
--- a/versioned_docs/version-0.4.x/aisp-techniques/negative-selection/BNSA.md
+++ b/versioned_docs/version-0.4.x/aisp-techniques/negative-selection/BNSA.md
@@ -1,6 +1,5 @@
---
id: bnsa
-title: BNSA
sidebar_label: BNSA - Binary Negative Selection Algorithm
sidebar_position: 2
pagination_next: null
@@ -24,7 +23,7 @@ last_update:
# BNSA (Binary Negative Selection Algorithm)
-## Constructor RNSA:
+## Constructor RNSA
The ``BNSA`` (Binary Negative Selection Algorithm) class has the purpose of classifying and identifying anomalies through the self and not self methods.
@@ -45,6 +44,7 @@ class BNSA(
* *N* (``int``): Number of detectors. Defaults to ``100``.
* *aff_thresh* (``float``): The variable ('affinity threshold') represents the percentage of dissimilarity between the T cell and the own samples. The default value is 10% (0.1), while a value of 1.0 represents 100% dissimilarity.
+
:::note
Setting the difference percentage too high can result in the inability to generate detectors for non-self.
:::
@@ -53,8 +53,8 @@ Setting the difference percentage too high can result in the inability to genera
possible infinite loop if a radius is defined that it is not possible to generate non-self detectors. Defaults to ``1000``.
* *seed* (``int``): Seed for the random generation of values in the detectors. Defaults to ``None``.
* no_label_sample_selection (``str``): Method for selecting labels for samples designated as non-members by all non-member detectors. **Available method types:**
- - (``max_average_difference``): Selects the class with the highest average difference among the detectors.
- - (``max_nearest_difference``): Selects the class with the highest difference between the nearest and farthest detector from the sample.
+ * (``max_average_difference``): Selects the class with the highest average difference among the detectors.
+ * (``max_nearest_difference``): Selects the class with the highest difference between the nearest and farthest detector from the sample.
**Other variables initiated:**
@@ -62,10 +62,8 @@ possible infinite loop if a radius is defined that it is not possible to generat
* *classes* (``npt.NDArray``): list of output classes.
-
---
-
### Function fit(...)
The ``fit(...)`` function generates the detectors for non-fits with respect to the samples:
@@ -76,8 +74,9 @@ def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
In it, training is performed according to ``X`` and ``y``, using the negative selection method(``NegativeSelect``).
-**The input parameters are:**
-* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
+**The input parameters are:**
+
+* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
* ``y``: array with the output classes arranged in **N** samples that are related to ``X``.
@@ -95,10 +94,12 @@ The ``predict(...)`` function performs class prediction using the generated dete
def predict(self, X: npt.NDArray) -> npt.NDArray:
```
-**The input parameter is:**
+**The input parameter is:**
+
* ``X``: array with the characteristics for the prediction, with **N** samples (Rows) and **N** columns.
-**Returns:**
+**Returns:**
+
* ``C``: prediction array, with the output classes for the given characteristics.
* ``None``: if there are no detectors.
@@ -128,8 +129,9 @@ The function ``__assign_class_to_non_self_sample(...)``, determines the class of
def __assign_class_to_non_self_sample(self, line: npt.NDArray, c: list):
```
-**The input parameter is:**
+**The input parameter is:**
+
* ***line*** (``npt.NDArray``): Sample to be classified.
* ***c*** (``list``): List of predictions to be updated with the new classification.
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.4.x/aisp-techniques/negative-selection/README.md b/versioned_docs/version-0.4.x/aisp-techniques/negative-selection/README.md
index 325d8e55..be74a482 100644
--- a/versioned_docs/version-0.4.x/aisp-techniques/negative-selection/README.md
+++ b/versioned_docs/version-0.4.x/aisp-techniques/negative-selection/README.md
@@ -6,30 +6,37 @@ sidebar_position: 1
**Negative selection** is the process in which the immune system maturates T-cells, also known as T-lymphocytes, which make them capable of detecting non-self. Thus, the Negative Selection Algorithm (NSA) uses hyperspheres symbolizing the detectors in an N-dimensional data space. [[1]](#1)
-# classes
+## classes
> 1. **[Binary version:](BNSA.md)**
+>
>> The binary algorithm adapted for multiple classes in this project is based on the version proposed by [Forrest et al. (1994)](#2), originally developed for computer security.
>>> **Example:**
->>> + [Mushrooms Database](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/BNSA/mushrooms_dataBase_example_en.ipynb)
+>>>
+>>> + [Mushrooms Database](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/BNSA/mushrooms_dataBase_example_en.ipynb)
> 2. **[Real-Valued version:](RNSA.md)**
+>
>>This algorithm has two different versions: one based on the canonical version [[1]](#1) and another with variable radius detectors [[3]](#3). Both are adapted to work with multiple classes and have methods for predicting data present in the non-self region of all detectors and classes.
>>> **Examples:**
->>> + [Iris Database](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/iris_dataBase_example_en.ipynb)
->>> + [Geyser Database](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/geyser_dataBase_example_en.ipynb)
+>>>
+>>> + [Iris Database](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/iris_dataBase_example_en.ipynb)
+>>> + [Geyser Database](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/geyser_dataBase_example_en.ipynb)
-# References
+## References
---
-##### 1
-> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: http://dx.doi.org/10.1007/978-3-662-43631-8.
+### 1
+>
+> BRABAZON, Anthony; O'NEILL, Michael; MCGARRAGHY, Seán. Natural Computing Algorithms. [S. l.]: Springer Berlin Heidelberg, 2015. DOI 10.1007/978-3-662-43631-8. Disponível em: [https://dx.doi.org/10.1007/978-3-662-43631-8](https://dx.doi.org/10.1007/978-3-662-43631-8).
-##### 2
-> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: http://dx.doi.org/10.1109/RISP.1994.296580.
+### 2
+>
+> S. Forrest, A. S. Perelson, L. Allen and R. Cherukuri, "Self-nonself discrimination in a computer," Proceedings of 1994 IEEE Computer Society Symposium on Research in Security and Privacy, Oakland, CA, USA, 1994, pp. 202-212, doi: [https://dx.doi.org/10.1109/RISP.1994.296580](https://dx.doi.org/10.1109/RISP.1994.296580).
-##### 3
-> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: http://dx.doi.org/10.1007/978-3-540-24854-5_30.
+### 3
+>
+> JI, Zhou; DASGUPTA, Dipankar. Real-Valued Negative Selection Algorithm with Variable-Sized Detectors. Genetic and Evolutionary Computation - GECCO 2004. [S. l.]: Springer Berlin Heidelberg, 2004. DOI 10.1007/978-3-540-24854-5_30. Disponível em: [https://dx.doi.org/10.1007/978-3-540-24854-5_30](https://dx.doi.org/10.1007/978-3-540-24854-5_30).
----
\ No newline at end of file
+---
diff --git a/versioned_docs/version-0.4.x/aisp-techniques/negative-selection/RNSA.md b/versioned_docs/version-0.4.x/aisp-techniques/negative-selection/RNSA.md
index 37444177..1787b8ea 100644
--- a/versioned_docs/version-0.4.x/aisp-techniques/negative-selection/RNSA.md
+++ b/versioned_docs/version-0.4.x/aisp-techniques/negative-selection/RNSA.md
@@ -1,6 +1,5 @@
---
id: rnsa
-title: RNSA
sidebar_label: RNSA - Real-Valued Negative Selection Algorithm
sidebar_position: 1
keywords:
@@ -21,7 +20,7 @@ last_update:
# RNSA (Real-Valued Negative Selection Algorithm)
-## Constructor RNSA:
+## Constructor RNSA
The ``RNSA`` (Real-Valued Negative Selection Algorithm) class has the purpose of classifying and identifying anomalies through the self and not self methods.
@@ -44,6 +43,7 @@ class RNSA(
* *N* (``int``): Number of detectors. Defaults to ``100``.
* *r* (``float``): Radius of the detector. Defaults to ``0.05``.
+
:::note
it is important to consider that setting a very low radius for the detector can significantly reduce the detection rate. On the other hand, a very large radius can make it impossible to incorporate the detector into the search space, which can also compromise detection performance. It is essential to find a balance between the radius size and detection efficiency to achieve the best possible results.
:::
@@ -51,32 +51,31 @@ it is important to consider that setting a very low radius for the detector can
* *k* (``int``): Number of neighbors near the randomly generated detectors to perform the distance average calculation. Defaults to ``1``.
* *metric* (``str``): Way to calculate the distance between the detector and the sample:
- * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression: $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + ... + (Y_{n} - Y_{n})^2}$$.
+ * ``'Euclidean'`` ➜ The calculation of the distance is given by the expression: $$\sqrt{(X_{1} - X_{1})^2 + (Y_{2} - Y_{2})^2 + \cdots + (Y_{n} - Y_{n})^2}$$.
- * ``'minkowski'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + ... |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
- * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - X_{1}| + |Y_{2} - Y_{2}| + ... + |Y_{n} - Y_{n}|)$$.
+ * ``'minkowski'`` ➜ The calculation of the distance is given by the expression: $$( |X_{1} - Y_{1}|^p + |X_{2} - Y_{2}|^p + \cdots + |X_{n} - Y_{n}|^p)^\frac{1}{p}$$.
+ * ``'manhattan'`` ➜ The calculation of the distance is given by the expression: $$\frac{(|X_{1} - X_{1}| + |Y_{2} - Y_{2}| + \cdots + |Y_{n} - Y_{n}|)}{n}$$.
Defaults to ``'euclidean'``.
-
* *max_discards* (``int``): This parameter indicates the maximum number of consecutive detector discards, aimed at preventing a possible infinite loop in case a radius is defined that cannot generate non-self detectors. Defaults to ``1000``.
* *seed* (``int``): Seed for the random generation of values in the detectors. Defaults to ``None``.
* *algorithm* (``str``), Set the algorithm version:
- * ``'default-NSA'``: Default algorithm with fixed radius.
- * ``'V-detector'``: This algorithm is based on the article "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", by Ji, Z., Dasgupta, D. (2004), and uses a variable radius for anomaly detection in feature spaces.
+ * ``'default-NSA'``: Default algorithm with fixed radius.
+ * ``'V-detector'``: This algorithm is based on the article "[Real-Valued Negative Selection Algorithm with Variable-Sized Detectors](https://doi.org/10.1007/978-3-540-24854-5_30)", by Ji, Z., Dasgupta, D. (2004), and uses a variable radius for anomaly detection in feature spaces.
Defaults to ``'default-NSA'``.
* *r_s* (``float``): rₛ Radius of the ``X`` own samples.
-- ``**kwargs``:
- - *non_self_label* (``str``): This variable stores the label that will be assigned when the data has only one
+
+* ``**kwargs``:
+ * *non_self_label* (``str``): This variable stores the label that will be assigned when the data has only one
output class, and the sample is classified as not belonging to that class. Defaults to ``'non-self'``.
- - *cell_bounds* (``bool``): If set to ``True``, this option limits the generation of detectors to the space within the plane between 0 and 1. This means that any detector whose radius exceeds this limit is discarded, this variable is only used in the ``V-detector`` algorithm.
- - p (``float``): This parameter stores the value of ``p`` used in the Minkowski distance. The default is ``2``, which represents normalized Euclidean distance. Different values of p lead to different variants of the Minkowski
+ * *cell_bounds* (``bool``): If set to ``True``, this option limits the generation of detectors to the space within the plane between 0 and 1. This means that any detector whose radius exceeds this limit is discarded, this variable is only used in the ``V-detector`` algorithm.
+ * p (``float``): This parameter stores the value of ``p`` used in the Minkowski distance. The default is ``2``, which represents normalized Euclidean distance. Different values of p lead to different variants of the Minkowski
distance [learn more](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.minkowski.html).
-
**Other variables initiated:**
@@ -96,8 +95,9 @@ def fit(self, X: npt.NDArray, y: npt.NDArray, verbose: bool = True)
In it, training is performed according to ``X`` and ``y``, using the negative selection method(``NegativeSelect``).
-The input parameters are:
-* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
+The input parameters are:
+
+* ``X``: array with the characteristics of the samples with **N** samples (rows) and **N** characteristics (columns).
* ``y``: array with the output classes arranged in **N** samples that are related to ``X``.
@@ -115,10 +115,12 @@ The ``predict(...)`` function performs class prediction using the generated dete
def predict(self, X: npt.NDArray) -> npt.NDArray:
```
-**The input parameter is:**
+**The input parameter is:**
+
* ``X``: array with the characteristics for the prediction, with **N** samples (Rows) and **N** columns.
-**Returns:**
+**Returns:**
+
* ``C``: prediction array, with the output classes for the given characteristics.
* ``None``: if there are no detectors.
@@ -149,12 +151,13 @@ def __checks_valid_detector(self, X: npt.NDArray, vector_x: npt.NDArray, samples
```
**The input parameters are:**
+
* ``X``: array with sample characteristics with **N** samples (rows) and **N** characteristics (columns), normalized to values between [0, 1].
* ``vector_x``: Randomly generated candidate detector.
* ``samplesIndexClass``: Array with the indexes of a class.
-
+
**Returns:** ``True`` for detectors that do not have samples inside or ``False`` if they do.
---
@@ -179,9 +182,11 @@ In this function, when there is class ambiguity, it returns the class that has t
```python
def __compare_sample_to_detectors(self, line):
```
+
**The input parameters are:**
+
* line: vector with N-features
-
+
**Returns:** The predicted class with the detectors or None if the sample does not qualify for any class.
---
@@ -193,13 +198,14 @@ Check if the distance between the detector and the samples, minus the radius of
```python
def __detector_is_valid_to_Vdetector(self, distance, vector_x):
```
-
+
**The input parameters are:**
* distance (``float``): minimum distance calculated between all samples.
* vector_x (``numpy.ndarray``): randomly generated candidate detector vector x with values between 0 and 1.
-**Returns:**
+**Returns:**
+
* ``False``: if the calculated radius is smaller than the minimum distance or exceeds the edge of the space, if this option is enabled.
* ``True`` and the distance minus the radius of the samples, if the radius is valid.`
@@ -218,4 +224,3 @@ The input parameters are ``u`` and ``v`` NDArrays, with the coordinates for the
**Returns:** the distance (``double``) between the two points.
---
-
diff --git a/versioned_docs/version-0.4.x/examples/Classification/csa.md b/versioned_docs/version-0.4.x/examples/Classification/csa.md
index 138193d6..aba99717 100644
--- a/versioned_docs/version-0.4.x/examples/Classification/csa.md
+++ b/versioned_docs/version-0.4.x/examples/Classification/csa.md
@@ -27,30 +27,34 @@ keywords:
- immune recognition
---
-# Clonal Selection Algorithm
-
This page presents a collection of practical examples showcasing how to use the Clonal Selection Algorithm.
## AIRS (Artificial Immune Recognition System)
-
Run notebooks online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclassification%2FAIRS)
---
### Binary Algorithm
-+ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/example_with_randomly_generated_dataset-en.ipynb)
++ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/example_with_randomly_generated_dataset-en.ipynb)
+
> In the example present in this notebook 1000 random samples were generated, arranged in two groups, one for each class.
+ [mushrooms_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/mushrooms_dataBase_example_en.ipynb)
-> It uses the [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), which contains information about edible and poisonous mushrooms.
+
+> It uses the [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), which contains information about edible and poisonous mushrooms.
### Real-Valued Algorithm
-+ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/example_with_randomly_generated_dataset-en.ipynb)
++ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/example_with_randomly_generated_dataset-en.ipynb)
+
> In the example present in this notebook 500 random samples were generated, arranged in two groups, one for each class, we can see the non-self detectors generated below
+
+ [iris_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/iris_dataBase_example_en.ipynb)
+
> Example using the NSA [iris database](https://archive.ics.uci.edu/ml/datasets/iris), which contains four-dimensional samples and three output classes (Setosa, Versicolor and Virginica).
+
+ [geyser_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/AIRS/geyser_dataBase_example_en.ipynb)
-> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
\ No newline at end of file
+
+> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/versioned_docs/version-0.4.x/examples/Classification/nsa.md b/versioned_docs/version-0.4.x/examples/Classification/nsa.md
index bbafa10a..89981dd5 100644
--- a/versioned_docs/version-0.4.x/examples/Classification/nsa.md
+++ b/versioned_docs/version-0.4.x/examples/Classification/nsa.md
@@ -33,21 +33,28 @@ Run notebooks online via Binder: [
---
-+ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/BNSA/example_with_randomly_generated_dataset-en.ipynb)
++ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/BNSA/example_with_randomly_generated_dataset-en.ipynb)
+
> In the example present in this notebook 1000 random samples were generated, arranged in two groups, one for each class.
+ [mushrooms_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/BNSA/mushrooms_dataBase_example_en.ipynb)
-> It uses the [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), which contains information about edible and poisonous mushrooms.
-# RNSA (Real-Valued Negative Selection Algorithm)
+> It uses the [mushrooms database](https://archive.ics.uci.edu/dataset/73/mushroom), which contains information about edible and poisonous mushrooms.
+
+## RNSA (Real-Valued Negative Selection Algorithm)
Run notebooks online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclassification%2FRNSA)
---
-+ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/example_with_randomly_generated_dataset-en.ipynb)
++ [Example with random samples](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/example_with_randomly_generated_dataset-en.ipynb)
+
> In the example present in this notebook 500 random samples were generated, arranged in two groups, one for each class, we can see the non-self detectors generated below
+
+ [iris_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/iris_dataBase_example_en.ipynb)
+
> Example using the NSA [iris database](https://archive.ics.uci.edu/ml/datasets/iris), which contains four-dimensional samples and three output classes (Setosa, Versicolor and Virginica).
+
+ [geyser_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/geyser_dataBase_example_en.ipynb)
-> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
\ No newline at end of file
+
+> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/versioned_docs/version-0.4.x/examples/Clustering/ina.md b/versioned_docs/version-0.4.x/examples/Clustering/ina.md
index 7e98acdd..26ef03c8 100644
--- a/versioned_docs/version-0.4.x/examples/Clustering/ina.md
+++ b/versioned_docs/version-0.4.x/examples/Clustering/ina.md
@@ -18,23 +18,22 @@ keywords:
- geyser dataset
---
-# Immune Network Algorithms
-
On this page, you will find a collection of practical examples that demonstrate how to use the Immune Network Algorithm classes implemented in our package.
-
Run notebooks online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclustering%2FAiNet)
## AiNet (Artificial Immune Network)
-
---
+ [Random datasets](https://github.com/AIS-Package/aisp/blob/main/examples/en/clustering/AiNet/example_with_randomly_generated_dataset.ipynb)
+
> In this notebook AiNet is demonstrated on three synthetic datasets:
-> - **Blobs:** well-defined spherical clusters, easy to separate.
-> - **Moons:** non-linear clusters, illustrating more complex decision boundaries.
-> - **Circles:** two concentric circles, showing the capability of handling non-linear separation.
+>
+> + **Blobs:** well-defined spherical clusters, easy to separate.
+> + **Moons:** non-linear clusters, illustrating more complex decision boundaries.
+> + **Circles:** two concentric circles, showing the capability of handling non-linear separation.
+ [geyser_dataBase_example](https://github.com/AIS-Package/aisp/blob/main/examples/en/clustering/AiNet/geyser_dataBase_example.ipynb)
-> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
\ No newline at end of file
+
+> To classify geyser eruptions in Yellowstone National Park, this notebook uses the [Old Faithful database](https://github.com/mwaskom/seaborn-data/blob/master/geyser.csv).
diff --git a/versioned_docs/version-0.4.x/examples/Optimization/csa.md b/versioned_docs/version-0.4.x/examples/Optimization/csa.md
index 5dbfe61d..21176f04 100644
--- a/versioned_docs/version-0.4.x/examples/Optimization/csa.md
+++ b/versioned_docs/version-0.4.x/examples/Optimization/csa.md
@@ -17,9 +17,6 @@ keywords:
- machine learning
---
-# Clonal Selection Algorithm
-
-
On this page, you will find a collection of practical examples that demonstrate how to use the Clonal Selection Algorithms classes implemented in our package.
Run notebooks online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Foptimization%2Fclonalg)
@@ -29,14 +26,15 @@ Run notebooks online via Binder: [
## Clonalg (Clonal Selection Algorithm)
+ [Traveling Salesman Problem](https://github.com/AIS-Package/aisp/blob/main/examples/en/optimization/clonalg/tsp_problem_example.ipynb)
-> In this notebook, apply **Clonalg** to the Knapsack Problem using optimization algorithms from the AISP package.
+> In this notebook, apply **Clonalg** to the Knapsack Problem using optimization algorithms from the AISP package.
+ [Rastrigin Function](https://github.com/AIS-Package/aisp/blob/main/examples/en/optimization/clonalg/rastrigin_function_example.ipynb)
-> In this notebook, we apply **Clonalg** to the **Rastrigin Function**, a classic continuous optimization problem using optimization algorithms from the **AISP** package.
+> In this notebook, we apply **Clonalg** to the **Rastrigin Function**, a classic continuous optimization problem using optimization algorithms from the **AISP** package.
+ [Knapsack Problem](https://github.com/AIS-Package/aisp/blob/main/examples/en/optimization/clonalg/knapsack_problem_example.ipynb)
+
> In this notebook, apply **Clonalg** to the Knapsack Problem using optimization algorithms from the AISP package.
---
diff --git a/versioned_docs/version-0.4.x/getting-started/basic-use/AIRS.md b/versioned_docs/version-0.4.x/getting-started/basic-use/AIRS.md
index b748b6f7..12e618b9 100644
--- a/versioned_docs/version-0.4.x/getting-started/basic-use/AIRS.md
+++ b/versioned_docs/version-0.4.x/getting-started/basic-use/AIRS.md
@@ -32,11 +32,12 @@ Access the Jupyter notebook with the code available [here](https://github.com/AI
Run notebook online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclassification%2FAIRS%2Fexample_with_randomly_generated_dataset-en.ipynb)
### Importing the Artificial Immune Recognition System
+
```python
from aisp.csa import AIRS
```
-### Generating dice bubbles for classes randomly.
+### Generating dice bubbles for classes randomly
Using the `make_blobs` function, two sets of data are generated in the form of bubbles, in the range between 0 and 1, representing each class x and y. Then this data is separated into test and training sets.
@@ -52,7 +53,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-### Testing the model AIRS:
+### Testing the model AIRS
Then, it presents the result of the forecast accuracy.
@@ -71,6 +72,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```bash
✔ Set of memory cells for classes (0, 1) successfully generated: ┇██████████┇ 400/400 memory cells for each aᵢ
The accuracy is 1.0
@@ -86,6 +88,6 @@ weighted avg 1.00 1.00 1.00 100
---
-### Memory cell and sample plotting:
+### Memory cell and sample plotting
-
\ No newline at end of file
+
diff --git a/versioned_docs/version-0.4.x/getting-started/basic-use/AiNet.mdx b/versioned_docs/version-0.4.x/getting-started/basic-use/AiNet.mdx
index a633063a..b770c3ea 100644
--- a/versioned_docs/version-0.4.x/getting-started/basic-use/AiNet.mdx
+++ b/versioned_docs/version-0.4.x/getting-started/basic-use/AiNet.mdx
@@ -263,4 +263,4 @@ Silhouette Coefficient: 0.112
plot_immune_network(samples, predict_y, model, title_prefix="Circles - ")
```
-
+
diff --git a/versioned_docs/version-0.4.x/getting-started/basic-use/BNSA.md b/versioned_docs/version-0.4.x/getting-started/basic-use/BNSA.md
index 0605f25d..98814dc3 100644
--- a/versioned_docs/version-0.4.x/getting-started/basic-use/BNSA.md
+++ b/versioned_docs/version-0.4.x/getting-started/basic-use/BNSA.md
@@ -27,12 +27,12 @@ Access the Jupyter notebook with the code available [here](https://github.com/AI
Run notebook online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclassification%2FBNSA%2Fexample_with_randomly_generated_dataset-en.ipynb)
-
## Importing the BNSA algorithm
```python
from aisp.nsa import BNSA
```
+
## Generating samples
Algorithm training and testing needs data samples. Thus, for the demonstration, two random classes were generated, using the following function:
@@ -104,7 +104,8 @@ print(classification_report(test_y, prev_y))
```
Output:
-```
+
+```bash
✔ Non-self detectors for classes (x, y) successfully generated: ┇██████████┇ 500/500 detectors
The accuracy is 0.93
precision recall f1-score support
@@ -132,4 +133,4 @@ plt.ylabel('Estimated')
plt.show()
```
-
\ No newline at end of file
+
diff --git a/versioned_docs/version-0.4.x/getting-started/basic-use/Clonalg.md b/versioned_docs/version-0.4.x/getting-started/basic-use/Clonalg.md
index 673178bc..6c060f09 100644
--- a/versioned_docs/version-0.4.x/getting-started/basic-use/Clonalg.md
+++ b/versioned_docs/version-0.4.x/getting-started/basic-use/Clonalg.md
@@ -30,6 +30,7 @@ The Rastrigin function is a multimodal, non-convex function with many local mini
$$ f(x) = 10n + \sum_{i=1}^{n} (x_i^{2} - 10\cos(2\pi x_i)) $$
Where:
+
* **n** is the problem dimension
* **xᵢ** ∈ \[−5.12, 5.12] for each dimension
* **Global minimum**: f(0,0) = 0
@@ -90,7 +91,9 @@ clonalg.optimize(100, 20)
if clonalg.best_cost is not None:
print('Best cost:', abs(clonalg.best_cost))
```
+
Output:
+
```bash
┌───────────┬─────────────────────────┬────────────────────┬─────────────────┐
│ Iteration │ Best Affinity (min) │ Worse Affinity │ Stagnation │
@@ -147,10 +150,13 @@ Best cost: 0.020278270044883584
```
### Result
+
```python
print(clonalg.get_report())
```
+
Output:
+
```python
=============================================
Optimization Summary
@@ -213,4 +219,4 @@ Cost History per Iteration:
### Evolution of the best over generations
-
\ No newline at end of file
+
diff --git a/versioned_docs/version-0.4.x/getting-started/basic-use/RNSA.md b/versioned_docs/version-0.4.x/getting-started/basic-use/RNSA.md
index 2e4dad0f..3b3d6fe6 100644
--- a/versioned_docs/version-0.4.x/getting-started/basic-use/RNSA.md
+++ b/versioned_docs/version-0.4.x/getting-started/basic-use/RNSA.md
@@ -23,15 +23,15 @@ keywords:
Access the Jupyter notebook with the code available [here](https://github.com/AIS-Package/aisp/blob/main/examples/en/classification/RNSA/example_with_randomly_generated_dataset-en.ipynb)!
-
Run notebook online via Binder: [](https://mybinder.org/v2/gh/AIS-Package/aisp/HEAD?labpath=%2Fexamples%2Fen%2Fclassification%2FRNSA%2Fexample_with_randomly_generated_dataset-en.ipynb)
-### Importing the Real-Valued Negative Selection Algorithm.
+### Importing the Real-Valued Negative Selection Algorithm
+
```python
from aisp.nsa import RNSA
```
-### Generating dice bubbles for classes randomly.
+### Generating dice bubbles for classes randomly
Using the `make_blobs` function, two sets of data are generated in the form of bubbles, in the range between 0 and 1, representing each class x and y. Then this data is separated into test and training sets.
@@ -47,7 +47,7 @@ train_x, test_x, train_y, test_y = train_test_split(samples, output, test_size=0
---
-### Testing the model `default-NSA`:
+### Testing the model `default-NSA`
Start the model with 500 detectors, each with a radius of 0.06. Then, it presents the result of the forecast accuracy.
@@ -66,6 +66,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```bash
✔ Non-self detectors for classes (0, 1) successfully generated: ┇██████████┇ 1000/1000 detectors
The accuracy is 1.0
@@ -81,13 +82,13 @@ weighted avg 1.00 1.00 1.00 100
---
-### Detector and sample plotting:
+### Detector and sample plotting
-
+
---
-### Testing the model `V-detector`:
+### Testing the model `V-detector`
Start the model with 50 detectors, where the minimum radius is 0.05 and the sample's own radius is 0.04. It then shows the forecast accuracy result.
@@ -106,6 +107,7 @@ print(classification_report(test_y, prev_y))
```
Output:
+
```bash
✔ Non-self detectors for classes (0, 1) successfully generated: ┇██████████┇ 40/40 detectors
The accuracy is 1.0
@@ -121,5 +123,6 @@ weighted avg 1.00 1.00 1.00 100
---
-### Detector and sample plotting:
-
\ No newline at end of file
+### V-Detector and sample plotting
+
+
diff --git a/versioned_docs/version-0.4.x/getting-started/instalation.md b/versioned_docs/version-0.4.x/getting-started/instalation.md
index 88dbed58..bbe5c9cd 100644
--- a/versioned_docs/version-0.4.x/getting-started/instalation.md
+++ b/versioned_docs/version-0.4.x/getting-started/instalation.md
@@ -28,7 +28,7 @@ The package requires [python 3.10](https://www.python.org/downloads/) or higher.
-## **Instalation procedure**
+## **Installation procedure**
The simplest way to install is via ``pip``:
@@ -43,4 +43,3 @@ from aisp.nsa import RNSA, BNSA
nsa = RNSA(N=300, r=0.05)
```
-
diff --git a/versioned_docs/version-0.4.x/intro.md b/versioned_docs/version-0.4.x/intro.md
index 0f446c3a..178a8f7d 100644
--- a/versioned_docs/version-0.4.x/intro.md
+++ b/versioned_docs/version-0.4.x/intro.md
@@ -20,11 +20,11 @@ keywords:
- Bioinspiration
- Immune Metaphors
---
-# Artificial Immune Systems Package.
+# Artificial Immune Systems Package
-
+
@@ -34,9 +34,9 @@ keywords:
**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).
-### Algorithms implemented:
+### Algorithms implemented
-> - [x] [**Negative Selection.**](/docs/aisp-techniques/negative-selection/)
-> - [x] [**Clonal Selection Algorithms.**](/docs/aisp-techniques/clonal-selection-algorithms/)
-> - [x] [**Immune Network Theory.**](/docs/aisp-techniques/immune-network-theory/)
+> - [x] [**Negative Selection.**](./aisp-techniques/negative-selection/)
+> - [x] [**Clonal Selection Algorithms.**](./aisp-techniques/clonal-selection-algorithms/)
+> - [x] [**Immune Network Theory.**](./aisp-techniques/immune-network-theory/)
> - [ ] *Danger Theory*