Bhaskar Kumar
commited on
Commit
•
e917f3e
1
Parent(s):
0192cf1
Initial commit of my Keras model
Browse files
README.md
CHANGED
@@ -18,4 +18,88 @@ The above model is a simple neural network built using TensorFlow/Keras. It is
|
|
18 |
|
19 |
|
20 |
|
|
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
|
20 |
|
21 |
+
# Keras Model for Time Series Prediction
|
22 |
|
23 |
+
This repository contains a Keras model trained for time series prediction. The model has been deployed to Hugging Face Hub and can be used to predict numeric values based on timestamped data.
|
24 |
+
|
25 |
+
## Model Overview
|
26 |
+
|
27 |
+
The model is a simple neural network built using Keras. It is designed to perform regression tasks, predicting a numeric value from input features.
|
28 |
+
|
29 |
+
### Architecture
|
30 |
+
|
31 |
+
- **Input Layer**: 10 neurons, ReLU activation
|
32 |
+
- **Hidden Layer**: 10 neurons, ReLU activation
|
33 |
+
- **Output Layer**: 1 neuron (for regression)
|
34 |
+
|
35 |
+
## How to Use the Model
|
36 |
+
|
37 |
+
To use this model, follow the steps below:
|
38 |
+
|
39 |
+
### 1. Install Required Libraries
|
40 |
+
|
41 |
+
Make sure you have the necessary libraries installed:
|
42 |
+
|
43 |
+
```bash
|
44 |
+
pip install tensorflow huggingface-hub pandas matplotlib
|
45 |
+
|
46 |
+
#load the model from the Hugging Face Hub:
|
47 |
+
import tensorflow as tf
|
48 |
+
from huggingface_hub import from_pretrained_keras
|
49 |
+
import pandas as pd
|
50 |
+
import numpy as np
|
51 |
+
import matplotlib.pyplot as plt
|
52 |
+
|
53 |
+
# Load the model from Hugging Face Hub
|
54 |
+
model = from_pretrained_keras("iiitbh18/bhaskar1")
|
55 |
+
|
56 |
+
# Prepare Dummy Data
|
57 |
+
|
58 |
+
# Create a DataFrame with dummy data
|
59 |
+
dummy_data = {
|
60 |
+
'timestamp': [
|
61 |
+
'2024-08-07 02:43:28.788',
|
62 |
+
'2024-08-07 02:43:28.788',
|
63 |
+
'2024-08-07 02:43:43.788',
|
64 |
+
'2024-08-07 02:43:43.788',
|
65 |
+
'2024-08-07 02:43:58.788'
|
66 |
+
],
|
67 |
+
'value': [
|
68 |
+
99.00000005960464,
|
69 |
+
98.90000000596046,
|
70 |
+
98.70000004768372,
|
71 |
+
99.00000005960464,
|
72 |
+
98.89999993145466
|
73 |
+
]
|
74 |
+
}
|
75 |
+
|
76 |
+
df = pd.DataFrame(dummy_data)
|
77 |
+
|
78 |
+
#Prepare Data for Prediction
|
79 |
+
|
80 |
+
X_dummy = df['value'].values.reshape(-1, 1) # Reshape to match model's input shape
|
81 |
+
|
82 |
+
|
83 |
+
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
# Make Predictions
|
90 |
+
|
91 |
+
predictions = model.predict(X_dummy)
|
92 |
+
print("Predictions:", predictions)
|
93 |
+
|
94 |
+
#Visualize the Results
|
95 |
+
|
96 |
+
# Plot actual vs. predicted values
|
97 |
+
plt.figure(figsize=(10, 6))
|
98 |
+
plt.scatter(df['timestamp'], df['value'], color='blue', label='Actual Values')
|
99 |
+
plt.scatter(df['timestamp'], predictions, color='red', label='Predicted Values')
|
100 |
+
plt.xlabel('Timestamp')
|
101 |
+
plt.ylabel('Value')
|
102 |
+
plt.title('Actual vs Predicted Values')
|
103 |
+
plt.legend()
|
104 |
+
plt.xticks(rotation=45)
|
105 |
+
plt.show()
|