Open NB-Bio opened 1 month ago
HI can you finish the comment please if it still an issue?
Hi, sorry for the inconvenience, I completed the message above. Any suggestion about how to correctly associate the itarg vector sequence of weights to the right indicators?
Hi @NB-Bio, can you perhaps make a reproducible example so I can reproduce the problem? E.g. either send me your coin with a few lines of code which point to the problem, or else if you can reproduce the ordering problem on the example coin in COINr that could also work. The function is taking the weights from coin$Meta$Weights$Original
so that should be the starting point to understand the order, but it's possible things are getting mixed up somewhere.
FYI the get_opt_weights()
function is one of the lesser-developed parts of the package so it needs to be used carefully, and the results may not always converge.
Hi, first of all, congratulations for your work, the COINr package in incredibly useful.
I have a doubt regarding the structure of the vector of importances "itarg" used during the weight optimization.
The documentation on the COINr's website regarding the function get_opt_weights says that itarg is "a vector of (relative) target importances. For example, c(1,2,1) would specify that the second indicator should be twice as "important" as the other two."
However I have a doubt regarding the order of indicators considered by the vector itarg compared to the order of the indicators within the iMeta dataset.
In fact it seems that the sequence of indicators is different in the two cases. For example, in my case, if I check the order of indicators within the iMeta dataframe:
coin.m[["Meta"]][["Ind"]][["iCode"]]
I get that the indicators "Emissions" and "Light pollution" are the fourth and the fifth, respectively.
[4] "Emissions" "Light pollution"
so if I wanted to assign those variable a weight of 0.5, compared to the first three variable (importance = 1), I would be tempted to create the itarg vector as follows:
itarg <- c(1,1,1,0.5,0.5)
However, after the optimization, if I try to see the weights assigned to the various indicators, it seems that "Emissions" and "Light pollution" weights have not been corrected according to the "half" importance assigned in itarg, but this has been applied to two other different indicators X and Y.