where is the function summary 


import pandas as pd
import numpy as np
import tensorflow as tf
import nltk
from tensorflow.keras.layers import Dense, Dropout, Embedding, Bidirectional, LSTM, SpatialDropout1D
from tensorflow.keras.models import Sequential
from tensorflow.keras.optimizers import AdamW
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
from sklearn.model_selection import train_test_split
from sklearn.utils import class_weight
from tensorflow.keras.callbacks import EarlyStopping
from nltk.sentiment import SentimentIntensityAnalyzer

# Download VADER lexicon for sentiment analysis
nltk.download('vader_lexicon')

# Initialize sentiment analyzer
sia = SentimentIntensityAnalyzer()

# Load validation data
val_data = pd.read_csv('Tweets.csv', header=0)
val_data['label'] = val_data['text'].map({'positive': 1, 'negative': 0, 'neutral': 0})

# Convert 'text' column to string data type if necessary
val_data['text'] = val_data['text'].astype(str)

# Apply VADER sentiment analysis to compute sentiment scores
val_data['vader_sentiment'] = val_data['text'].apply(lambda x: sia.polarity_scores(x)['compound'])

# Load data from a CSV file
data = pd.read_csv('Tweets.csv', skiprows=1, usecols=['airline_sentiment', 'text'])
data.columns = ['label', 'text']
data['label'] = data['label'].map({'positive': 1, 'negative': 0, 'neutral': 0})

# Apply VADER sentiment analysis to compute sentiment scores
data['vader_sentiment'] = data['text'].apply(lambda x: sia.polarity_scores(x)['compound'])

# Split data into training and validation sets
train_data, val_split_data = train_test_split(data, test_size=0.2, random_state=42)

# Convert 'text' column to string data type if necessary
train_data['text'] = train_data['text'].astype(str)
val_split_data['text'] = val_split_data['text'].astype(str)

# Define the valid labels
labels = [0, 1]

# Compute class weights
class_weights = class_weight.compute_class_weight(class_weight='balanced', classes=labels, y=train_data['label'])

# Create a Tokenizer object
tokenizer = Tokenizer(num_words=10000, oov_token='<OOV>')
tokenizer.fit_on_texts(train_data['text'])

# Tokenize text data
val_sequences = tokenizer.texts_to_sequences(val_split_data['text'])

# Convert text to numerical sequences
train_sequences = tokenizer.texts_to_sequences(train_data['text'])
val_sequences = tokenizer.texts_to_sequences(val_split_data['text'])

# Pad sequences
train_padded_sequences = pad_sequences(train_sequences, maxlen=200, padding='post')
val_padded_sequences = pad_sequences(val_sequences, maxlen=200, padding='post')

# Define neural network architecture
model = Sequential([
    Embedding(input_dim=len(tokenizer.word_index) + 1, output_dim=100, input_length=200),
    SpatialDropout1D(0.2),
    Bidirectional(LSTM(64, return_sequences=True)),
    Bidirectional(LSTM(32)),
    Dense(32, activation='relu'),
    Dropout(0.5),
    Dense(1, activation='sigmoid')
])
model.summary()

# Compile model with appropriate loss function and optimizer
optimizer = AdamW(learning_rate=0.001)
model.compile(loss='binary_crossentropy', optimizer=optimizer, metrics=['accuracy'])

# class weights to handle class imbalance
class_weight_dict = dict(enumerate(class_weights))

# Define early stopping to avoid overfitting
early_stopping = EarlyStopping(monitor='val_loss', patience=3, mode='min')

# Train model on training data
history = model.fit(train_padded_sequences, train_data['label'], epochs=10, batch_size=58,
validation_data=(val_padded_sequences, val_split_data['label']),
callbacks=[early_stopping], class_weight=class_weight_dict)

# Load the test data
test_data = pd.read_csv('stock_data.csv')
test_data['Text'] = test_data['Text'].astype(str)

# Apply VADER sentiment analysis to compute sentiment scores
test_data['vader_sentiment'] = test_data['Text'].apply(lambda x: sia.polarity_scores(x)['compound'])

# Preprocess the test data
test_sequences = tokenizer.texts_to_sequences(test_data['Text'])
test_padded_sequences = pad_sequences(test_sequences, maxlen=200, padding='post')

# Ensure the column name for labels is correct
test_text = test_data['Text']
test_labels = test_data['Sentiment']

# Evaluate the model on the test data
test_loss, test_accuracy = model.evaluate(test_padded_sequences, test_labels)

# Print the test accuracy
print("Test Accuracy:", test_accuracy)