BOX
BOX
Team Members: Isabella Hanif, Likhitha Musunuru, Saanvi Kakarlapudi, Vincent Thai, and Aykhan Salimov
Faculty: Prof. Sanghamitra Dutta
Graduate Student: Sachindra Pasan Dissanayake
Teaching Assistant: Amber Melton
OUR STEPS:
1) Preprocessing and Training Model
2) Data Analysis using LIME and SHAP visualizations
3) Evaluating Bias and Accuracy
4) Zero Shot Classification with ChatGPT 3.5 Turbo
Categorical data has variables that stand for categories such as different kinds of education levels. Because most machine learning models deal with numbers, we need to turn these categories into numbers. A one-hot encoder makes a new binary column for each category. This makes sure the model treats each category the same way without thinking there's any natural order or importance.
Hidden layers are important layers of a neural network that sit between the input and output layers. They contain neurons that profit the input data through weights and biases which are modified during training. Because data passes through these layers, the network learns to recognize patterns and traits in data. More hidden layers enable the network to understand more subtle aspects in data, making the neural network more exceptional on tasks like recognizing images or language. In the course of training, the network adjusts the weights and biases according to the errors to increase the network performance.
This is most important step when dealing with data and it includes cleaning and organizing the data to be put into the model. This involves clearing unneeded columns and dealing with null values.
This code is responsible for preparing the dataset X, which includes pre-processing via handling missing values and dealing with encoding categorical features. It replaces missing values with the most frequently occurring class of categorical features and uses LabelEncoder to convert these categories to numbers while keeping a list of categories encountered.
For numerical features, it replaces missing values with the most frequently occurring feature. The pre-processing pipeline is constructed using ColumnTransformer, utilizing StandardScaler to standardize numerical features and OneHotEncoder to one-hot encode categorical features, which converts categorical features to binary vectors. The entire pre-processing pipeline ensures all features are manipulated correctly for machine learning models.
Training the Model:
Logistic regression was selected for SHAP, LIME, and zero-shot classification due to its interpretability, efficiency, and transparent feature interpretation, which are essential in generating explanations. Logistic regression was a particularly good choice as a baseline, and it also generates probabilistic output making it applicable for zero-shot classification. The compatibility of this model with both SHAP and LIME allows for easier explanation of more complex models.
A confusion matrix is a table that is used to evaluate the performance of a classification model. It shows the number of correct and incorrect predictions made by the model compared to the actual outcomes (true labels) in the data. The importance of the Confusion Matrix is representing our Model effectiveness in its entirety. The amount of values that are correctly and incorrectly predicted is the main indicator as to how well a model performs.
In machine learning, a decision boundary is a dividing line that separates different classes in a dataset. It is determined by the model based on the features (inputs) it is given. In order to prevent overfitting — which is when the model machine learning fits too closely with the training data, causing it to make inaccurate predictions from testing data — the curve of the decision boundary may not be too warped and fitted around the data. Regularization is a way to address overfitting
Using LIME and SHAP
LIME, which stands for Local Interpretable Model-agnostic Explanations, generates local explanations for model predictions, highlighting the important features for individual instances.
SHAP, which stands for SHapely Additive exPlanations, is used to explain the output of a machine learning model. It shows the effects of each feature on the whole prediction of the model.
In the picture above is a representation of LIME, where a small sample has gone through a Linear Regression Model in order for us to examine why the model has made this prediction. There is the central point, and the data surrounds the point. Then the model will interpret a 0 or 1 based on this decision boundary. LIME acts as a local explainer, considering only the input instance. It samples data around the input instance and fits a linear regression model to these samples. The coefficients of this linear model indicate the importance of each feature for the model's prediction. This model showcases the specific features and the coefficient values.
We used SHAP for visualization during our process. Especially when we removed select features to observe their impact on model prediction, we needed a clearer way to see how the features impacted the overall predictions of the model and how their correlations changed when dropping features. For example, if we want to know how important age is, we train the model with and without the age feature and observe the difference in predictions. We repeat this process with various combinations and average the results to find which features contribute to bias. SHAP made it easier to visualize and understand, so we could determine that there was bias within the data.
Bias and Accuracy
One key aspect of model trustworthiness is the absence of bias, which can significantly impact the fairness and reliability of AI predictions. By analyzing the variations of data below, we'll uncover insights into the trade-offs between a model's predictive power and fairness. Accuracy is the measure of how well the model has performed. Amongst the changes we made by extracting features from the dataset, there are noticeable changes. These contribute to the overall accuracy of the model in where it correctly identifies instances in which a person has an annual income of over 50K or not.
This dataset includes all the features, and here you can see that education and marital-status have a large effect on the model as a whole.
We've intentionally removed the gender column, seeing that occupation has 0.10+ more of an impact in the overall prediction.
When we removed the race feature, relationship has a -0.07 effect on the model effectiveness. Also, here there is only a 12.4% chance a person has an annual income of over 50k, which is pretty low.
When the capital-gain column is removed, it only produced minor changes in the importance of the features. In the top right-hand corner, f(x) = 0.324 means that a person is 32.4% likely to have an income of over 50K. This was larger than the prediction of the original data.
Zero Shot Classification
Zero Shot Classification is when a model without any prior training, classifies data into different unseen categories. As a part of our research, we used OpenAI as our large language model to classify individuals as earning above or under $50,000 given input features. Specifically, we used the ChatGPT 3.5 Turbo model.
We assigned questions and asked the model based on the data if it was more likely that a person was to have an annual income of over 50k. We were able to generate a Yes or No prediction in a zero shot way without any specific. We used our previously trained model as its too big to train specifically. We get insight to which features this model is focusing on to make its prediction
Here is a graph displaying the coefficients of every variable. Numerical values have integer values while categorical values have object values. Formerly we assigned an integer value for the categorical features in order to analyze the data. The coefficients are telling us which features are most important, or have the most impact on the predictions.
For example, here the capital-loss is showing a positive impact on whether your income is larger than 50k. This means that the more money you lose, the more likely you have a high income. When comprehending this, its obvious that this is improbable in the real world.
In our model we used Machine Learning to identify the probability for whether someone has an annual income of more than $50,000 or not. The analysis performed with this dataset can be used for banks and financial institutions to determine if someone is more likely to pay back or default their loan. Similarly this can be used in a larger spectrum to determine someone's financial situation and how adequate they are to take care of children or open a small business. Identifying certain features that contribute to the models bias is also an integral part of ensuring AI models are trustworthy. We saw in our data that race and gender did have some impact on our data. This is one of the most constant issues in real world Machine Learning Models. Amazon's hiring AI in 2018 developed a bias against women applicants because the data given had predominantly hired male workers. These mistakes can affect an entire company's reputation and workforce. Our work is to examine machine learning models and use different techniques to guarantee that no discrimination is caused by AI when making human-like decisions.