Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
prat1999 authored Jul 25, 2021
1 parent 1b6d149 commit 0dde686
Show file tree
Hide file tree
Showing 2 changed files with 599 additions and 0 deletions.
216 changes: 216 additions & 0 deletions driver.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "driver.ipynb",
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "iKYmsVyQifJ0",
"outputId": "dd5d7e6f-5534-4e45-a8d1-442623b5c2ad"
},
"source": [
"!pip install pyitlib"
],
"execution_count": 17,
"outputs": [
{
"output_type": "stream",
"text": [
"Requirement already satisfied: pyitlib in /usr/local/lib/python3.7/dist-packages (0.2.2)\n",
"Requirement already satisfied: pandas>=0.20.2numpy>=1.9.2 in /usr/local/lib/python3.7/dist-packages (from pyitlib) (1.1.5)\n",
"Requirement already satisfied: scikit-learn>=0.16.0 in /usr/local/lib/python3.7/dist-packages (from pyitlib) (0.22.2.post1)\n",
"Requirement already satisfied: future>=0.16.0 in /usr/local/lib/python3.7/dist-packages (from pyitlib) (0.16.0)\n",
"Requirement already satisfied: scipy>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from pyitlib) (1.4.1)\n",
"Requirement already satisfied: numpy>=1.15.4 in /usr/local/lib/python3.7/dist-packages (from pandas>=0.20.2numpy>=1.9.2->pyitlib) (1.19.5)\n",
"Requirement already satisfied: python-dateutil>=2.7.3 in /usr/local/lib/python3.7/dist-packages (from pandas>=0.20.2numpy>=1.9.2->pyitlib) (2.8.1)\n",
"Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.7/dist-packages (from pandas>=0.20.2numpy>=1.9.2->pyitlib) (2018.9)\n",
"Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.7/dist-packages (from python-dateutil>=2.7.3->pandas>=0.20.2numpy>=1.9.2->pyitlib) (1.15.0)\n",
"Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.7/dist-packages (from scikit-learn>=0.16.0->pyitlib) (1.0.1)\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "LunZbhmzksAX"
},
"source": [
"from lambda_fuzzy_script3 import *"
],
"execution_count": 39,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "HzqXM3c8iiCP"
},
"source": [
"df = pd.read_csv(r'/content/JBHI_val_predmatrix.csv')"
],
"execution_count": 40,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "yuapuz_uixLe"
},
"source": [
"predict = df[['vgg16', 'xcep', 'incep']]\n",
"y_data = df['True Label']"
],
"execution_count": 41,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "oFBSW5NLix-N"
},
"source": [
"pred_mat = predict.values.tolist()\n",
"Y = y_data.values.tolist()"
],
"execution_count": 42,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "AjF4MtI4jFNk"
},
"source": [
"df_1 = pd.read_csv(r'/content/JBHI_test_confidencematrix.csv')"
],
"execution_count": 43,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "w2X_7qlMjG4j"
},
"source": [
"class_0 = df_1[['vgg16_class0','xcep_class0', 'incep_class0']]\n",
"class_1 = df_1[['vgg16_class1', 'xcep_class1', 'incep_class1']]\n",
"class_2 = df_1[['vgg16_class2', 'xcep_class2', 'incep_class2']]"
],
"execution_count": 44,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "oNESsPPUjLlN"
},
"source": [
"class_0 = class_0.values.tolist()\n",
"class_1 = class_1.values.tolist()\n",
"class_2 = class_2.values.tolist()"
],
"execution_count": 45,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "suH4Sc3ji5sS"
},
"source": [
"val = [.9498, .9674, .9649]\n",
"w = wt1(val)\n",
"shapley_value_list = shapley_calculation(pred_mat=pred_mat, w=w, Y=Y)\n",
"Subset_list=subset_list()\n",
"list_mu = Cal_lambda_fuzzy(shapley_value_list=shapley_value_list, Subset_list=Subset_list)\n",
"fa_cl0 = class_0_pred(class_0=class_0,list_mu=list_mu, Subset_list=Subset_list)\n",
"fa_cl1 = class_1_pred(class_1=class_1,list_mu=list_mu, Subset_list=Subset_list)\n",
"fa_cl2 = class_2_pred(class_2=class_2,list_mu=list_mu, Subset_list=Subset_list)\n",
"result1 = cal_result(fa_cl0, fa_cl1, fa_cl2)\n",
"print(result1)"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "zRI8lK-4i6RM"
},
"source": [
"val = [.9498, .9674, .9649]\n",
"w = wt2(val)\n",
"shapley_value_list = shapley_calculation(pred_mat=pred_mat, w=w, Y=Y)\n",
"Subset_list=subset_list()\n",
"list_mu = Cal_lambda_fuzzy(shapley_value_list=shapley_value_list, Subset_list=Subset_list)\n",
"fa_cl0 = class_0_pred(class_0=class_0,list_mu=list_mu, Subset_list=Subset_list)\n",
"fa_cl1 = class_1_pred(class_1=class_1,list_mu=list_mu, Subset_list=Subset_list)\n",
"fa_cl2 = class_2_pred(class_2=class_2,list_mu=list_mu, Subset_list=Subset_list)\n",
"result2 = cal_result(fa_cl0, fa_cl1, fa_cl2)\n",
"print(result2)"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "SfZzGA5pjAMJ"
},
"source": [
"val = [.9498, .9674, .9649]\n",
"w = wt3(val)\n",
"shapley_value_list = shapley_calculation(pred_mat=pred_mat, w=w, Y=Y)\n",
"Subset_list=subset_list()\n",
"list_mu = Cal_lambda_fuzzy(shapley_value_list=shapley_value_list, Subset_list=Subset_list)\n",
"fa_cl0 = class_0_pred(class_0=class_0,list_mu=list_mu, Subset_list=Subset_list)\n",
"fa_cl1 = class_1_pred(class_1=class_1,list_mu=list_mu, Subset_list=Subset_list)\n",
"fa_cl2 = class_2_pred(class_2=class_2,list_mu=list_mu, Subset_list=Subset_list)\n",
"result3 = cal_result(fa_cl0, fa_cl1, fa_cl2)\n",
"print(result3)"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "xz7NHykZySDj"
},
"source": [
"result = majority_aggregation(result1, result2, result3)"
],
"execution_count": 49,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "0M4hMH8lyf51"
},
"source": [
"print(result)"
],
"execution_count": null,
"outputs": []
}
]
}
Loading

0 comments on commit 0dde686

Please sign in to comment.