6
6
import logging
7
7
import pickle
8
8
import sys
9
- from typing import Optional , Union
9
+ from typing import Optional , Union , Any
10
10
11
11
import yaml
12
12
@@ -21,23 +21,6 @@ class DataContainer:
21
21
A dictionary to store data items.
22
22
"""
23
23
24
- RAW = "raw"
25
- CLEAN = "clean"
26
- TRAIN = "train"
27
- VALIDATION = "validation"
28
- TEST = "test"
29
- MODEL = "model"
30
- MODEL_INPUT = "model_input"
31
- MODEL_OUTPUT = "model_output"
32
- METRICS = "metrics"
33
- PREDICTIONS = "predictions"
34
- EXPLAINER = "explainer"
35
- TUNING_PARAMS = "tuning_params"
36
- TARGET = "target"
37
- IMPORTANCE = "importance"
38
- DROP_COLUMNS = "drop_columns"
39
- FEATURES = "features"
40
-
41
24
def __init__ (self , initial_data : Optional [dict ] = None ):
42
25
"""
43
26
Initialize the DataContainer with an empty dictionary or provided data.
@@ -296,6 +279,319 @@ def from_yaml(cls, file_path: str) -> DataContainer:
296
279
# The loaded data is used as the initial data for the DataContainer instance
297
280
return cls (initial_data = data )
298
281
282
+ @property
283
+ def clean (self ) -> Any :
284
+ """
285
+ Get the clean data from the DataContainer.
286
+
287
+ Returns
288
+ -------
289
+ Any
290
+ The clean data stored in the DataContainer.
291
+ """
292
+ return self ["clean" ]
293
+
294
+ @clean .setter
295
+ def clean (self , value : Any ):
296
+ """
297
+ Set the clean data in the DataContainer.
298
+
299
+ Parameters
300
+ ----------
301
+ value
302
+ The clean data to be stored in the DataContainer.
303
+ """
304
+ self ["clean" ] = value
305
+
306
+ # create the same for raw
307
+ @property
308
+ def raw (self ) -> Any :
309
+ """
310
+ Get the raw data from the DataContainer.
311
+
312
+ Returns
313
+ -------
314
+ Any
315
+ The raw data stored in the DataContainer.
316
+ """
317
+ return self ["raw" ]
318
+
319
+ @raw .setter
320
+ def raw (self , value : Any ):
321
+ """
322
+ Set the raw data in the DataContainer.
323
+
324
+ Parameters
325
+ ----------
326
+ value
327
+ The raw data to be stored in the DataContainer.
328
+ """
329
+ self ["raw" ] = value
330
+
331
+ @property
332
+ def train (self ) -> Any :
333
+ """
334
+ Get the train data from the DataContainer.
335
+
336
+ Returns
337
+ -------
338
+ Any
339
+ The train data stored in the DataContainer.
340
+ """
341
+ return self ["train" ]
342
+
343
+ @train .setter
344
+ def train (self , value : Any ):
345
+ """
346
+ Set the train data in the DataContainer.
347
+
348
+ Parameters
349
+ ----------
350
+ value
351
+ The train data to be stored in the DataContainer.
352
+ """
353
+ self ["train" ] = value
354
+
355
+ @property
356
+ def validation (self ) -> Any :
357
+ """
358
+ Get the validation data from the DataContainer.
359
+
360
+ Returns
361
+ -------
362
+ Any
363
+ The validation data stored in the DataContainer.
364
+ """
365
+ return self ["validation" ]
366
+
367
+ @validation .setter
368
+ def validation (self , value : Any ):
369
+ """
370
+ Set the validation data in the DataContainer.
371
+
372
+ Parameters
373
+ ----------
374
+ value
375
+ The validation data to be stored in the DataContainer.
376
+ """
377
+ self ["validation" ] = value
378
+
379
+ @property
380
+ def model (self ) -> Any :
381
+ """
382
+ Get the model from the DataContainer.
383
+
384
+ Returns
385
+ -------
386
+ Any
387
+ The model stored in the DataContainer.
388
+ """
389
+ return self ["model" ]
390
+
391
+ @model .setter
392
+ def model (self , value : Any ):
393
+ """
394
+ Set the model in the DataContainer.
395
+
396
+ Parameters
397
+ ----------
398
+ value
399
+ The model to be stored in the DataContainer.
400
+ """
401
+ self ["model" ] = value
402
+
403
+ @property
404
+ def model_input (self ) -> Any :
405
+ """
406
+ Get the model input from the DataContainer.
407
+
408
+ Returns
409
+ -------
410
+ Any
411
+ The model input stored in the DataContainer.
412
+ """
413
+ return self ["model_input" ]
414
+
415
+ @model_input .setter
416
+ def model_input (self , value : Any ):
417
+ """
418
+ Set the model input in the DataContainer.
419
+
420
+ Parameters
421
+ ----------
422
+ value
423
+ The model input to be stored in the DataContainer.
424
+ """
425
+ self ["model_input" ] = value
426
+
427
+ @property
428
+ def model_output (self ) -> Any :
429
+ """
430
+ Get the model output from the DataContainer.
431
+
432
+ Returns
433
+ -------
434
+ Any
435
+ The model output stored in the DataContainer.
436
+ """
437
+ return self ["model_output" ]
438
+
439
+ @model_output .setter
440
+ def model_output (self , value : Any ):
441
+ """
442
+ Set the model output in the DataContainer.
443
+
444
+ Parameters
445
+ ----------
446
+ value
447
+ The model output to be stored in the DataContainer.
448
+ """
449
+ self ["model_output" ] = value
450
+
451
+ @property
452
+ def metrics (self ) -> Any :
453
+ """
454
+ Get the metrics from the DataContainer.
455
+
456
+ Returns
457
+ -------
458
+ Any
459
+ The metrics stored in the DataContainer.
460
+ """
461
+ return self ["metrics" ]
462
+
463
+ @metrics .setter
464
+ def metrics (self , value : Any ):
465
+ """
466
+ Set the metrics in the DataContainer.
467
+
468
+ Parameters
469
+ ----------
470
+ value
471
+ The metrics to be stored in the DataContainer.
472
+ """
473
+ self ["metrics" ] = value
474
+
475
+ @property
476
+ def predictions (self ) -> Any :
477
+ """
478
+ Get the predictions from the DataContainer.
479
+
480
+ Returns
481
+ -------
482
+ Any
483
+ The predictions stored in the DataContainer.
484
+ """
485
+ return self ["predictions" ]
486
+
487
+ @predictions .setter
488
+ def predictions (self , value : Any ):
489
+ """
490
+ Set the predictions in the DataContainer.
491
+
492
+ Parameters
493
+ ----------
494
+ value
495
+ The predictions to be stored in the DataContainer.
496
+ """
497
+ self ["predictions" ] = value
498
+
499
+ @property
500
+ def explainer (self ) -> Any :
501
+ """
502
+ Get the explainer from the DataContainer.
503
+
504
+ Returns
505
+ -------
506
+ Any
507
+ The explainer stored in the DataContainer.
508
+ """
509
+ return self ["explainer" ]
510
+
511
+ @explainer .setter
512
+ def explainer (self , value : Any ):
513
+ """
514
+ Set the explainer in the DataContainer.
515
+
516
+ Parameters
517
+ ----------
518
+ value
519
+ The explainer to be stored in the DataContainer.
520
+ """
521
+ self ["explainer" ] = value
522
+
523
+ @property
524
+ def tuning_params (self ) -> Any :
525
+ """
526
+ Get the tuning parameters from the DataContainer.
527
+
528
+ Returns
529
+ -------
530
+ Any
531
+ The tuning parameters stored in the DataContainer.
532
+ """
533
+ return self ["tuning_params" ]
534
+
535
+ @tuning_params .setter
536
+ def tuning_params (self , value : Any ):
537
+ """
538
+ Set the tuning parameters in the DataContainer.
539
+
540
+ Parameters
541
+ ----------
542
+ value
543
+ The tuning parameters to be stored in the DataContainer.
544
+ """
545
+ self ["tuning_params" ] = value
546
+
547
+ @property
548
+ def target (self ) -> Any :
549
+ """
550
+ Get the target from the DataContainer.
551
+
552
+ Returns
553
+ -------
554
+ Any
555
+ The target stored in the DataContainer.
556
+ """
557
+ return self ["target" ]
558
+
559
+ @target .setter
560
+ def target (self , value : Any ):
561
+ """
562
+ Set the target in the DataContainer.
563
+
564
+ Parameters
565
+ ----------
566
+ value
567
+ The target to be stored in the DataContainer.
568
+ """
569
+ self ["target" ] = value
570
+
571
+ @property
572
+ def features (self ) -> Any :
573
+ """
574
+ Get the features from the DataContainer.
575
+
576
+ Returns
577
+ -------
578
+ Any
579
+ The features stored in the DataContainer.
580
+ """
581
+ return self ["features" ]
582
+
583
+ @features .setter
584
+ def features (self , value : Any ):
585
+ """
586
+ Set the features in the DataContainer.
587
+
588
+ Parameters
589
+ ----------
590
+ value
591
+ The features to be stored in the DataContainer.
592
+ """
593
+ self ["features" ] = value
594
+
299
595
def __eq__ (self , other ) -> bool :
300
596
"""
301
597
Compare this DataContainer with another for equality.
0 commit comments