Last active
October 8, 2018 05:04
-
-
Save mleyvaz/d54283a99ecb69ab24439c4af9cd2d96 to your computer and use it in GitHub Desktop.
Para revista NCML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Revista NCML modelos de decisión basados en números SVN #" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"EB=(1,0,0)\n", | |
"MMB=(0.9, 0.1, 0.1)\n", | |
"MB=(0.8,0.15,0.20)\n", | |
"B=(0.70,0.25,0.30)\n", | |
"MDB=(0.60,0.35,0.40)\n", | |
"M=(0.50,0.50,0.50)\n", | |
"MDM=(0.40,0.65,0.60)\n", | |
"MA=(0.30,0.75,0.70)\n", | |
"MM=(0.20,0.85,0.80)\n", | |
"MMM=(0.10,0.90,0.90)\n", | |
"EM=(0,1,1) " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 13, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [], | |
"source": [ | |
"def SVNWA(list,W):\n", | |
" t=1\n", | |
" i=1\n", | |
" f=1\n", | |
" for j in list:\n", | |
" t=t*j[0]\n", | |
" i=i*j[1]\n", | |
" f=f*j[2]\n", | |
" print(j[2])\n", | |
" return (round(1-pow(t,W[0]),2),round(pow(i,W[1]),2),round(pow(f,W[2]),2))\n", | |
" " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 19, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [], | |
"source": [ | |
"r11=[MB,M, MB, B, M]\n", | |
"r12=[MB,B,M,M,B]\n", | |
"r13=[EM,MB,M,MB,M]\n", | |
"r=[M,M,M]\n" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 20, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"0.5\n", | |
"0.1\n", | |
"0.2\n" | |
] | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"(0.26, 0.23, 0.16)" | |
] | |
}, | |
"execution_count": 20, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"SVNWA([M,MMB,MB],[0.3,0.3,0.4])" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 21, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"r1=[(0.24, 0.2, 0.12),(0.41, 0.44, 0.35),(0.38, 0.0, 0.17),(0.21, 0.21, 0.17),(0.49, 0.49, 0.41)]\n", | |
"r2=[(0.18, 0.18, 0.14),(0.32, 0.3, 0.25),(0.29, 0.27, 0.19),(0.49, 0.49, 0.41),(0.24, 0.25, 0.2)]\n", | |
"r3=[(0.19, 0.0, 0.0),(0.46, 0.44, 0.35),(0.54, 0.61, 0.5),(0.21, 0.21, 0.17),(0.26, 0.23, 0.16)]\n", | |
"i=[(0.2,0,0),(0.4,0.3,0.25),(0.38, 0.61,0.5),(0.49,0.21,0.17),(0.24,0.49,0.41)]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 22, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [], | |
"source": [ | |
"def euclideanNeu(a1,a2):\n", | |
" a=0\n", | |
" c=len(a1) \n", | |
" for i in range(c):\n", | |
" a=pow(a1[i][0]-a2[i][0],2)+pow(a1[i][1]-a2[i][1],2)+pow(a1[i][1]-a2[i][1],2)\n", | |
" a=round(1.0/0.3*a,2)\n", | |
" return(a)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 23, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"0.45\n" | |
] | |
} | |
], | |
"source": [ | |
"print (euclideanNeu(r3,i))" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.0" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I was reading your article in the NCML magazine, "Decision making using SVN numbers", and I have a question in the euclideanNeu function, inside the loop the calculation of "a" shouldn't be
a=pow(a1[i][0]-a2[i][0],2)+pow(a1[i][1]-a2[i][1],2)+pow(a1[i][2]-a2[i][2],2) ?