# Sentinel Layer

This layer utilizes machine learning and real-time analytics to monitor network health and optimize performance.

**Node health classification:**

Node health is now classified using a multi-factor model:

$$
H(v)=w
1
​
U(v)+w
2
​
P(v)+w
3
​
S(v)+w
4
​
N(v)
$$

*where:*

* U(v) is the uptime of validator v
* P(v) is the performance score of validator v
* S(v) is the stake of validator v
* N(v) is the network contribution of validator v
* w1, w2, w3 and w4 are weight coefficients

**Anomaly detection:**

This sentinel layer employs an Isolation Forest algorithm to detect anomalies in validator behavior:

```python
Copy codefrom sklearn.ensemble import IsolationForest

def detect_anomalies(validator_metrics):
    clf = IsolationForest(contamination=0.1, random_state=42)
    clf.fit(validator_metrics)
    return clf.predict(validator_metrics)
```

{% hint style="info" %}
We invite developers, researchers, and enthusiasts to work with our contributors for this section. [Start contributing here.](https://app.deform.cc/form/21842244-e1c1-479f-a8b3-3877903ecd44)&#x20;
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://flexecosystem.gitbook.io/flex-docs/protocol/flex-validator-nodes/sentinel-layer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
