Mercurial > repos > siwaa > wine_quality_train_eval
comparison toto_wine_quality_train_eval.py @ 10:b432386c0f1c draft
planemo upload for repository https://forgemia.inra.fr/nathalie.rousse/use/-/tree/dnn/DNN/galaxy-tools/wine_quality_train_eval commit e7fd13c34ec074a7ebc246301b5a80069dcbcc3a-dirty
author | siwaa |
---|---|
date | Thu, 05 Dec 2024 15:47:56 +0000 |
parents | 31d737992c63 |
children | b5f69f836e03 |
comparison
equal
deleted
inserted
replaced
9:31d737992c63 | 10:b432386c0f1c |
---|---|
96 | 96 |
97 # Import some packages | 97 # Import some packages |
98 import os | 98 import os |
99 import lightning.pytorch as pl | 99 import lightning.pytorch as pl |
100 import torchvision.transforms as T | 100 import torchvision.transforms as T |
101 from IPython.display import display, HTML | 101 from IPython.display import display, HTML ##toto## HTML |
102 from torch.utils.data import DataLoader, random_split | 102 from torch.utils.data import DataLoader, random_split |
103 from model_wine_lightning.modules.progressbar import CustomTrainProgressBar | 103 from model_wine_lightning.modules.progressbar import CustomTrainProgressBar |
104 from model_wine_lightning.modules.data_load import WineQualityDataset | 104 from model_wine_lightning.modules.data_load import WineQualityDataset |
105 from model_wine_lightning.modules.data_load import Normalize, ToTensor | 105 from model_wine_lightning.modules.data_load import Normalize, ToTensor |
106 from model_wine_lightning.modules.model import LitRegression | 106 from model_wine_lightning.modules.model import LitRegression |
184 error_msg += message + " " | 184 error_msg += message + " " |
185 | 185 |
186 datasets = WineQualityDataset(dataset_filepath) | 186 datasets = WineQualityDataset(dataset_filepath) |
187 print("datasets:") | 187 print("datasets:") |
188 #display(datasets.data.head(5).style.format("{0:.2f}")) | 188 #display(datasets.data.head(5).style.format("{0:.2f}")) |
189 display(datasets.data.head(5)) | 189 ##toto##display(datasets.data.head(5)) |
190 print('Missing Data : ',datasets.data.isna().sum().sum(), | 190 print('Missing Data : ',datasets.data.isna().sum().sum(), |
191 ' Shape is : ', datasets.data.shape) | 191 ' Shape is : ', datasets.data.shape) |
192 | 192 |
193 # ## Step 3 - Preparing the data | 193 # ## Step 3 - Preparing the data |
194 print("\n"+HEAD,"# ## Step 3 - Preparing the data\n") | 194 print("\n"+HEAD,"# ## Step 3 - Preparing the data\n") |
207 "min_json":N.min_json, "max_json":N.max_json} | 207 "min_json":N.min_json, "max_json":N.max_json} |
208 transforms = T.Compose([N, ToTensor()]) | 208 transforms = T.Compose([N, ToTensor()]) |
209 dataset = WineQualityDataset(dataset_filepath, transform=transforms) | 209 dataset = WineQualityDataset(dataset_filepath, transform=transforms) |
210 | 210 |
211 print("Before normalization :") | 211 print("Before normalization :") |
212 display(datasets[:]["features"]) | 212 ##toto##display(datasets[:]["features"]) |
213 print("After normalization :") | 213 print("After normalization :") |
214 display(dataset[:]["features"]) | 214 ##toto##display(dataset[:]["features"]) |
215 | 215 |
216 # ### 3.2 - Split data | 216 # ### 3.2 - Split data |
217 print("\n"+HEAD,"# ### 3.2 - Split data\n") | 217 print("\n"+HEAD,"# ### 3.2 - Split data\n") |
218 # We will use 80% of the data for training and 20% for validation. | 218 # We will use 80% of the data for training and 20% for validation. |
219 # x will be the features data of the analysis and y the target (quality) | 219 # x will be the features data of the analysis and y the target (quality) |