-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
714 additions
and
77 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from skcriteria import ahp\n", | ||
"from skcriteria.common import norm" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Data" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"crit_n, alt_n = 3, 3\n", | ||
"\n", | ||
"data = [\n", | ||
" [20000, 1.8, 9],\n", | ||
" [180000, 1.6, 7],\n", | ||
" [155000, 1.4, 6]\n", | ||
"]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"source": [ | ||
"## First step: Criteria pair comparision matrix" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"[[ 1. 5. 7. ]\n", | ||
" [ 0.2 1. 3. ]\n", | ||
" [ 0.14285714 0.33333333 1. ]]\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"vs_criteria = ahp.t([\n", | ||
" [1.], \n", | ||
" [1/5., 1.],\n", | ||
" [1/7., 1/3., 1.]\n", | ||
"])\n", | ||
"\n", | ||
"print(vs_criteria)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"(0.055731850580674758, 0.10717261031851821)" | ||
] | ||
}, | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"ahp.saaty_cr(3, vs_criteria)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"0.52002" | ||
] | ||
}, | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"ahp.saaty_ri(3)" | ||
] | ||
}, | ||
{ | ||
"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.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,98 @@ | ||
{ | ||
"metadata": { | ||
"name": "", | ||
"signature": "sha256:9de06cc16e51047b64fe34364677f989997f1651248aa2234c1aa9a8d937fd25" | ||
}, | ||
"nbformat": 3, | ||
"nbformat_minor": 0, | ||
"worksheets": [ | ||
"cells": [ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"collapsed": false, | ||
"input": [ | ||
"from skcriteria.common import rank" | ||
], | ||
"language": "python", | ||
"metadata": {}, | ||
"outputs": [], | ||
"prompt_number": 1 | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"##Rank data" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"collapsed": false, | ||
"input": [ | ||
"time_laps = [0.59, 1.2, 0.3] # the fast (the lowes value) goest first\n", | ||
"rank.rankdata(time_laps)" | ||
], | ||
"language": "python", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"metadata": {}, | ||
"output_type": "pyout", | ||
"prompt_number": 3, | ||
"text": [ | ||
"array([2, 3, 1])" | ||
] | ||
} | ||
], | ||
"prompt_number": 3 | ||
}, | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from skcriteria.common import rank" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Rank data" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"cell_type": "code", | ||
"collapsed": false, | ||
"input": [ | ||
"scores = [140, 200, 98] # highest is better\n", | ||
"rank.rankdata(scores, reverse=True)" | ||
], | ||
"language": "python", | ||
"data": { | ||
"text/plain": [ | ||
"array([2, 3, 1])" | ||
] | ||
}, | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"metadata": {}, | ||
"output_type": "pyout", | ||
"prompt_number": 4, | ||
"text": [ | ||
"array([2, 1, 3])" | ||
] | ||
} | ||
], | ||
"prompt_number": 4 | ||
}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"time_laps = [0.59, 1.2, 0.3] # the fast (the lowes value) goest first\n", | ||
"rank.rankdata(time_laps)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"cell_type": "code", | ||
"collapsed": false, | ||
"input": [], | ||
"language": "python", | ||
"data": { | ||
"text/plain": [ | ||
"array([2, 1, 3])" | ||
] | ||
}, | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"outputs": [] | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"metadata": {} | ||
"source": [ | ||
"scores = [140, 200, 98] # highest is better\n", | ||
"rank.rankdata(scores, reverse=True)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"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.10" | ||
} | ||
] | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
Oops, something went wrong.