From c46592cac8c3c0f672971ca6c7ae8f8eb23c5c56 Mon Sep 17 00:00:00 2001 From: anurag Date: Fri, 13 Apr 2018 15:57:36 +0530 Subject: [PATCH] Deleted nbi snippet file --- RepTB_NBI_Algorithm_Snippet.ipynb | 79 --------------------------------------- 1 file changed, 79 deletions(-) delete mode 100644 RepTB_NBI_Algorithm_Snippet.ipynb diff --git a/RepTB_NBI_Algorithm_Snippet.ipynb b/RepTB_NBI_Algorithm_Snippet.ipynb deleted file mode 100644 index 84e213f..0000000 --- a/RepTB_NBI_Algorithm_Snippet.ipynb +++ /dev/null @@ -1,79 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "import numpy as np\n", - "import csv\n", - "import numpy.matlib\n", - "from operator import itemgetter, attrgetter\n", - "from sklearn.model_selection import KFold\n", - "from sklearn.metrics import roc_curve, auc\n", - "import matplotlib.pyplot as plt" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "#NBI calculation for A (adjacent matrix)\n", - "\n", - "K = np.diag((1/sum(A))) # Create a diagonal matrix \n", - "n = A.shape[0] # Number of rows of adjacent martix A\n", - "m = A.shape[1] # Number of columns in adjacent matrix A\n", - "#print n, m, Ky.shape\n", - "K[np.isinf(K) | np.isnan(K)] = 0\n", - "kk = np.transpose(np.sum(A,1))\n", - "#print kx.shape\n", - "N = np.matlib.repmat(1/kk,n,1)\n", - "N[np.isinf(N) | np.isnan(N)] = 0\n", - "#kx[np.isinf(kx) | np.isnan(kx)] = 0\n", - "W = np.transpose(np.dot(A, K)) # Create the weight matrix \n", - "W1 = np.dot(A, W)\n", - "W2 = np.multiply(N, W1) # Create the scaled up weight matrix\n", - "print W2.shape\n", - "NBIscore = np.dot(W2, A) # Create the Final Resource matrix in accordance with (R = W.A)\n", - "print NBIscore.shape" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.6" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} -- 2.0.0