-
Notifications
You must be signed in to change notification settings - Fork 8
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
A general question on Treat data with customized function #64
Comments
If you're trying to flip the directions of indicators, you probably want to use the |
Many thanks for your prompt reply. I have tried Normalise and encounter the same issue.
reports "Error in get_iMeta_norm_paras(coin, func_name = global_specs[["f_n"]]) : I have also tried
Update: I managed to get
work by modifying the
|
@liuyanguu have you looked at the documentation on normalisation at https://bluefoxr.github.io/COINr/articles/normalise.html#coins As far as I can tell you just want to flip the indicator directions, and this is taken care of by Normalise() without needing to pass your function to it. Normally the reversal of directions is done at the normalisation step, in addition to another scaling operation such as min-max. All of this is built into the package. Also please check the function documentation - if a function doesn't explicitly say it can access iMeta then it can't, these are special cases, again it is written out in the documentation. |
Dear @bluefoxr, I have read all the documentation. Indeed, what I am doing is very simple, but I am not only flipping the indicator direction — I am keeping the same value if it is a positive indicator and calculating (1 - x) if it is a negative indicator. And I'd like to use
|
I think then maybe the answer is a Custom operation, passing the iMeta data frame "manually" (or just the direction and iCode columns) to the In Custom.purse() the operation happens like this: # run global dset through function
iDatas_c <- do.call(f_cust, c(list(x = iDatas), f_cust_para)) So if you make a function like your one above, where it looks up the direction for each column, it should do the trick. |
I'm sorry for the multiple questions. I have a quick question: all my indicators are percentages and I want to apply a simple function like below to all indicators, is it possible to use the "Treat" function for it?
basically return the same value if direction is 1 and (1 - x) if the direction is -1.
I tried
but nothing changes and all values remain the same? Sorry I haven't figured out the right way to do it...
Thank you so much for your help. Much appreciated!
The text was updated successfully, but these errors were encountered: