Код (class DataGenerator(Sequence):
    def __init__(self, filename, batch_size, window_size, shuffle=True):
        self.filename = filename
        self.batch_size = batch_size
        self.window_size = window_size
        self.shuffle = shuffle
        self.data, self.labels = self._load_data()
        self.indexes = np.arange(len(self.data))

    def _load_data(self):
        data = []
        labels = []
        with open(self.filename, 'r', encoding='utf-8') as file:
            for line in file:
                event = json.loads(line)
                data.append([event['EventId'], event['ThreadId'], event['Image']])
                labels.append(event['Class'])
        
        sequences = []
        sequence_labels = []
        for i in range(len(data) - self.window_size + 1):
            sequences.append(data[i:i+self.window_size])
            sequence_labels.append(labels[i+self.window_size - 1])
        return sequences, sequence_labels

    def __on_epoch_end__(self):
        if self.shuffle:
            np.random.shuffle(self.indexes)

    def __getitem__(self, index):
        batch_indexes = self.indexes[index * self.batch_size:(index + 1) * self.batch_size]
        X = np.array([self.data[k] for k in batch_indexes])
        y = np.array([self.labels[k] for k in batch_indexes])
        return X, y

    def __len__(self):
        return len(self.data) // self.batch_size

# Параметры генератора данных и модели
input_file_name = '34.jsonl'
batch_size = 1000
window_size = 100
n_features = 3  # Зависит от количества признаков в ваших данных

# Построение модели
model = Sequential([
    GRU(100, return_sequences=True, input_shape=(window_size, n_features)),
    GRU(128, return_sequences=False),
    Dense(1, activation='sigmoid')  # Изменено на один выходной нейрон с активацией 'sigmoid'
])

# Компиляция модели
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])

# Создание генератора данных
train_generator = DataGenerator(filename=input_file_name, batch_size=batch_size, window_size=window_size)

# Обучение модели
model.fit(train_generator, epochs=3)

# Сохранение модели
model.save('neural_network_model.h5')
)  фрагмент датасета({"computer_name": "director", "EventId": 0.0008563476771569257, "ThreadId": 0.334020618556701, "Image": 0.3333333333333333, "UtcTime": "2023-12-04 04:21:52.329", "Class": 1}
{"computer_name": "director", "EventId": 0.0008563476771569257, "ThreadId": 0.334020618556701, "Image": 0.0, "UtcTime": "2023-12-04 04:21:52.454", "Class": 1}
{"computer_name": "director", "EventId": 0.0008563476771569257, "ThreadId": 0.334020618556701, "Image": 0.3333333333333333, "UtcTime": "2023-12-04 04:21:52.519", "Class": 1}
{"computer_name": "director", "EventId": 0.0008563476771569257, "ThreadId": 0.334020618556701, "Image": 1.0, "UtcTime": "2023-12-04 04:21:52.904", "Class": 1}
{"computer_name": "n764265.iss-reshetnev.ru", "EventId": 0.9897238278741168, "ThreadId": 0.8254295532646049, "Image": 0.0, "UtcTime": "", "Class": 0}
{"computer_name": "n764265.iss-reshetnev.ru", "EventId": 0.0010704345964461573, "ThreadId": 0.4446735395189004, "Image": 0.0, "UtcTime": "2023-12-04 00:52:40.339", "Class": 0}
{"computer_name": "n764265.iss-reshetnev.ru", "EventId": 0.0010704345964461573, "ThreadId": 0.4446735395189004, "Image": 0.0, "UtcTime": "2023-12-04 00:52:40.339", "Class": 0})  код прогноза(import json
import numpy as np
from tensorflow.keras.models import load_model
from collections import defaultdict
import plotly.graph_objs as go


model = load_model("neural_network_model.h5")
filename = '1.jsonl'
sequence_length = 100  
user_counter, data_by_user = load_data(filename)

specific_hosts = [
    'Director',
    'director\TestoedovNA',
    'ISS-RESHETNEV\PjetrovPA',
    "ISS-RESHETNEV\\KropachevaNV",
    "ISS-RESHETNEV\\KrivtsovVV",
    "n769943.iss-reshetnev.ru",
    "az.iss-reshetnev.ru",
    'n764371.iss-reshetnev.ru'
]

predictions = defaultdict(list)
max_predictions = 100

for user in specific_hosts:
    events = data_by_user[user]
    for i in range(min(len(events) - sequence_length + 1, max_predictions)):
        sequence = np.array(events[i:i + sequence_length])
        sequence = sequence.reshape((1, sequence_length, -1)) 
        pred = model.predict(sequence)
        predictions[user].extend(pred)
        if len(predictions[user]) >= max_predictions: 
            break

def plot_predictions(predictions, specific_hosts):
    fig = go.Figure()

    for user in specific_hosts:
        preds = np.array(predictions[user])
        if len(preds) == 0:
            continue
        y = np.argmax(preds, axis=1)
        x = np.arange(len(y))  
        fig.add_trace(go.Scatter(x=x, y=y, mode='lines', name=user))

    fig.update_layout(
        title='Predictions for Specific Hosts',
        xaxis_title='Prediction Number',
        yaxis_title='Predicted Class',
        hovermode='x unified'
    )

    fig.update_xaxes(rangeslider_visible=True)
    fig.update_yaxes(fixedrange=False)  

    fig.show()

plot_predictions(predictions, specific_hosts)
) всегда выдаёт 0 как ни менять настройки. Датасет состоит из 5000 разнообразных данных. реши трабл