20
20
import numpy as np
21
21
import plotly .graph_objs as go
22
22
from dash import Input , Output , State , dcc , html
23
- import tensorflow as tf
24
- from tensorflow import keras
25
- from keras .models import load_model
26
- import xgboost
23
+ # import tensorflow as tf
24
+ # from tensorflow import keras
25
+ # from keras.models import load_model
26
+ # import xgboost
27
27
import re
28
28
29
29
@@ -462,7 +462,7 @@ def process_input(n_clicks1, n_clicks2, n_clicks3, n_clicks4, n_clicks5, n_click
462
462
463
463
rmse , rmse_tf = regression_model_info_extractor ("Suchey_Brooks_1990" )
464
464
465
- regression = output_regression (y_regression_sklearn [0 ],rmse ,y_regression_tf [0 ][ 0 ] ,rmse_tf )
465
+ regression = output_regression (y_regression_sklearn [0 ],rmse ,y_regression_tf [0 ],rmse_tf )
466
466
467
467
classification = output_classification (y_classification_sklearn [0 ], \
468
468
y_classification_tf [0 ])
@@ -479,7 +479,7 @@ def process_input(n_clicks1, n_clicks2, n_clicks3, n_clicks4, n_clicks5, n_click
479
479
480
480
rmse , rmse_tf = regression_model_info_extractor ("Meindl_and_Lovejoy" )
481
481
482
- regression = output_regression (y_regression_sklearn [0 ],rmse ,y_regression_tf [0 ][ 0 ] ,rmse_tf )
482
+ regression = output_regression (y_regression_sklearn [0 ],rmse ,y_regression_tf [0 ],rmse_tf )
483
483
484
484
classification = output_classification (y_classification_sklearn [0 ], \
485
485
y_classification_tf [0 ])
@@ -494,7 +494,7 @@ def process_input(n_clicks1, n_clicks2, n_clicks3, n_clicks4, n_clicks5, n_click
494
494
495
495
rmse , rmse_tf = regression_model_info_extractor ("Lovejoy_et_al" )
496
496
497
- regression = output_regression (y_regression_sklearn [0 ],rmse ,y_regression_tf [0 ][ 0 ] ,rmse_tf )
497
+ regression = output_regression (y_regression_sklearn [0 ],rmse ,y_regression_tf [0 ],rmse_tf )
498
498
499
499
classification = output_classification (y_classification_sklearn [0 ], \
500
500
y_classification_tf [0 ])
@@ -509,7 +509,7 @@ def process_input(n_clicks1, n_clicks2, n_clicks3, n_clicks4, n_clicks5, n_click
509
509
510
510
rmse , rmse_tf = regression_model_info_extractor ("Buckberry_and_Chamberlain" )
511
511
512
- regression = output_regression (y_regression_sklearn [0 ],rmse ,y_regression_tf [0 ][ 0 ] ,rmse_tf )
512
+ regression = output_regression (y_regression_sklearn [0 ],rmse ,y_regression_tf [0 ],rmse_tf )
513
513
514
514
classification = output_classification (y_classification_sklearn [0 ], \
515
515
y_classification_tf [0 ])
@@ -525,7 +525,7 @@ def process_input(n_clicks1, n_clicks2, n_clicks3, n_clicks4, n_clicks5, n_click
525
525
526
526
rmse , rmse_tf = regression_model_info_extractor ("Suchey_Brooks_1990_and_Lovejoy_et_al" )
527
527
528
- regression = output_regression (y_regression_sklearn [0 ],rmse ,y_regression_tf [0 ][ 0 ] ,rmse_tf )
528
+ regression = output_regression (y_regression_sklearn [0 ],rmse ,y_regression_tf [0 ],rmse_tf )
529
529
530
530
classification = output_classification (y_classification_sklearn [0 ], \
531
531
y_classification_tf [0 ])
@@ -541,7 +541,7 @@ def process_input(n_clicks1, n_clicks2, n_clicks3, n_clicks4, n_clicks5, n_click
541
541
542
542
rmse , rmse_tf = regression_model_info_extractor ("Suchey_Brooks_1990_and_Buckberry_Chamberlain" )
543
543
544
- regression = output_regression (y_regression_sklearn [0 ],rmse ,y_regression_tf [0 ][ 0 ] ,rmse_tf )
544
+ regression = output_regression (y_regression_sklearn [0 ],rmse ,y_regression_tf [0 ],rmse_tf )
545
545
546
546
classification = output_classification (y_classification_sklearn [0 ], \
547
547
y_classification_tf [0 ])
@@ -560,7 +560,7 @@ def process_input(n_clicks1, n_clicks2, n_clicks3, n_clicks4, n_clicks5, n_click
560
560
561
561
rmse , rmse_tf = regression_model_info_extractor ("All" )
562
562
563
- regression = output_regression (y_regression_sklearn [0 ],rmse ,y_regression_tf [0 ][ 0 ] ,rmse_tf )
563
+ regression = output_regression (y_regression_sklearn [0 ],rmse ,y_regression_tf [0 ],rmse_tf )
564
564
565
565
classification = output_classification (y_classification_sklearn [0 ], \
566
566
y_classification_tf [0 ])
@@ -573,11 +573,11 @@ def process_input(n_clicks1, n_clicks2, n_clicks3, n_clicks4, n_clicks5, n_click
573
573
def output_classification (y_sklearn , y_tf ):
574
574
575
575
text = (
576
- f"The sample is split into three age- groups, "
577
- f"14-34 (class 0), 35-49 (class 1), and 50- (class 2). "
578
- f"Using the sklearn library's classification algorithms we predict that "
579
- f"for the given input the sample belongs to the { y_sklearn } class, "
580
- f"and using a tensorflow neural network the prediction for the class is { y_tf } ."
576
+ f"The sample was divided into three age groups: "
577
+ f"14-34 (class 0), 35-49 (class 1), and 50+ (class 2). "
578
+ f"Utilizing classification algorithms from the sklearn library we predict "
579
+ f"that the given input belongs to class { y_sklearn } . "
580
+ f"Additionally, our neural network predicts that the input belongs to class { y_tf } ."
581
581
)
582
582
583
583
card = dbc .Card (
@@ -599,12 +599,12 @@ def output_classification(y_sklearn, y_tf):
599
599
def output_regression (result_sklearn , rmse_sklearn , result_tf , rmse_tf ):
600
600
601
601
text = (
602
- f"Using regression, we can make a prediction for the age directly . "
603
- f"Using the sklearn library's regression algorithms we predict an age of { result_sklearn :.1f} "
602
+ f"We can make a direct prediction for age using regression . "
603
+ f"With the help of regression algorithms from the sklearn library, we predict an age of { result_sklearn :.1f} "
604
604
f"\u00B1 "
605
605
f"{ rmse_sklearn :.1f} "
606
- f", and "
607
- f"using a tensorflow neural network we predict { result_tf :.1f} "
606
+ f". "
607
+ f"Additionally, our neural network predicts an age of { result_tf :.1f} "
608
608
f"\u00B1 "
609
609
f"{ rmse_tf :.1f} "
610
610
)
@@ -630,20 +630,26 @@ def calculate_y_vectors(model, X):
630
630
pickle .load (
631
631
open ("" .join (["./models/classification_right_" ,model ,".dat" ]), "rb" ))
632
632
classification_model_tf = \
633
- load_model (
634
- "" .join (["./models/ann_classification_right_" ,model ,".h5" ]))
633
+ pickle .load (
634
+ open ("" .join (["./models/ann_classification_right_" ,model ,".dat" ]), "rb" ))
635
+
636
+
637
+ # load_model(
638
+ # "".join(["./models/ann_classification_right_",model,".h5"]))
635
639
636
640
regression_model_sklearn = \
637
641
pickle .load (
638
642
open ("" .join (["./models/regression_right_" ,model ,".dat" ]), "rb" ))
639
643
regression_model_tf = \
640
- load_model (
641
- "" .join (["./models/ann_regression_right_" ,model ,".h5" ]))
644
+ pickle .load (
645
+ open ("" .join (["./models/ann_regression_right_" ,model ,".dat" ]), "rb" ))
646
+ # load_model(
647
+ # "".join(["./models/ann_regression_right_",model,".h5"]))
642
648
643
649
y_classification_sklearn = classification_model_sklearn .predict (X )
644
650
645
651
y_classification_tf = classification_model_tf .predict (X )
646
- y_classification_tf = np .argmax (y_classification_tf , axis = 1 )
652
+ # y_classification_tf = np.argmax(y_classification_tf, axis=1)
647
653
648
654
y_regression_sklearn = regression_model_sklearn .predict (X )
649
655
y_regression_tf = regression_model_tf .predict (X )
0 commit comments