File size: 1,360 Bytes
7592386
c62089d
7592386
 
 
c62089d
7592386
c62089d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from  features.build_features import SplitDataset

from  models.logistic_train_model import logistic_train_model
from  models.logistic_predict_model import logistic_predict_model
from  models.logistic_test_model import logistic_test_model

from  models.util_model_class import ModelClass


def logistic_class(split_dataset: SplitDataset, currency: str) -> ModelClass:

    # Train Model
    clf_logistic_model = logistic_train_model(split_dataset)

    # Predict using Trained Model
    clf_logistic_predictions = logistic_predict_model(
        clf_logistic_model, split_dataset)

    # Test and Evaluate Model
    df_trueStatus_probabilityDefault_threshStatus_loanAmount_logistic = logistic_test_model(
        clf_logistic_model,
        split_dataset,
        currency,
        clf_logistic_predictions.probability_threshold_selected,
        clf_logistic_predictions.predicted_default_status)

    return ModelClass(
        model=clf_logistic_model,
        trueStatus_probabilityDefault_threshStatus_loanAmount_df=df_trueStatus_probabilityDefault_threshStatus_loanAmount_logistic,
        probability_threshold_selected=clf_logistic_predictions.probability_threshold_selected,
        predicted_default_status=clf_logistic_predictions.predicted_default_status,
        prediction_probability_df=clf_logistic_predictions.prediction_probability_df,
    )