Skip to main content

The basic concept SAW method is to find the sum of the weighted performance rating for each alternative on all attributes. SAW method requires a process of normalizing the decision matrix (X) to a scale that can be compared with all the ratings of existing alternatives.

Project description

About this package

The basic concept SAW method is to find the sum of the weighted performance rating for each alternative on all attributes. SAW method requires a process of normalizing the decision matrix (X) to a scale that can be compared with all the ratings of existing alternatives.

Depedencies

  • Python >= 3
  • numpy
  • pandas

Function

init (data,weights, non_beneficial = None)

Initializer provides 2 required parameters and 1 optional parameter, data is the dataset with DataFrame format, weights is the values that provided to get a optimal alternative, non_beneficial is the column that has type "cost", not benefit.

getDecisionMatrix

Function that return formatted matrix from dataset

normalize

Function that return normalized matrix from decision matrix

createDecision

Function that return the list of alternative's score

getChosenOneByIndex

Function that return the chosen one from the alternatives

Example case

We will simulate "Selection of land - Water resources management" which has 4 criteria(s) : Rainfall, Drainage, Usage of land, Tophography. Usage of land is the only one non beneficial criteria.

  • In this case we'll use the weight values like this :

[0.25, 0.25, 0.25, 0.25]

  • The example dataset that we had

[[25, 67, 7, 20],
[21, 78, 6, 24],
[19, 53, 5, 33], [22, 25, 2, 31]]

Example of code

from dssystem.method import SimpleAdditiveWeighted
import numpy as np
import pandas as pd
dataset = pd.DataFrame({"Rainfall" : [25, 21, 19, 22],
						"Drainage" : [67, 78, 53, 25],
						"Usage of land" : [7, 6, 5, 2],
						"Tophography" : [20, 24, 33, 31]}, 
						index=["L1","L2","L3","L4"])
						
method = SimpleAdditiveWeighted(dataset, [.25, .25 , .25, .25], ["Usage of land"])
print(method.getChosenOneByIndex()) #to get chosen alternative name
print(method.getDecisionMatrix()) #to get decision matrix
print(method.normalize()) #to get normalized decision matrix
print(method.createDecision()) #to get list of alternative's score

Example of output

L4 #L4 is the chosen one

#output of the decision matrix
[[25 67  7 20]
 [21 78  6 24]
 [19 53  5 33]
 [22 25  2 31]]

#output of normalized decision matrix
[[1.   0.86 0.29 0.61]
 [0.84 1.   0.33 0.73]
 [0.76 0.68 0.4  1.  ]
 [0.88 0.32 1.   0.94]]

#output of list of alternative's score
[0.69 0.72 0.71 0.79]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dssystem-0.1.5.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file dssystem-0.1.5.tar.gz.

File metadata

  • Download URL: dssystem-0.1.5.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.1

File hashes

Hashes for dssystem-0.1.5.tar.gz
Algorithm Hash digest
SHA256 b0ae9d77c1bfe7172e04f7659129afefe91f7a58c0d5dfbc0a8af38130fcb671
MD5 ca9365955617e5df76a75c262d33b7d7
BLAKE2b-256 680494595d78fef50b7114c5a8d35efc698960da65df75e0357315dd8c2d5101

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page