# Usage Example for the Fall Prediction Dataset # Please install dependencies before: # pip install -r requirements.txt # Import necessary libraries import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, LSTM, Dropout, Input from convert_and_load_dataset import load_dataset, convert_and_load_dataset # Example for local converting and loading (frist time usage take a while) # X_train, X_test, y_train, y_test = convert_and_load_dataset() # Example for local loading (first time usage may take a while) X_train, X_test, y_train, y_test = load_dataset() # Define a simple LSTM model model = Sequential() model.add(Input((X_train.shape[1], 1))) model.add(LSTM(64)) model.add(Dropout(0.2)) model.add(Dense(1, activation='sigmoid')) # Compile the model model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy']) # Train the model history = model.fit(X_train, y_train, epochs=10, batch_size=64, validation_data=(X_test, y_test)) # Evaluate the model on the test set loss, accuracy = model.evaluate(X_test, y_test) print(f"Test Accuracy: {accuracy * 100:.2f}%") # You can save the model if needed # model.save('fall_prediction_model.h5')