*[2. Data Preprocessing](#2-data-preprocessing-folder)
*[3. ML Model Development](#3-ml-model-development-folder)
*[4. Service Files](#4-Service-Files-folder)
*[5. Fast API & app file](#5-Fast-API-&-app-file-folder)
[Executing Function 1 on Google Colab](#executing-function-1-on-google-colab)
-------------
## Function 1 Development
### 1. Dataset Creation ()
- Within this folder, you'll discover two Python scripts developed for dataset generation:
-`dataset_gen.py`: This script generates synthetic data for two games, "Clock Challenge" and "Number Sequence," and stores the data in a CSV file.
-`dataset_gen_add_improvement.py`: This script calculates an improvement score for each row in the dataset, and the final dataset incorporates this score, quantifying the child's progress on a scale of 1 to 10 based on their interactions with the game.
- You can also access the saved CSV files in this folder.
### 2. Data Preprocessing ()
- Inside this folder, you'll come across two Jupyter Notebooks dedicated to data preprocessing:
-`dataset_analysis.ipynb`: This file primarily involves loading the dataset created in the dataset creation step, removing the timestamp, and saving the resulting dataset as 'final_game_dataset.csv'. It also includes some dataset analysis.
-`dataset_preprocess.ipynb`: In this notebook, the 'final_game_dataset' is loaded, and standard scaling is applied. The resulting scalers are saved as 'scaler_X.pkl' and 'scaler_y.pkl,' respectively.
- Additionally, you can locate the 'final_game_dataset.csv' in this folder.
### 3. ML Model Development ()
- Within this directory, there are two crucial files:
-`ml_model_dev.ipynb`: This file is responsible for developing the model for function 2.
-`final_model_deploy.ipynb`: In this file, you will discover the deployment code to test the saved model with user inputs:
``` python
# Example usage:
success_count=8
attempt_count=10
game_score_xp=73
game_level=9
engagement_time_mins=5
```
- The saved model exceeds the size limit for GitHub uploads, so you'll need to download it from [Google Drive]() and place it inside the 'MLModelDev/fun1' folder as follows:
---------------------
### 4. Service Files ()
- Within this directory, there are one python ".py" files:
-`self_improvement.py`: This service file include the total process of function 01.
- Process :firstly get the player dataset and caluculate the real time improvement ,compaired the previouse improvement score and get the future time(One week or two week) improvment prediction
- Within this app.py module include one Fast API end points for function 1 :
- 1. Request body : Connect the real time played database and use the player_name to compil this function(player_name :rQIRSQe3ZYTRDGfvRb8dvzaCKkA2)
- Special Note:We need to create that database as mentioned in below link player_game_dataset.csv ([Link](https://drive.google.com/drive/folders/1mRzLkdMJLO-5pc4vBxvdmv1B2WD5i2Lg?usp=drive_link))
- Upload the file named [`Colab_LearnJoy_Function1_Final_Deploy.ipynb`](/Function1/MLModelDev/Colab_LearnJoy_Function1_Final_Deploy.ipynb)
to your Google Colab environment.
- To execute Function 1, you can upload the downloaded `requirements.txt` file to Colab by following these steps:
1. Download the [`requirements.txt`](/requirements.txt) from GitHub repo.
2. Drag and drop the file into Google colab.
3. And run the first command to execute it.
4. After the installation restart the Runtime.
5. Upload the saved pkl files to drive and change the paths inside the code.
6. You can now run the code.
------------------
## FastAPI Development
- To run the API, please ensure you have installed the required packages, "fastapi" and "uvicorn." If you haven't already installed them, you can do so using the following commands:
```bash
pip install fastapi
pip install"uvicorn[standard]"
```
- Once these packages are installed, you can proceed to run the API.
1. To run the api, use the following command inside the API folder:
```bash
python main.py
```
2. You can access the project output in your browser using the following URL:
```bash
http://127.0.0.1:8000
```
3. To explore the API documentation, visit:
```bash
http://127.0.0.1:8000/docs
```
------------------------
## Setting Up the Development Environment
Follow these steps to set up your development environment for this project:
### Create a New `venv`
1. Navigate to your project directory:
```bash
cd /path/to/your/project
```
2. Create a virtual environment:
```bash
python -m venv <venv_name>
```
### Activate and Deactivate `venv`
- In `cmd`:
```bash
<venv_name>\Scripts\activate
```
- In bash:
```bash
source <venv_name>/Scripts/activate
# To deactivate the virtual environment:
deactivate
```
### Create, Activate & Deactivate `venv` using conda
- Use Anaconda Navigator to create a venv:
```bash
# Activate the conda environment
conda activate <venv_name>
# To deactivate the conda environment
conda deactivate
```
### Install the Dependencies
- You can also use a `requirements.txt` file to manage your project's dependencies. This file lists all the required packages and their versions.
1. Install packages from `requirements.txt`:
```
pip install -r requirements.txt
```
This ensures that your development environment matches the exact package versions specified in `requirements.txt`.
2. Verify installed packages:
```bash
pip list
```
This will display a list of packages currently installed in your virtual environment, including the ones from `requirements.txt`.