VishSinh commited on
Commit
417dab8
Β·
verified Β·
1 Parent(s): 4ad70dd

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +120 -2
README.md CHANGED
@@ -1,3 +1,121 @@
 
 
1
  ---
2
- pipeline_tag: time-series-forecasting
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Here’s a clean, detailed, and ready-to-go `README.md` for your Hugging Face repo! πŸ“šβœ¨
2
+
3
  ---
4
+
5
+ ## 🩸 **Cycle Sync: Menstrual Cycle Prediction using LSTM**
6
+
7
+ ### πŸš€ **Model Overview**
8
+ The `cycle-sync` model is built using a Long Short-Term Memory (LSTM) architecture trained to predict menstrual cycle lengths and period durations based on a user’s past period history.
9
+
10
+ ### πŸ”₯ **Model Highlights**
11
+ - 🧠 **Architecture:** LSTM (Long Short-Term Memory) with time-series inputs.
12
+ - πŸ“Š **Purpose:** Predict the next period start date and duration based on previous cycle data.
13
+ - 🎯 **Task Type:** `time-series-forecasting`
14
+ - πŸ“š **Framework:** Keras with TensorFlow backend.
15
+ - πŸ“ˆ **Scalers:** `MinMaxScaler` used for feature and label scaling.
16
+
17
+ ---
18
+
19
+ ## πŸ“‘ **Usage**
20
+
21
+ ### 🎨 **Load Model**
22
+ To load the model from Hugging Face, use the following code:
23
+
24
+ ```python
25
+ import keras
26
+ from datetime import timedelta
27
+ import numpy as np
28
+ import pickle
29
+
30
+ # Load the model from Hugging Face
31
+ model = keras.saving.load_model("hf://VishSinh/cycle-sync")
32
+
33
+ # Load the scalers (if needed)
34
+ with open("feature_scaler.pkl", "rb") as f:
35
+ feature_scaler = pickle.load(f)
36
+
37
+ with open("label_scaler.pkl", "rb") as f:
38
+ label_scaler = pickle.load(f)
39
+ ```
40
+
41
+ ---
42
+
43
+ ## πŸ“Š **Input & Output Schema**
44
+
45
+ ### πŸ“₯ **Input Format**
46
+ The model expects a 3D input of shape:
47
+ ```
48
+ (1, 3, 2)
49
+ ```
50
+ - **3**: Number of previous cycles used for prediction.
51
+ - **2**: Features - cycle length and period duration.
52
+
53
+ ### πŸ“€ **Output Format**
54
+ The model outputs a 1D array:
55
+ ```
56
+ [cycle_length, period_duration]
57
+ ```
58
+ - `cycle_length`: Predicted length of the next cycle.
59
+ - `period_duration`: Predicted duration of the next period.
60
+
61
+ ---
62
+
63
+ ## 🎯 **Prediction Example**
64
+
65
+ ```python
66
+ # Example input: 3 cycles with lengths and durations
67
+ last_three_cycles = np.array([[[28, 5], [29, 5], [30, 6]]])
68
+
69
+ # Scale the input
70
+ input_flat = last_three_cycles.reshape(-1, 2)
71
+ input_scaled_flat = feature_scaler.transform(input_flat)
72
+ input_scaled = input_scaled_flat.reshape(1, 3, 2)
73
+
74
+ # Make prediction
75
+ prediction_scaled = model.predict(input_scaled)
76
+ prediction = label_scaler.inverse_transform(prediction_scaled)[0]
77
+
78
+ # Extract predicted values
79
+ next_cycle_length = round(prediction[0])
80
+ next_period_duration = round(prediction[1])
81
+
82
+ print(f"Predicted Next Cycle Length: {next_cycle_length} days")
83
+ print(f"Predicted Period Duration: {next_period_duration} days")
84
+ ```
85
+
86
+ ---
87
+
88
+ ## πŸ“š **Training Details**
89
+ - **Data Sources:** Synthetic and real menstrual cycle data.
90
+ - **Model Architecture:** 2-layer LSTM with dropout and dense output.
91
+ - **Loss Function:** Mean Squared Error (MSE)
92
+ - **Optimizer:** Adam
93
+
94
+ ---
95
+
96
+ ## πŸ“Š **Evaluation Metrics**
97
+ - πŸ“ **MAE:** ~1.2
98
+ - πŸ“ **MSE:** ~2.5
99
+
100
+ ---
101
+
102
+ ## πŸ”’ **License**
103
+ This model is licensed under the Apache 2.0 License.
104
+
105
+ ---
106
+
107
+ ## 🀝 **Contributing**
108
+ We welcome contributions! Please open an issue or submit a pull request if you’d like to improve the model or documentation.
109
+
110
+ ---
111
+
112
+ ## ❀️ **Acknowledgements**
113
+ Special thanks to the healthcare community and menstrual health advocates who contributed to building this predictive model.
114
+
115
+ ---
116
+
117
+ πŸŽ‰ **Ready to predict and empower users with data-driven cycle predictions!** πŸ’‘
118
+
119
+ ---
120
+
121
+ Let me know if you need help uploading or tweaking this! πŸš€πŸ˜Š