Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load() is not reading pairwise #7

Closed
xhan85 opened this issue Dec 1, 2016 · 4 comments
Closed

Load() is not reading pairwise #7

xhan85 opened this issue Dec 1, 2016 · 4 comments
Labels

Comments

@xhan85
Copy link

xhan85 commented Dec 1, 2016

I have made a yaml file and am trying to use the ahp package. I can use the yaml.load_file function but cannot use Load() because it returns that it cannot load the ahp model. I have found that it's running into problems with the pairwise comparison sections under preferences. When I use a bare bones version of my yaml file, it's able to be loaded. But once the pairwise comparisons are added back in, I keep getting the same error. It is having issues somewhere with parsing out the information in the pairwise comparison section. Thanks in advance!

My full yaml file is:

Version: 1.0

Alternatives: &alternatives
GIC Monitoring:
Geologic Data:
USGS:
Energy Infrastructure:
Variometer:
Goal:
name: Data Source
preferences:
pairwise:
- [Coverage, Cost, 2]
- [Coverage, Reliability, 1/3]
- [Cost, Reliability, 1/5]
children:
Coverage:
preferences:
pairwise:
- [Temporal, Spatial, 1/5]
children:
Temporal:
preferences:
pairwise:
- [GIC Monitoring, Geologic Data, 8]
- [GIC Monitoring, USGS, 8]
- [GIC Monitoring, Energy Infrastructure, 8]
- [GIC Monitoring, Variometer, 9]
- [Geologic Data, USGS, 1]
- [Geologic Data, Energy Infrastructure, 1]
- [Geologic Data, Variometer, 7]
- [USGS, Energy Infrastructure, 1]
- [USGS, Variometer, 7]
- [Energy Infrastructure, Variometer, 7]
children: *alternatives
Spatial:
preferences:
pairwise:
- [GIC Monitoring, Geologic Data, 1]
- [GIC Monitoring, USGS, 1]
- [GIC Monitoring, Energy Infrastructure, 1/7]
- [GIC Monitoring, Variometer, 5]
- [Geologic Data, USGS, 1]
- [Geologic Data, Energy Infrastructure, 1/7]
- [Geologic Data, Variometer, 5]
- [USGS, Energy Infrastructure, 1/7]
- [USGS, Variometer, 5]
- [Energy Infrastructure, Variometer, 5]
children: *alternatives
Cost:
preferences:
pairwise:
- [GIC Monitoring, Geologic Data, 1]
- [GIC Monitoring, USGS, 1]
- [GIC Monitoring, Energy Infrastructure, 1]
- [GIC Monitoring, Variometer, 1/9]
- [Geologic Data, USGS, 1]
- [Geologic Data, Energy Infrastructure, 1]
- [Geologic Data, Variometer, 1/9]
- [USGS, Energy Infrastructure, 1]
- [USGS, Variometer, 1/9]
- [Energy Infrastructure, Variometer, 1/9]
children: *alternatives
Reliability:
preferences:
pairwise:
- [GIC Monitoring, Geologic Data, 1]
- [GIC Monitoring, USGS, 1]
- [GIC Monitoring, Energy Infrastructure, 1]
- [GIC Monitoring, Variometer, 9]
- [Geologic Data, USGS, 1]
- [Geologic Data, Energy Infrastructure, 1]
- [Geologic Data, Variometer, 9]
- [USGS, Energy Infrastructure, 1]
- [USGS, Variometer, 9]
- [Energy Infrastructure, Variometer, 9]
children: *alternatives

End of Goal Section

#####################################

Here's what I'm running in R:
Session info -------------------------------------------------------------------------------------------------------------------------------
setting value
version R version 3.3.2 (2016-10-31)
system x86_64, mingw32
ui RStudio (1.0.125)
language (EN)
collate English_United States.1252
tz America/New_York
date 2016-12-01

Packages -----------------------------------------------------------------------------------------------------------------------------------
package * version date source
ahp * 0.2.10 2016-11-27 CRAN (R 3.3.2)
backports 1.0.4 2016-10-24 CRAN (R 3.3.2)
colorspace 1.3-0 2016-11-10 CRAN (R 3.3.2)
curl 2.2 2016-10-21 CRAN (R 3.3.2)
data.tree * 0.6.2 2016-11-24 CRAN (R 3.3.2)
devtools * 1.12.0 2016-06-24 CRAN (R 3.3.2)
DiagrammeR 0.8.4 2016-07-17 CRAN (R 3.3.2)
digest 0.6.10 2016-08-02 CRAN (R 3.3.2)
evaluate 0.10 2016-10-11 CRAN (R 3.3.2)
formattable 0.2.0.1 2016-08-05 CRAN (R 3.3.2)
git2r 0.16.0 2016-11-20 CRAN (R 3.3.2)
htmltools 0.3.5 2016-03-21 CRAN (R 3.3.2)
htmlwidgets 0.8 2016-11-09 CRAN (R 3.3.2)
httr 1.2.1 2016-07-03 CRAN (R 3.3.2)
igraph 1.0.1 2015-06-26 CRAN (R 3.3.0)
influenceR 0.1.0 2015-09-03 CRAN (R 3.3.2)
jsonlite 1.1 2016-09-14 CRAN (R 3.3.2)
knitr 1.15.1 2016-11-22 CRAN (R 3.3.2)
magrittr 1.5 2014-11-22 CRAN (R 3.3.2)
memoise 1.0.0 2016-01-29 CRAN (R 3.3.2)
munsell 0.4.3 2016-02-13 CRAN (R 3.3.2)
plyr 1.8.4 2016-06-08 CRAN (R 3.3.2)
R6 2.2.0 2016-10-05 CRAN (R 3.3.2)
Rcpp 0.12.7 2016-09-05 CRAN (R 3.3.2)
rmarkdown 1.2 2016-11-21 CRAN (R 3.3.2)
rprojroot 1.1 2016-10-29 CRAN (R 3.3.2)
rstudioapi 0.6 2016-06-27 CRAN (R 3.3.2)
scales 0.4.1 2016-11-09 CRAN (R 3.3.2)
stringi 1.1.2 2016-10-01 CRAN (R 3.3.2)
stringr 1.1.0 2016-08-19 CRAN (R 3.3.2)
visNetwork 1.0.2 2016-10-05 CRAN (R 3.3.2)
withr 1.0.2 2016-06-20 CRAN (R 3.3.2)
yaml * 2.1.14 2016-11-12 CRAN (R 3.3.2)

@gluc
Copy link
Owner

gluc commented Dec 12, 2016

Your file doesn't seem to be indented correctly. I'm assuming this is a paste error.
Yes, error handling is very limited at this stage. Happy to look into it. Ideally you prepare a gist with the file and the code you run, so I can directly reproduce.

@gluc gluc added the bug label Dec 12, 2016
@xhan85
Copy link
Author

xhan85 commented Dec 28, 2016

Thank you so much (sorry for the long delay on my side)! I have made a gist with both the yaml file and my R code. If you're able to tell me where I went wrong, it would be much appreciated! You can access the gist here: https://gist.github.com/xhan85/388d8e3e868a2663338bd1bd2883ee24

@gluc gluc added question and removed bug labels Jan 6, 2017
@gluc
Copy link
Owner

gluc commented Jan 6, 2017

I had a quick look. Your file is in version 2, so you need to put Version: 2.0 in first line of the ahp spec yaml.

Also you can load directly on the file path.

gic <- Load("U:/EOA/AHP/GIC Assessment_wdoane.yml")
Calculate(gic)
Analyze(gic)

Using this, I get:

                   Weight Energy Infrastructure GIC Monitoring Geologic Data  USGS Variometer Inconsistency
1 Data Source      100.0%                 28.6%          21.5%         19.4% 19.4%      11.1%          0.3%
2  ¦--Reliability   64.8%                 15.8%          15.8%         15.8% 15.8%       1.8%          0.0%
3  ¦--Coverage      23.0%                 11.9%           4.7%          2.7%  2.7%       0.9%          0.0%
4  ¦   ¦--Spatial   19.1%                 11.5%           2.3%          2.3%  2.3%       0.8%         11.3%
5  ¦   °--Temporal   3.8%                  0.4%           2.5%          0.4%  0.4%       0.1%          9.9%
6  °--Cost          12.2%                  0.9%           0.9%          0.9%  0.9%       8.4%          0.0%

@gluc gluc closed this as completed Jan 6, 2017
@xhan85
Copy link
Author

xhan85 commented Jan 6, 2017

Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants