# Nomological Deductive Reasoning for Trustworthy, Human-Readable, and Actionable AI Outputs
## 5 Nomological Deductive Reasoning (NDR): A Proposed Solution
### Ontology Design
#### 5.3.2 Data Processing and Model Training  
The German Credit Dataset [33] comprises 1000 credit applicants, each described by 20 financial and demographic attributes, including features such as credit history, loan duration, employment status, savings level, and age. The target variable, _Class_, indicates the applicant's creditworthiness, where a value of 1 represents Good Credit and a value of 0 denotes Bad Credit. The dataset contains a mixture of categorical and numerical variables, offering a comprehensive profile of each individual.  
**Data Preprocessing:**  
Categorical variables were transformed into numerical representations using label encoding. Numerical attributes were preserved in their original form. To ensure experimental reproducibility, the dataset was partitioned into a training set (70%) and a testing set (30%) using a fixed random seed (random_state = 42).  
**Model Training:**  
A Random Forest classifier was trained on the processed training set with the following settings:  
* Number of trees: n_estimators = 100;
* Criterion: default Gini impurity;
* Random seed for reproducibility: random_state = 42;
* Other hyper parameters retained their default Scikit-learn values.  
No additional hyper-parameter optimization (e.g., grid search or randomized search) was performed, as the objective was to demonstrate baseline model behavior integrated with the NDR framework.  
**Hardware and Software Environment:**  
The implementation environment consisted of Python 3.10.11 and Scikit-learn 1.5.1. Model training and evaluation were performed on a machine featuring an Intel Core i5-4200M CPU @ 2.5 GHz (2 cores) and 4 GB of RAM, running Windows 10.  
Given the relatively small size of the German Credit dataset (1000 instances), computational resource limitations did not impact the training or evaluation performance. The model was trained and evaluated within a reasonable timeframe without any notable delays or constraints.  
**Model Evaluation and Explanation Generation:**  
After training, the Random Forest model was used to generate predictions on the test set. These predictions were assessed using standard evaluation metrics (accuracy and confusion matrix). Additionally, a feature importance analysis was performed to identify the most influential variables, supporting the subsequent deductive reasoning.  
The predictions were then passed onto the Nomological Deductive Reasoning (NDR) framework, where they were evaluated against a structured financial knowledge base encoded with domain-specific laws. This process generated semantically grounded, human-readable explanations, aligning the model's decision-making with established banking norms and ontological definitions. The whole process is described by Algorithm 1, and the implementation code is publicly available at [[https://github.com/[PERSON]/NDR-Framework-Explainable-AI](https://github.com/HakizimanaGedeon/NDR-Framework-Explainable-AI)]([https://github.com/HakizimanaGedeon/NDR-Framework-Explainable-AI](https://github.com/HakizimanaGedeon/NDR-Framework-Explainable-AI)), accessed on 20 March 2025.