Edit model card

Model Architecture

  • Embedding Layer: Converts input text into dense vectors.
  • CNN Layers: Extracts features from text sequences.
  • RNN, LSTM, and GRU Layers: Capture temporal dependencies in text.
  • Dense Layers: Classify text into sentiment categories.

Usage

You can use this model for sentiment analysis on text data. Here's a sample code to load and use the model:

from tensorflow.keras.models import load_model
import pickle
import numpy as np
from tensorflow.keras.preprocessing.sequence import pad_sequences

# Load the model
model = load_model('path_to_model/hybrid_model.h5')

# Load the tokenizer
with open('path_to_tokenizer/tokenizer.pkl', 'rb') as f:
    tokenizer = pickle.load(f)

# Predict sentiment
def predict_sentiment(text):
    text = text.lower()
    text = re.sub(r'[^\w\s]', '', text)
    sequence = tokenizer.texts_to_sequences([text])
    padded_sequence = pad_sequences(sequence, maxlen=100)
    pred = model.predict(padded_sequence)
    sentiment = np.argmax(pred)
    return sentiment

# Example usage
text = "I love this product!"
print(predict_sentiment(text))
Downloads last month
7
Inference Examples
Inference API (serverless) does not yet support keras models for this pipeline type.