Icon

TrainingWorkflow

Annotations and comments
  • MODELS
  • Important Notice Some metanodes and components are marked with asterisks (*) to denote varying levels of computational intensity: * : Moderate computational intensity. ** : Substantial computational intensity. *** : Maximum computational intensity. Nodes or components without asterisks have no special computational considerations.
  • GradientBoosting
  • Setting up the Environment It is important to note that Conda must be set up and configured in the Preferences of the KNIME Conda Integration. The packages used in this workflow are: Python: catboost, numpy, matplotlib, pandas, scikit-learn, seaborn R: cairo, clValid, ggally, rserve, tidyverse
  • XGBoost
  • Preprocessing the Training Set This component includes all the preprocessing steps applied to the training set and saves the necessary metrics to ensure the same transformations can be consistently applied to the test set.
  • Partitioning of the Dataset The dataset was initially split using stratified sampling based on the target variable, Risk_Flag, into a training set with 201,600 observations (80% of the total) and a test set with 50,400 observations (20% of the total). This approach will enable the models to be evaluated on data that simulates real-world unseen scenarios.
  • RandomForest
  • Preprocessing the Test Set This component ensures that all preprocessing modifications applied to the training set are mirrored on the test set, enabling accurate evaluation of model performance on unseen data.
  • Importing the File Steps needed to import and change into a proper table format the Json file from the Kaggle link: https://www.kaggle.com/datasets/rohit265/loan-approval-dataset
  • CatBoost
  • Stacked (GB + XGB + RF + CB -> LR)
  • Training of the Final Best Model - RandomForest
  • Removal of the Id column
  • This node ensures the existence of a Conda environment and propagates the environment to Python, R, or other Conda-aware downstream nodes
  • Mean Marital
  • Count Car
  • Mean Car
  • Count Home
  • Mean Home
  • Count Profession
  • Mean Profession
  • Count Marital
  • High City
  • Low City
  • High State
  • Low State
  • Color Assignment for Marital_status
  • Color Assignment for Car_Ownership
  • Color Assignment for House_Ownership
  • Color Assignment for the two classes
  • Converting Risk_Flag back into a string format to be able to group by in the Pie Chart
  • Income
  • JOB_YRS
  • Age
  • House_YRS
  • Experience
  • Changing Risk_Flag back into a string format to group by in the conditional box plot
  • A general view of the Categorical Variables
  • A general view of the Numerical Variables
  • Oversampling 570%
  • Undersampling 80%
  • The model gets saved in a folder at the deployment workflow location
  • Training the model with the best parameters on the whole balanced dataset
  • select the path of the .json file here
  • Needed for the H2O environment
  • Grouping by State and aggregating the mean for the remaining numerical variables
  • Z-score
  • Recoding the names of the clusters with the corresponding mean of the variable Risk_Flag
  • Profession, City, and State columns have been removed, in their place the columns: Profession_Encoded, City_Encoded, Cluster_STATE
  • The values of the Clusters have been joined with the full table on the key "State"
  • The values of the Target Encoding have been joined with the full table on the key "Profession"
  • The values of the Target Encoding have been joined with the full table on the key "City"
  • Once the encodings of the categorical variables have been made, we change the target variable Risk_Flag back to a string format
  • Marital_status: single = 1 married = 0
  • Car_Ownership: no = 1 yes = 0
  • House_Ownership: rented = 2 norent_noown = 1 owned = 1
  • All the numerical variables have been changed from string format to numeric
  • 3-fold Cross Validation with stratified sampling for Risk_Flag
  • Best Params: ntrees=500 maxdepth=40 eta=0.01
  • ntrees = [100 - 500] , step size = 200 max_depth = [20 - 80] , step size = 20 eta = [0.01 - 0.1] , step size = 0.05
  • The AUC is calculated and sent to the loop end node to check for the best value across the different loops
  • Best Params: ntree=100 max_depth=60 eta=0.06
  • ntree = [100 - 500] , step size = 200 max_depth = [20 - 80] , step size = 20 eta = [0.01 - 0.1] , step size = 0.05
  • Best Params: ntrees=60 maxdepth=80
  • ntrees = [20 - 100] , step size = 20 max_depth = [40 - 100] , step size = 20
  • Best Params: learning_rate=0.03 depth=12 iterations=800
  • learning_rate = [0.03 - 0.09] , step size = 0.03 depth = [8 - 12] , step size = 2 iterations = [200 - 800] , step size = 300
  • 70% Subtraining 30% Validation
  • Best Params: Regularization=Laplace Variance=0.1 Step=0.01 Epoch=500 Epsilon=1e-2
  • Regularization = ["Uniform" , "Gauss" , "Laplace"] Variance = [0.1 , 1 , 10 ] Step = [0.01 , 0.1 , 1] Epoch = [50 , 100 , 500] Epsilon = [1e-4 , 1e-3 , 1e-2]
  • 80% Training 20% Test
  • The unnecessary columns are removed
  • Renaming P (Risk_Flag=1) to Gradient Boosting for better clarity
  • Renaming P (Risk_Flag=1) to XGBoostfor better clarity
  • Renaming P (Risk_Flag=1) to RandomForest for better clarity
  • Renaming Probability to CatBoost for better clarity
  • Renaming P (Risk_Flag=1) to Stacked Model for better clarity
  • The five ROC curves are plotted in one chart
  • This will be the Test Set for the Stacked Model
  • Renaming column from "Probability" to "CatBoost_Proba" for better clarity
  • Renaming column from "P (Risk_Flag=1)" to "RF_Proba" for better clarity
  • Renaming column from "P (Risk_Flag=1)" to "XGBoost_Proba" for better clarity
  • Renaming column from "P (Risk_Flag=1)" to "Gradient_Proba" for better clarity
  • Gradient
  • Dataset with also categorical columns
  • Dataset with only numerical columns
  • Training the model with the best parameters on the whole balanced subtraining set
  • This will be the Training Set for the Stacked Model
  • Best Params: ntrees=500 maxdepth=40 eta=0.06
  • Best Params: ntrees=100 maxdepth=60
  • 75% Subtraining 25% Validation
  • The columns from the Target Encoding of both variables have been appended to the original table
  • House_Ownership: rented = 2 owned = 1 norent_noown = 0
  • Marital_status
  • House_Ownership
  • City
  • Car_Ownership
  • City square brackets
  • State square brackets
  • All strings to number
  • Silhouette Coefficient
  • Dunn Index
  • Davies–Bouldin index
  • Grouping by Profession and aggregating the mean for the remaining numerical variables
  • K = [3 - 10] , step size = 1
  • Davies-Bouldin Index
  • Renaming from Cluster to Cluster_STATE
  • Profession
  • State
  • *needed for plot aestethics
  • Silhouette
  • Dunn
  • Davies-Bouldin
  • House_Ownership: rented = 2 norent_noown = 1 owned = 0
  • Confusion Matrix
  • Training the model with the best parameters on the whole balanced training set

Nodes

Extensions

Links