Restic never and and create a lot of cache

Output of restic version : restic 0.12.1 compiled with go1.16.6 on linux/amd64
On Debian 10
How did you run restic exactly?
/usr/sbin/restic backup --no-cache --files-from /root/admin_scripts/backup_restic_s3/include.txt --exclude-file /root/admin_scripts/backup_restic_s3/exclude.txt >> $LOG
What backend/server/service did you use to store the repository?
S3
Expected behavior
All works
Actual behavior
restic backup never and avec 93% and generate a lot of cache.
I don't understand why it never ends
Steps to reproduce the behavior
Start the command and wait
Do you have any idea what may have caused this?
No idea before it's works well
Do you have an idea how to solve the issue?
No
Did restic help you today? Did it make you happy in any way?
In all others servers it's works

Same issue with :
/usr/sbin/restic backup --files-from /root/admin_scripts/backup_restic_s3/include.txt --exclude-file /root/admin_scripts/backup_restic_s3/exclude.txt >> $LOG

Does restic have a limit in file number, in those server we have a lot of sess_ files and a think there is a problem with that
df -i
/dev/sda1        13107200 9449551 3555751   73% /

restic backup never and avec 93% and generate a lot of cache.

Sorry don't understand what you exactly mean. There seems to be missing a verb what restic never does.
What exactly does restic output when the error occurs?
If you have a lot of small files it can take a while to scan all files.
Don't know if your server is bare metal, if so I would also check with smartctl if HDD is working within normal parameters.
Regarding file count:
Largest Windows repository:
Stats in restore-size mode:
Snapshots processed:   34
   Total File Count:   17361060
         Total Size:   53.670 TiB

Largest Linux
Stats in restore-size mode:
Snapshots processed:   66
   Total File Count:   21780391
         Total Size:   704.316 GiB

and most files
Stats in restore-size mode:
Snapshots processed:   255
   Total File Count:   28130478
         Total Size:   26.477 GiB

Does restic have a limit in file number, in those server we have a lot of sess_ files and a think there is a problem with that

There is no hard limit on the number of files. However, more files lead to more metadata and require more RAM for restic to work. Note that folders with hundreds of thousands of files (or even millions) will cause one problem or another.

Closing as the issue is very old and there's not enough information available to further investigate. Feel free to open a new open if there's still a problem.


differences between the reproduced results and the results in the paper

The following result was generated based on the parameters provided in the testset_ parameters. sh file, but the result was not satisfactory:
0.png:

1.png:

2.png:

3.png:

What is the reason for this?

Hi, different seeds may lead to different results here. I manually selected the most plausible one in the paper at that time.


(WIP) Fixes #1216: change "unparseable" JSON into 400 from 200 (unprocessable)

What this PR does:
Changes HTTP response code of "unparseable JSON" (where basic tokenization fails) into 400 from 200 -- this because request cannot really be processed at all, unlike with bad JSON structure (mapping)
Which issue(s) this PR fixes:
Fixes #1216
Checklist

[ ] Changes manually tested
[x] Automated Tests added/updated
[ ] Documentation added/updated
[x] CLA Signed: DataStax CLA

Looks good so far, I like this change

Yeah. If only it actually worked... having hard time figuring out where the status code is lost. :-/
(IT fails, response is stubbornly 200)


Link to 'SAP Analytics Cloud: User and Team Provisioning API' not found

Issue description

Section Procedure SAP Analytics Cloud: User and Team Provisioning API which is not working.
Feedback Type (Optional)
linking
Page Title on SAP Help Portal (prefilled)
SAP Analytics Cloud
Page URL on SAP Help Portal (prefilled)
https://help.sap.com/docs/identity-authentication/identity-authentication/sap-analytics-cloud-2220f847ef8642d18f4ecc59a943ff4d?locale=en-US

Thank you @KaloyanVeleshki for noticing the broken link. This has been fixed and released productively at: https://help.sap.com/docs/cloud-identity-services/cloud-identity-services/proxy-sap-analytics-cloud.
Best regards,
Ivelina


Avoid calling pad when possible

Resolves #18657
torch.nn.functional.pad is slow and memory consuming. We should avoid calling it whenever it is possible.
This PR strictly checks the necessity of calling the function and only call it when necessary.
For all other cases, it just use the padding argument of the torch functions like conv2d, max_pool2d, and avg_pool2d.

Codecov Report
Attention: 57 lines in your changes are missing coverage. Please review.

Comparison is base (85dcc8b) 78.65% compared to head (3f405b3) 72.88%.
Report is 9 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #18713      +/-   ##
==========================================
- Coverage   78.65%   72.88%   -5.77%
==========================================
  Files         336      336
  Lines       33421    33591     +170
  Branches     6548     6579      +31
==========================================
- Hits        26286    24483    -1803
- Misses       5559     7571    +2012
+ Partials     1576     1537      -39

Flag
Coverage Δ

keras
72.82% <71.50%> (-5.73%)
:arrow_down:

keras-jax
61.96% <40.00%> (-0.18%)
:arrow_down:

keras-numpy
56.39% <43.00%> (-0.09%)
:arrow_down:

keras-tensorflow
?

keras-torch
64.77% <36.50%> (-0.20%)
:arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files
Coverage Δ

keras/backend/jax/numpy.py
99.51% <100.00%> (+0.27%)
:arrow_up:

keras/backend/numpy/numpy.py
99.07% <100.00%> (-0.17%)
:arrow_down:

keras/backend/torch/numpy.py
95.71% <100.00%> (-0.27%)
:arrow_down:

keras/ops/numpy.py
95.91% <100.00%> (+0.06%)
:arrow_up:

keras/optimizers/adadelta.py
94.28% <100.00%> (ø)

keras/optimizers/adagrad.py
93.10% <100.00%> (ø)

keras/optimizers/adam.py
95.55% <100.00%> (ø)

keras/optimizers/adamax.py
94.11% <100.00%> (ø)

keras/optimizers/base_optimizer.py
73.06% <100.00%> (-1.07%)
:arrow_down:

keras/optimizers/ftrl.py
77.35% <100.00%> (ø)

... and 9 more

... and 44 files with indirect coverage changes

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


[PoC] Resolve custom repository classes

This is only a proof of concept, has some rough edges (including CS) and obviously needs tests. FWIW it does work :) I'm opening this PR to see whether such approach would be accepted to not waste time.
Motivation behind creating dummy entity manager is that we get support for all mapping formats out of the box and don't need to resolve mappings on our own. With this we'll be able to get same mappings as Doctrine has so it opens possibilities to more checks.
Example of configuration:
includes:
    - vendor/phpstan/phpstan-doctrine/extension.neon
parameters:
    doctrine:
        metadata:
            CmsBundle\Entity:
                type: annotation
                paths: [%rootDir%/../../../src/CmsBundle/Entity]

I'm not well acquainted with the PHPStan code, but is not it enough to replace new MixedType with regular type detection (from docblocks, typehints and so on, in any case, custom repositories should contain such information) in EntityRepositoryDynamicReturnTypeExtension.php#L40?

@ossinkine Definitely not 😊

Superseded by #49.


Create a Command to add a new field (Application Status)

Closes #47
Updated files to include Status field.

LGTM


CHANGELOG: Update change log for 0.2.8 release

Signed-off-by: Fernando Fernandez Mancera<EMAIL_ADDRESS>

As this change only include documentation changes, CI is irrelevant.
Force taking this change.

Coverage remained the same at ?% when pulling 8d2be3ca5c6441d808385f4ebc5816681efc27d2 on ffmancera:changelog028 into 6c90c47fca953ab7e7504b9cd46c068885b39633 on nmstate:nmstate-0.2.


Mobile speed or timeout

If you test any of the example in mobile device browser, you will notice that if you drag slowly it works. But when you drag quickly, it understand that drag has started but object is not moving alongside with it.

You can seet ngDraggable.touchTimeout to 0


Update to Raven 2.x.x

@charsleysa Can you please rebase this into one commit?

@charsleysa hey you can probably close this issue and just use the package winston-raven-sentry - see https://github.com/guzru/winston-sentry/issues/49 or visit https://github.com/niftylettuce/winston-raven-sentry for complete documentation!

Closing in favor of the new winston-raven-sentry package.


BatchJob log validation errors too verbose

I's noticed that if I have a validator where I throw an exception for each validation error (that's how it should be used, right?), the BatchJob class will fill the log with those exceptions (line 234, LOGGER.error("Unable to process record {}", record, e);). Would it be possible to have a configuration to control this log messages? I was testing a batch with about one million records and if I have a validation error on each one, the log will be filled with those messages and the time taken to run is almost 10x slower because of that.
My suggestion would be to have a JobParameter to control this loggging line (ex. disableProcessLogError). Would you think this would make sense?

yes, it is expected to throw an exception from the validator if a record is invalid. Easy Batch is logging those errors at the error log level. Aren't you interested in knowing what caused each record to be rejected? I mean isn't this what logs are for?
Changing the log level to debug seems incorrect to me, validation errors should be logged as errors. Completely removing this line is not an option neither, because this means one must use a custom pipelineListener.onRecordProcessingException to log processing/validation errors somewhere. The suggested feature of adding a flag disableProcessLogError to guard logging does not feel right to add in a batch framework, this is really a logging concern (I'm ready to accept that Easy Batch is using the wrong log level but I'm not sure adding such flag is judicious, because this flag would make things inconsistent and open the door for suggesting to add flags like disableReadLogError, disableWriteLogError, etc and all the logging in the code base would be guarded with different flags..).

I was testing a batch with about one million records and if I have a validation error on each one, the log will be filled with those messages and the time taken to run is almost 10x slower because of that.

I understand what's happening, but how frequent does this happen? If all records are invalid, this means you have something fundamentally wrong with your file. This might happens at the first stages of your job development/testing (where it's ok to have a slower execution but a precise log), but after that in practice you would have a few invalid records but not every single one. What I'm trying to explain is that if this really happens, it's ok to have a slower execution for that particular execution. I would not add a guarded log to make a very particular case faster at the cost of making all executions slower. Do you agree?

I have thrid party systems that generate those files, which I don't control. I understand and accept your points but, I would very much appreciate a flag for, at least, making optional the "trace" of the error:
if(disableErrorTrace) {     LOGGER.error("Unable to process record {}", record);) } else {     LOGGER.error("Unable to process record {}", record**, e**);) }
By default, this flag could / should be false. This would maintain your (correct) view on how this should work but allow other use cases as well. My biggest problem is not the error log but the trace associated with it. For a million file length, the log will multiply thos rows by the extension of the trace. Is this reasonble for you?

Logging an error without its root cause is an anti-pattern (even tools like sonar might complain about that). Moreover, if we do this here, we should do it everywhere for consistency as disableErrorTrace is a generic name: the average user would expect this flag to be applied everywhere (and there are a dozen places where LOGGER.error is called, and not all of them have access to the job parameters to check this flag). I won't talk about performance without a benchmark, but this means there would be an additional test of disableErrorTrace for each error.
Adding a "logging feature" in a batch framework does not feel right to me. I still believe you are trying to address a false problem here: if you have a file with one million invalid records, I'm not surprised to get a log file with one million error messages with their respective traces. Again, pragmatically speaking, how often does this happen? I'm not sure this would be frequently the case (otherwise, there is something fundamentally wrong with your interface with those third party systems), and for that particular seldom case when this happens,  it's ok IMO to have a slower execution (this could even be a good sign that something is wrong..). That's why I would not impact the average user with a confusing flag about a logging flag that does not belong to a batch framework in the first place.
If you find these logs verbose for your particular use case, you can disable them and implement your approach in a custom PipelineListener, something like:
class LoggingListener implements PipelineListener {

    private final Logger LOGGER = LoggerFactory.getLogger(LoggingListener.class.getName());
    private final boolean disableErrorTrace;

    public LoggingListener(boolean disableErrorTrace) {
        this.disableErrorTrace = disableErrorTrace;
    }

    @Override
    public <P> void onRecordProcessingException(Record<P> record, Throwable throwable) {
        if(disableErrorTrace) {
            LOGGER.error("Unable to process record {}", record);
        } else {
            LOGGER.error("Unable to process record {}", record, throwable);
        }
    }
}

This listener could be polymorphic and implement other listeners if you are interested in logging other parts of the process.
I'm closing this issue for now, but feel free to add a comment if you want to discuss this further.


HTTP Error 404: Not Found" when trying to download Chrome driver

Is there an existing issue for this?

[X] I have searched the existing issues

I'm submitting a ...

[X] bug report
[ ] feature request
[ ] support request --> Contact me over mail for support https://github.com/MShawon

Description
Describe the bug
When running the youtube_viewer.py script, the application attempts to download the appropriate Chrome driver and fails with a "HTTP Error 404: Not Found" error.
To Reproduce
Steps to reproduce the behavior:
Navigate to the project directory '...\PycharmProjects\YouTube-Viewer'.
Run the script 'youtube_viewer.py'.
Observe the output.
Expected behavior
The script should successfully download the appropriate Chrome driver based on the user's system and continue with the execution.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
OS: Windows
Browser: Chrome
Version: Version 115.0.5790.102 (Offizieller Build) (64-Bit)
Additional context
Here is the traceback:
Getting Chrome Driver... Traceback (most recent call last):   File "C:\Users\PC\PycharmProjects\YouTube-Viewer\youtube_viewer.py", line 1003, in <module>     osname, exe_name = download_driver(patched_drivers=patched_drivers)   File "C:\Users\PC\PycharmProjects\YouTube-Viewer\youtubeviewer\download_driver.py", line 112, in download_driver     uc.install()   File "C:\Users\PC\PycharmProjects\YouTube-Viewer\venv\Lib\site-packages\undetected_chromedriver\_compat.py", line 262, in install     ChromeDriverManager(executable_path, target_version, *args, **kwargs).install()   File "C:\Users\PC\PycharmProjects\YouTube-Viewer\venv\Lib\site-packages\undetected_chromedriver\_compat.py", line 192, in install     self.fetch_chromedriver()   File "C:\Users\PC\PycharmProjects\YouTube-Viewer\venv\Lib\site-packages\undetected_chromedriver\_compat.py", line 221, in fetch_chromedriver     ver = self.get_release_version_number().vstring   File "C:\Users\PC\PycharmProjects\YouTube-Viewer\venv\Lib\site-packages\undetected_chromedriver\_compat.py", line 211, in get_release_version_number     return LooseVersion(urlopen(self.__class__.DL_BASE + path).read().decode())   File "C:\Users\PC\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 216, in urlopen     return opener.open(url, data, timeout)   File "C:\Users\PC\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 525, in open     response = meth(req, response)   File "C:\Users\PC\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 634, in http_response     response = self.parent.error(   File "C:\Users\PC\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 563, in error     return self._call_chain(*args)   File "C:\Users\PC\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 496, in _call_chain     result = func(*args)   File "C:\Users\PC\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 643, in http_error_default     raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 404: Not Found
Possible Solution
Check the URLs and paths where the script is trying to download the Chrome driver from. The server might have moved the file, or the file may no longer exist.
Environment
- OS : Windows 11
- Python : 3.11
- Script version : YouTube-Viewer_win_1.8.0

config.json
not applicable

Related to issue https://github.com/MShawon/YouTube-Viewer/issues/572


BUG: Broken agent flow

For agents, running into the following error now:

Traceback (most recent call last):
  File "/home/fatih/h2ogpt/openai_server/autogen_streaming.py", line 50, in run_autogen_in_proc
    ret_dict = func(**kwargs)
  File "/home/fatih/h2ogpt/openai_server/agent_utils.py", line 113, in run_agent
    ret_dict = run_agent_func(**kwargs)
  File "/home/fatih/h2ogpt/openai_server/autogen_2agent_backend.py", line 145, in run_autogen_2agent
    chat_result = code_executor_agent.initiate_chat(**chat_kwargs)
  File "/home/fatih/anaconda3/envs/h2ogpt/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 1095, in initiate_chat
    self.send(msg2send, recipient, request_reply=True, silent=silent)
  File "/home/fatih/anaconda3/envs/h2ogpt/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 733, in send
    message = self._process_message_before_send(message, recipient, ConversableAgent._is_silent(self, silent))
  File "/home/fatih/anaconda3/envs/h2ogpt/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 278, in _is_silent
    return agent.silent if agent.silent is not None else silent
AttributeError: 'H2OConversableAgent' object has no attribute 'silent'

seems related to this commit: https://github.com/h2oai/h2ogpt/commit/e3114a1ccc6b60d8b1e60c16855abedabfa2c533
Repro:
prompt = any prompt
agent_type = auto

Must be due to version differences.  My version of ConversableAgent has no silent parameter.
a9b97158d1d5f3a8fbb47246e28327e7609bc903

That explains, I have 0.2.35 (because of > 2.33.0) . Let me also downgrade to that then.


Allow setting amount of hours for weekly target

Seems to be done since b7ace0a0c, if not before it


4Sum problem added and updated Readme

Have you read the Contributing Guidelines on Pull Requests?
Yes
Description
Added 4 Sum Problem
Checklist

[x] I've read the contribution guidelines.
[x] I've checked the issue list before deciding what to submit.
[x] I've edited the README.md and link to my code.

Related Issues or Pull Requests
#2480

I have resolved the conflicts kindly give it a check.

I have made the changes.Kindly give it a check.

Kindly Check. I have made the changes.
Thanks!!

@all-contributors please add @kotwani2883 for her code


Is it possible to update the launcher to the latest version from earlier versions?

Is it possible to update the launcher to the latest version from earlier versions?
When I see the update design of the launcher, it seems that only the previous version of the launcher can be updated to the latest launcher. This is because update_index.json is the updated metadata between the previous launcher and the latest launcher. In other words, users who are using an older launcher can't update to the latest version of the launcher?

They can totally update from any old version they have. The Launcher's update pipeline is different from the normal pipeline: it doesn't perform patching, instead it just replaces files.
So even in the case your Launcher is really old, it can simply download the latest available files and updates itself to the latest available version.


The link in "link.txt" has expired.

Hello, I am learning to train robotic arm agent in gym and your work is very meaningful to me, but the link in "link.txt" has expired, can you update it, thanks a lot!

The link is updated and I only find the model for greyd version. Please let me know if you have any other questions I can help.

Thanks for your reply，I successfully downloaded model for greyd and urdfs. Then I want to see the effect of grasp random object, but when I ran the run_ugnet_greyd_pybullet.py and enjoy_kinova7_diverse_object_grasping.py, I got a mistake that I cannot solved at 'pred_out = model.predict(rgbd_input)', can you give me some advice. The errors are as follows

[ERROR] [1589288712.223133]: bad callback: <function depth_callback at 0x7f6a41d80578>
Traceback (most recent call last):
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/topics.py", line 750, in _invoke_callback
cb(msg)
File "/home/robot/realsense_ws/src/ggcnn_kinova_grasping/ggcnn_kinova_grasping/scripts/pybullet_kinova7/run_ugnet_greyd_pybullet.py", line 235, in depth_callback
pred_out = model.predict(rgbd_input)
File "/home/robot/.local/lib/python2.7/site-packages/keras/engine/training.py", line 1169, in predict
steps=steps)
File "/home/robot/.local/lib/python2.7/site-packages/keras/engine/training_arrays.py", line 294, in predict_loop
batch_outs = f(ins_batch)
File "/home/robot/.local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 2721, in call
return self._legacy_call(inputs)
File "/home/robot/.local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 2693, in _legacy_call
**self.session_kwargs)
File "/home/robot/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 905, in run
run_metadata_ptr)
File "/home/robot/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1140, in _run
feed_dict_tensor, options, run_metadata)
File "/home/robot/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1321, in _do_run
run_metadata)
File "/home/robot/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1340, in _do_call
raise type(e)(node_def, op, message)
FailedPreconditionError: Attempting to use uninitialized value conv2d_11/bias
[[Node: conv2d_11/bias/read = IdentityT=DT_FLOAT, _class=["loc:@conv2d_11/bias"], _device="/job:localhost/replica:0/task:0/device:GPU:0"]]
[[Node: cos_out_1/concat/_15 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_860_cos_out_1/concat", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

Caused by op u'conv2d_11/bias/read', defined at:
File "/home/robot/realsense_ws/src/ggcnn_kinova_grasping/ggcnn_kinova_grasping/scripts/pybullet_kinova7/run_ugnet_greyd_pybullet.py", line 45, in
model = load_model(MODEL_FILE)
File "/home/robot/.local/lib/python2.7/site-packages/keras/engine/saving.py", line 419, in load_model
model = _deserialize_model(f, custom_objects, compile)
File "/home/robot/.local/lib/python2.7/site-packages/keras/engine/saving.py", line 225, in _deserialize_model
model = model_from_config(model_config, custom_objects=custom_objects)
File "/home/robot/.local/lib/python2.7/site-packages/keras/engine/saving.py", line 458, in model_from_config
return deserialize(config, custom_objects=custom_objects)
File "/home/robot/.local/lib/python2.7/site-packages/keras/layers/init.py", line 55, in deserialize
printable_module_name='layer')
File "/home/robot/.local/lib/python2.7/site-packages/keras/utils/generic_utils.py", line 145, in deserialize_keras_object
list(custom_objects.items())))
File "/home/robot/.local/lib/python2.7/site-packages/keras/engine/network.py", line 1022, in from_config
process_layer(layer_data)
File "/home/robot/.local/lib/python2.7/site-packages/keras/engine/network.py", line 1008, in process_layer
custom_objects=custom_objects)
File "/home/robot/.local/lib/python2.7/site-packages/keras/layers/init.py", line 55, in deserialize
printable_module_name='layer')
File "/home/robot/.local/lib/python2.7/site-packages/keras/utils/generic_utils.py", line 145, in deserialize_keras_object
list(custom_objects.items())))
File "/home/robot/.local/lib/python2.7/site-packages/keras/engine/network.py", line 1032, in from_config
process_node(layer, node_data)
File "/home/robot/.local/lib/python2.7/site-packages/keras/engine/network.py", line 991, in process_node
layer(unpack_singleton(input_tensors), **kwargs)
File "/home/robot/.local/lib/python2.7/site-packages/keras/engine/base_layer.py", line 431, in call
self.build(unpack_singleton(input_shapes))
File "/home/robot/.local/lib/python2.7/site-packages/keras/layers/convolutional.py", line 147, in build
constraint=self.bias_constraint)
File "/home/robot/.local/lib/python2.7/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "/home/robot/.local/lib/python2.7/site-packages/keras/engine/base_layer.py", line 252, in add_weight
constraint=constraint)
File "/home/robot/.local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 402, in variable
v = tf.Variable(value, dtype=tf.as_dtype(dtype), name=name)
File "/home/robot/.local/lib/python2.7/site-packages/tensorflow/python/ops/variables.py", line 235, in init
constraint=constraint)
File "/home/robot/.local/lib/python2.7/site-packages/tensorflow/python/ops/variables.py", line 391, in _init_from_args
self._snapshot = array_ops.identity(self._variable, name="read")
File "/home/robot/.local/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 142, in identity
return gen_array_ops.identity(input, name=name)
File "/home/robot/.local/lib/python2.7/site-packages/tensorflow/python/ops/gen_array_ops.py", line 3053, in identity
"Identity", input=input, name=name)
File "/home/robot/.local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/robot/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3290, in create_op
op_def=op_def)
File "/home/robot/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1654, in init
self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access
FailedPreconditionError (see above for traceback): Attempting to use uninitialized value conv2d_11/bias
[[Node: conv2d_11/bias/read = IdentityT=DT_FLOAT, _class=["loc:@conv2d_11/bias"], _device="/job:localhost/replica:0/task:0/device:GPU:0"]]
[[Node: cos_out_1/concat/_15 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_860_cos_out_1/concat", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

I think it may be caused by keras version. It is noted that my model is trained on Tensorflow-GPU verison.

My environment is python=2.7 tensorflow_gpu=1.7 keras=2.2.4 cuda=9.0 cudnn=7.0.5, is this right?

I test the code from Github repository well. The rgbd_used set True for greyd model in enjoy_kinova7_diverse_object_grasping.py. You need to run roscore,  run_ugnet_greyd_pybullet.py. And until the model loading is completed ,  you can run enjoy_kinova7_diverse_object_grasping.py at last.  My cudnn=7.6, but I am not sure it caused the problem.

Thanks for your quick reply and update. I sincerely hope it didn't delay you too much.
I have solved this problem refer to https://github.com/keras-team/keras/issues/4623#issuecomment-265982117 and the result is well.
what's more, could you tell me how to train a epoch_10_model for a new scence, new robot and new task?

Actually, this project is just my trail for RL environment last year and transfer the KUKA project to Kinova in Pybullet library example.  The model used here is my another work (https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8945792) to improve open-loop scheme in ggcnn in kinematics level .  You can train from scratch using Cornell dataset, Jacquard dataset or VMRD (humanoid) easily.

Actually, this project is just my trial for RL environment last year and transfers the KUKA project to Kinova in Pybullet library example. The model used here is my another work (https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8945792) to improve open-loop scheme in ggcnn in kinematics level . You can train from scratch using Cornell dataset, Jacquard dataset or VMRD (humanoid) easily.

Roger that，thanks！


Serve something

Decide how request paths are going to be matched and what content will be served. We could serve static files or w/e.

We could do this with mruby.


Failing to Load custom colors under Windows

either specifying direct path or relative or even putting the file in the root drive leads to an error, e.g.
"color_scheme": "FindResults.hidden-tmTheme"
"color_scheme": "Packages\\User\\FindResults.hidden-tmTheme"
"color_scheme": "C:\\FindResults.hidden-tmTheme"
"color_scheme": "C:\\Users\\Administrator\\AppData\\Roaming\\Sublime Text 3\\Packages\\User\\FindResults.hidden-tmTheme"
the error:
Error loading colour scheme Packages\User\FindResults.hidden-tmTheme: Unable to open Packages\User\FindResults.hidden-tmTheme

Also getting this on OSX.


permissions bugfix

addresses #85

There's a lot of code here unrelated to the bugfix - please leave those out of this PR


Fix namespace error in kubectl update

$ kubectl update -f pod.json --namespace=mfojtik
F1202 15:14:17.157424 18538 cmd.go:113] The namespace from the provided file "" does not match the namespace "mfojtik". You must pass '--namespace=' to perform this operation.

Is this still relevant?
/cc @derekwaynecarr @deads2k

After resource builder changes it's probably still relevant, but defaulting of namespace needs to be more clearly handled.  For instance, if I want to update multiple configs across multiple namespaces in the same call, should I be allowed to?
----- Original Message -----

Is this still relevant?
/cc @derekwaynecarr @deads2k

Reply to this email directly or view it on GitHub:
https://github.com/GoogleCloudPlatform/kubernetes/pull/2714#issuecomment-71699261

Obsolete. If this is still a problem it needs an updated solution.


Error in fit_exponential_peak() in CD-NU_Gbadolite_gamb_2015_Q3-3RL H12-signal-detection

The offending line:
loc_max = np.argmax(y_peak1)

Potentially occurs when there are no signals found.

Thanks @sanjaynagi, I can take a look.

Thanks @alimanfoo was planning to look today but haven't got around to it yet!

No worries, ditto! Whoever gets to it first then... 🙂

Dug down a little bit -
I noticed that the 'center' at which the fit_exponential_peak() function fails at in this cohort (around 38Mb) was also near where it looked like the hampel filter had removed outliers. Indeed, using the non-filtered H12 values results in the function running successfully. This seems a bit weird, because the filter replaces values rather than removing them completely...

With the non hampel filtered h12 values, this if peak_delta_i > min_delta_aic and peak_in_scan_interval condition is never satisfied, I assume because the delta_i is not above the minumm required delta_aic. So the function keeps running and is fine.

I think this occurs because the start and stop of the signal at indicating the same H12 window. Could be wrong.
For now, we can ignore these rogue sites by checking for an empty list after slicing, and returning the function early, like the following
  if not list(y_peak1):
      return

But Im not sure what the expected behaviour is. Probably good if you can take a look @alimanfoo  :)

Worth noting too that the putative signal at 38Mb is absolutely miniscule, about peak H12=0.016.....

Thanks Sanj for digging on this one, v useful info. Interesting edge case, not sure why this is happening. I'll take a look asap.


 None of them. It just spins and spins and spins and gives me a failure. This is on more than one site. I can't get any work done.
Expected Behavior
I expect it to work and not have to fight to get into my accounts. I had never had this issue until your company's security thing popped up as the new one.
Additional information
https://github.com/cloudflare/cloudflare-docs/assets/94585969/b33e0ad2-7591-4939-b249-abe00b7990d2

Hi @catparkerphoto, I'm sorry for the inconvenience. Unfortunately this isn't an issue we can address via updates or changes to Cloudflare's developer documentation, so I'll be closing this ticket. You could try contacting the sites/services you are trying to access and requesting that they review how Cloudflare is configured.


Get tensor dimension error when retrain Inception3

I followed the 'retrain.py' example, but get error.
I print the bottleneck tensor shape, and it is [1, 1, 1, 2048]. It runs into error when execute "tf.placeholder_with_default(
bottleneck_tensor, shape=[None, BOTTLENECK_TENSOR_SIZE],
name='BottleneckInputPlaceholder')"
It seems that bottleneck_tensor is a tensor with 4 dimension, what does each dimension mean? And Why it is not a 2 dimension tensor?
My code:
BOTTLENECK_TENSOR_NAME = 'pool_3:0'
BOTTLENECK_TENSOR_SIZE = 2048
sess = tf.InteractiveSession()
graph = create_inception_graph()
bottleneck_tensor = graph.get_tensor_by_name(ensure_name_has_port(
    BOTTLENECK_TENSOR_NAME))
print bottleneck_tensor.get_shape()

bottleneck_input = tf.placeholder_with_default(
    bottleneck_tensor, shape=[None, BOTTLENECK_TENSOR_SIZE],
    name='BottleneckInputPlaceholder')

The error:

ValueError: Shapes must be equal rank, but are 4 and 2 for 'BottleneckInputPlaceholder' (op: 'PlaceholderWithDefault') with input shapes: [1,1,1,2048].

The retrain.py:
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/image_retraining/retrain.py

I referred to the source code of Incception3 model. Also it confuses me that i can not find the tensor name as 'pool_3' in the model graph.
The model definition link:
https://github.com/tensorflow/models/blob/master/inception/inception/slim/inception_model.py

This forum is for bug reports and similar, not usage questions.  This sort of question is best asked on stackoverflow.  You might have a better chance of getting help if you post more contextual information: a link to the tutorial you're following or a list of the commands you've executed.  I spent a few minutes looking at this and can't figure out how you came up with pool_3 as a bottleneck.

The bottle_neck definition came from the example 'retrain.py', and the link is already added at the end of my question content.
Thanks for your reminding, i will post this question on stackoverflow


improve documentation

To a great pleasure I am using this script to write data from various hardwario nodes to influx. Recently I switched influx to https and i was sad I could not make it to work. Then I ended up researching the code of the script to find out how to inject https into it and noticed the 'ssl' option. Just adding ssl: true to host config made it to work. Awesome.
Would be great if this is written in the docs (or at least shown in the example config), so other people can use it as well :)
Thanks a lot for great work.

Hello, thank you for using mqtt2influxdb. On your suggestion we documented possibilities and structure of configuration file in our documentation - https://developers.hardwario.com/tutorials/mqtt-to-influxdb#configuration-file-structure-and-possibilities.


Fix an error flow when datachannel only mode

Add a guard in master and viewer example to exclude the case when we only have data channel only mode.
Issue https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-js/issues/46.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@568d6ae). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             master       #48   +/-   ##
==========================================
  Coverage          ?   100.00%
==========================================
  Files             ?         6
  Lines             ?       234
  Branches          ?        39
==========================================
  Hits              ?       234
  Misses            ?         0
  Partials          ?         0

Impacted Files
Coverage Δ

src/SignalingClient.ts
100.00% <0.00%> (ø)

src/index.ts
100.00% <0.00%> (ø)

src/internal/DateProvider.ts
100.00% <0.00%> (ø)

src/internal/utils.ts
100.00% <0.00%> (ø)

src/Role.ts
100.00% <0.00%> (ø)

src/SigV4RequestSigner.ts
100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 568d6ae...54413be. Read the comment docs.


Have error when running the code of main.R

Hello, recently I was running your code package to # Construct portfolio and benchmarks
mixture_portfolio_1y <- RollingWindowEstimation(returns = returns,
We = 252,
Wt = nrow(returns),
K = 1000,
When Mixture = TRUE) here, you'll get an error, I changed line 48 of portfolio.analysis.R to association_measure < -OptMixtureCopulas (unif_dist = unif_dist, K = K,combination = c("Clayton", "Gumbel", "t", "Normal", "Frank", "Joe")) but I still get an error and I find 75 lines zsim < -ComputeZSim (copula_mixture = association_measure,
garch_coef = fit_garch$garch_coef) The zsim generated here contains a lot of NA but here I don't know how to modify it

Hello, I've made a few changes in both functions because I was studying new combinations of Copulas and portfolio restrictions. Although, I kept the old version on the files. Please, try to use them instead of the new ones. Furthermore, if you provide me the error messages I can check what is going on and give you a better answer.
This repository was build for my conclusion project. You can access the whole paper here: https://lume.ufrgs.br/handle/10183/26434/browse?type=author&value=Jungblut%2C+João+Ramos

您好，我对这两个函数进行了一些更改，因为我正在研究 Copula 和投资组合限制的新组合。尽管如此，我还是保留了旧版本的文件。请尝试使用它们而不是新的。此外，如果您向我提供错误消息，我可以检查发生了什么并给您更好的答案。
该存储库是为我的结论项目构建的。您可以在此处访问整篇论文：https://lume.ufrgs.br/handle/10183/26434/browse ?type=author&value=Jungblut%2C+Jo%C3%A3o+Ramos

Thank you very much for your reply, your code is very excellent, but the following problems have occurred during my operation, and I have also made some modifications, but I don't know whether these modifications are correct. I can't find the old code under the current codebase, so I just run the R file main.R. Hope to get in touch with you in this way. My email address is<EMAIL_ADDRESS>If it is convenient for you, we can also contact you by email.

When I run main.R on line 51：```

Construct portfolio and benchmarks
mixture_portfolio_1y <- RollingWindowEstimation(returns = returns,
We = 252,
Wt = nrow(returns),
K = 1000,
Mixture = TRUE)
Error in `purrr::map()` at portfolio_analysis.R:101:2:
ℹ In index: 1.
Caused by error in `association_measure_with_error_handling()`:
! object 'association_measure' not found
Run `rlang::last_trace()` to see where the error occurred.
Warning message:
In value[[3L]](cond) :
  An error occurred while computing the association measure: An error occurred evaluating the 'table' parameter while selecting a method for the '%in%' function: argument "combination" is missing, with no default
I tried to modify 48 lines of code in the portfolio.analysis.R file, The original code is: `association_measure <- OptMixtureCopulas(unif_dist = unif_dist, K = K)`, I modify it as follows: `association_measure <- OptMixtureCopulas(unif_dist = unif_dist, K = K,combination = c("Clayton","Gumbel","t"))`
2. When I'm done with the above changes, run line 51 of main.R: ```
# Construct portfolio and benchmarks
mixture_portfolio_1y <- RollingWindowEstimation(returns = returns,
                                                We = 252,
                                                Wt = nrow(returns),
                                                K = 1000,
                                                Mixture = TRUE)
```，Its results are as follows: 1 of 2440

solnp-->The linearized problem has no feasible
solnp-->solution.  The problem may not be feasible.

Iter: 1 fn: -1490.7666	 Pars:   1.18545  1.00000  1.59273  1.00000  0.52227 10.10246  1.00000
solnp--> Solution not reliable....Problem Inverting Hessian.
Error in `purrr::map()` at portfolio_analysis.R:101:2:
ℹ In index: 1.
Caused by error in `CVaROptimization()`:
! unused argument (Turnover = 3e-04)
Run `rlang::last_trace()` to see where the error occurred.
There were 36 warnings (use warnings() to see them)，
Therefore, I deleted the first CVaROptimization function and the third one, and only saved the following CVaROptimization function code: ```
CVaROptimization <- function(returns,
                             Alpha = 0.975,
                             TargetReturn = 0,
                             Turnover = 0.0003,
                             NumAssets = 8) {

  # CVaROptimization: Function to perform CVaR optimization for portfolio weights.
  # Inputs:
  #   returns: A data frame of asset returns.
  #   Alpha: CVaR alpha level (default = 0.025).
  #   TargetReturn: Daily target return constraint (default = 0).
  #   Turnover: Daily turnover measure constraint (default = 0.0003) equal to transaction costs.
  #   NumAssets: Maximum number of assets in the portfolio (default = 8).
  # Output:
  #   A matrix containing the optimized portfolio weights using CVaR optimization.

  cvar_objective <- function(r_mat, alpha, probs = NULL) {
    x.names <- colnames(r_mat)
    N <- NCOL(r_mat)
    S <- NROW(r_mat)
    mu <- colMeans(r_mat)
    if (is.null(probs)) probs <- rep(1/S, S)
    if (alpha < 0.5) alpha <- 1 - alpha

    Amat <- cbind(as.matrix(r_mat),  diag(S), 1)
    var.names <- c(x.names, paste0("z_cvar_aux", seq_len(S)), "gamma")

    ## set bounds for gamma (-Inf, Inf)
    bnds <- ROI::V_bound(li = c(N + S + 1), lb = c( -Inf),
                         ui = c(N + S + 1), ub = c(  Inf))

    constraint <- L_constraint(L = Amat, dir = rep(">=", S),
                               rhs = rep(0, S),
                               names = var.names)

    objective <- L_objective(c(rep(0, N), probs/(1 - alpha), 1))

    list(objective = objective, constraint = constraint, bounds = bnds)
  }

  budget_constraint <- function(r_mat, dir = "==", rhs = 1) {
    x.names <- colnames(r_mat)
    L_constraint(L = rep(1, NCOL(r_mat)),
                 dir = dir,  rhs = rhs, names = x.names)
  }

  reward_constraint <- function(r_mat, dir = ">=", rhs = TargetReturn) {
    x.names <- colnames(r_mat)
    L_constraint(L = colMeans(r_mat), dir = dir,
                 rhs = rhs, names = x.names)
  }

  turnover_constraint <- function(r_mat, x0 = NULL, dir = "<=", rhs = Turnover) {
    x.names <- colnames(r_mat)
    N <- NCOL(r_mat)
    S <- NROW(r_mat)
    if (is.null(x0)) x0 <- rep(1/N, N)
    Amat <- cbind(diag(N), - diag(N), diag(N))
    var.names <- c(x.names,
                   paste0("y_plus_aux", seq_len(N)),
                   paste0("y_minus_aux", seq_len(N)))

    rbind(L_constraint(L = Amat, dir = rep("==", N), rhs = x0,
                       names = var.names),
          L_constraint(c(rep(0, N), rep(1, N), rep(1, N) ),
                       dir = dir, rhs = rhs, names = var.names))
  }

  cardinality_constraint <- function(r_mat, dir = "<=", rhs = NumAssets) {
    x.names <- colnames(r_mat)
    N <- NCOL(r_mat)
    Amat <- cbind(diag(N), -diag(N))
    var.names <- c(x.names, paste0("z_card_aux", seq_len(N)))
    cat("Variable types for z_card_aux must be set to binary.\n")
    rbind(L_constraint(L = Amat, dir = rep("<=", N),
                       rhs = rep(0, N), names = var.names),
          L_constraint(L = c(rep(0, N), rep(1, N)), dir = dir,
                       rhs = rhs, names = var.names))
  }

  tmp <- cvar_objective(returns, 0.975)
  lp <- OP()

  constraints(lp) <- rbind(
    tmp$constraint,
    budget_constraint(returns),
    reward_constraint(returns),
    #turnover_constraint(returns),
    cardinality_constraint(returns, dir = "<=", rhs = NumAssets),
    use.names = TRUE
  )

  ## Variable types for z_card_aux must be set to binary.
  obj <- c((tmp$objective)$L)
  objective(lp) <- c(obj, double(NCOL(constraints(lp)) - length(obj)))
  ## Error in (function (classes, fdef, mtable) : unable to find an inherited method for function 'constraints' for signature '"OP"'
  types(lp) <- rep("C",  NCOL(constraints(lp)))
  ## Error in (function (classes, fdef, mtable) : unable to find an inherited method for function 'constraints' for signature '"OP"'
  types(lp)[grep("z_card_aux", constraints(lp)$names)] <- "B"
  ## Error in (function (classes, fdef, mtable) : unable to find an inherited method for function 'constraints' for signature '"OP"'
  (sol <- ROI_solve(lp, solver = "glpk"))
  ## Error in ROI_solve(lp, solver = "glpk"): objective is missing, with no default
  weights <- round(solution(sol)[1:ncol(returns)], 4)[1:ncol(returns)]

  return(weights)
}

After I've made the above changes, continue running line 51 of main.R : ```

Construct portfolio and benchmarks
mixture_portfolio_1y <- RollingWindowEstimation(returns = returns,
We = 252,
Wt = nrow(returns),
K = 1000,
Mixture = TRUE)
No error is reported, but the calculated mixture_portfolio_1y$portfolio_return is all NA. Its results are as follows: 1 of 8

solnp-->The linearized problem has no feasible
solnp-->solution.  The problem may not be feasible.

Iter: 1 fn: -1490.7666	 Pars:   1.18545  1.00000  1.59273  1.00000  0.52227 10.10246  1.00000
solnp--> Solution not reliable....Problem Inverting Hessian.
Variable types for z_card_aux must be set to binary.
For this problem, I tried to modify 123 lines of copula_estimate.R. The original code is: ```
if(is.null(pi) == TRUE){
    pi = c(Clayton = 1, Gumbel = 1, t = 1, Normal = 1, Frank = 1, Joe = 1)

}, I modify it as follows: ```
if(is.null(pi) == TRUE){
pi = c(Clayton = 1/6, Gumbel = 1/6, t =1/6, Normal = 1/6, Frank =1/6 1, Joe = 1/6)
}
After the modification, Its results are as follows: 1 of 8

Iter: 1 fn: -1349.3177	 Pars:  1.185451489 0.000000078 1.884782512 0.054868385 0.517355370 9.338307771 0.945131537
Iter: 2 fn: -1349.3177	 Pars:  1.1854514890 0.0000000183 1.8848063293 0.0548664868 0.5173557482 9.3384527559 0.9451334949
Iter: 3 fn: -1349.3177	 Pars:  1.18545148897 0.00000001068 1.88476221200 0.05486982385 0.51735509669 9.33816085686 0.94513016548
solnp--> Completed in 3 iterations
Variable types for z_card_aux must be set to binary.
At this point, I don't know how to modify the code to correct the "Variable types for z_card_aux must be set to binary." And the result I ran was different from your portfolio_return data in excel in the result folder.
4.After making the above changes, I try to run your code with my own data set, and sometimes the following two problems occur:
1. In fitCopula.ml(copula, u = data, method = method, start = start,  ... :
  possible convergence problem: optim() gave code=52
2. 1: In .local(copula, tau, ...) :
  For the Gumbel copula, tau must be >= 0. Replacing negative values by 0.

Thank you very much for your reply, your code is very excellent, but the following problems have occurred during my operation, and I have also made some modifications, but I don't know whether these modifications are correct. I can't find the old code under the current codebase, so I just run the R file main.R. I am not very familiar with the platform github, and I have not found any other contact information for you, so I still use this way to contact you, hoping to get in touch with you in this way. My email address is<EMAIL_ADDRESS>If it is convenient for you, we can also contact you by email.

When I run main.R on line 51：# Construct portfolio and benchmarks
mixture_portfolio_1y <- RollingWindowEstimation(returns = returns,
We = 252,
Wt = nrow(returns),
K = 1000,
Mixture = TRUE)，Its results are as follows: 1 of 2440
Error in purrr::map() at portfolio_analysis.R:101:2:
ℹ In index: 1.
Caused by error in association_measure_with_error_handling():
! object 'association_measure' not found
Run rlang::last_trace() to see where the error occurred.
Warning message:
In value[3L] :
An error occurred while computing the association measure: An error occurred evaluating the 'table' parameter while selecting a method for the '%in%' function: argument "combination" is missing, with no default
I tried to modify 48 lines of code in the portfolio.analysis.R file, The original code is: association_measure <- OptMixtureCopulas(unif_dist = unif_dist, K = K), I modify it as follows: association_measure <- OptMixtureCopulas(unif_dist = unif_dist, K = K,combination = c("Clayton","Gumbel","t"))
When I'm done with the above changes, run line 51 of main.R: # Construct portfolio and benchmarks
mixture_portfolio_1y <- RollingWindowEstimation(returns = returns,
We = 252,
Wt = nrow(returns),
K = 1000,
Mixture = TRUE)，Its results are as follows: 1 of 2440

solnp-->The linearized problem has no feasible
solnp-->solution.  The problem may not be feasible.
Iter: 1 fn: -1490.7666	 Pars:   1.18545  1.00000  1.59273  1.00000  0.52227 10.10246  1.00000
solnp--> Solution not reliable....Problem Inverting Hessian.
Error in purrr::map() at portfolio_analysis.R:101:2:
ℹ In index: 1.
Caused by error in CVaROptimization():
! unused argument (Turnover = 3e-04)
Run rlang::last_trace() to see where the error occurred.
There were 36 warnings (use warnings() to see them)，
Therefore, I deleted the first CVaROptimization function and the third one, and only saved the following CVaROptimization function code: CVaROptimization <- function(returns,
Alpha = 0.975,
TargetReturn = 0,
Turnover = 0.0003,
NumAssets = 8) {
CVaROptimization: Function to perform CVaR optimization for portfolio weights.
Inputs:
returns: A data frame of asset returns.
Alpha: CVaR alpha level (default = 0.025).
TargetReturn: Daily target return constraint (default = 0).
Turnover: Daily turnover measure constraint (default = 0.0003) equal to transaction costs.
NumAssets: Maximum number of assets in the portfolio (default = 8).
Output:
A matrix containing the optimized portfolio weights using CVaR optimization.
cvar_objective <- function(r_mat, alpha, probs = NULL) {
x.names <- colnames(r_mat)
N <- NCOL(r_mat)
S <- NROW(r_mat)
mu <- colMeans(r_mat)
if (is.null(probs)) probs <- rep(1/S, S)
if (alpha < 0.5) alpha <- 1 - alpha
Amat <- cbind(as.matrix(r_mat),  diag(S), 1)
var.names <- c(x.names, paste0("z_cvar_aux", seq_len(S)), "gamma")

## set bounds for gamma (-Inf, Inf)
bnds <- ROI::V_bound(li = c(N + S + 1), lb = c( -Inf),
                     ui = c(N + S + 1), ub = c(  Inf))

constraint <- L_constraint(L = Amat, dir = rep(">=", S),
                           rhs = rep(0, S),
                           names = var.names)

objective <- L_objective(c(rep(0, N), probs/(1 - alpha), 1))

list(objective = objective, constraint = constraint, bounds = bnds)

}
budget_constraint <- function(r_mat, dir = "==", rhs = 1) {
x.names <- colnames(r_mat)
L_constraint(L = rep(1, NCOL(r_mat)),
dir = dir,  rhs = rhs, names = x.names)
}
reward_constraint <- function(r_mat, dir = ">=", rhs = TargetReturn) {
x.names <- colnames(r_mat)
L_constraint(L = colMeans(r_mat), dir = dir,
rhs = rhs, names = x.names)
}
turnover_constraint <- function(r_mat, x0 = NULL, dir = "<=", rhs = Turnover) {
x.names <- colnames(r_mat)
N <- NCOL(r_mat)
S <- NROW(r_mat)
if (is.null(x0)) x0 <- rep(1/N, N)
Amat <- cbind(diag(N), - diag(N), diag(N))
var.names <- c(x.names,
paste0("y_plus_aux", seq_len(N)),
paste0("y_minus_aux", seq_len(N)))
rbind(L_constraint(L = Amat, dir = rep("==", N), rhs = x0,
                   names = var.names),
      L_constraint(c(rep(0, N), rep(1, N), rep(1, N) ),
                   dir = dir, rhs = rhs, names = var.names))

}
cardinality_constraint <- function(r_mat, dir = "<=", rhs = NumAssets) {
x.names <- colnames(r_mat)
N <- NCOL(r_mat)
Amat <- cbind(diag(N), -diag(N))
var.names <- c(x.names, paste0("z_card_aux", seq_len(N)))
cat("Variable types for z_card_aux must be set to binary.\n")
rbind(L_constraint(L = Amat, dir = rep("<=", N),
rhs = rep(0, N), names = var.names),
L_constraint(L = c(rep(0, N), rep(1, N)), dir = dir,
rhs = rhs, names = var.names))
}
tmp <- cvar_objective(returns, 0.975)
lp <- OP()
constraints(lp) <- rbind(
tmp$constraint,
budget_constraint(returns),
reward_constraint(returns),
#turnover_constraint(returns),
cardinality_constraint(returns, dir = "<=", rhs = NumAssets),
use.names = TRUE
)
Variable types for z_card_aux must be set to binary.
obj <- c((tmp$objective)$L)
objective(lp) <- c(obj, double(NCOL(constraints(lp)) - length(obj)))
Error in (function (classes, fdef, mtable) : unable to find an inherited method for function 'constraints' for signature '"OP"'
types(lp) <- rep("C",  NCOL(constraints(lp)))
Error in (function (classes, fdef, mtable) : unable to find an inherited method for function 'constraints' for signature '"OP"'
types(lp)[grep("z_card_aux", constraints(lp)$names)] <- "B"
Error in (function (classes, fdef, mtable) : unable to find an inherited method for function 'constraints' for signature '"OP"'
(sol <- ROI_solve(lp, solver = "glpk"))
Error in ROI_solve(lp, solver = "glpk"): objective is missing, with no default
weights <- round(solution(sol)[1:ncol(returns)], 4)[1:ncol(returns)]
return(weights)
}
3. After I've made the above changes, continue running line 51 of main.R,: # Construct portfolio and benchmarks
mixture_portfolio_1y <- RollingWindowEstimation(returns = returns,
We = 252,
Wt = nrow(returns),
K = 1000,
Mixture = TRUE)，
No error is reported, but the calculated mixture_portfolio_1y$portfolio_return is all NA. Its results are as follows: 1 of 8
solnp-->The linearized problem has no feasible
solnp-->solution.  The problem may not be feasible.
Iter: 1 fn: -1490.7666	 Pars:   1.18545  1.00000  1.59273  1.00000  0.52227 10.10246  1.00000
solnp--> Solution not reliable....Problem Inverting Hessian.
Variable types for z_card_aux must be set to binary.
For this problem, I tried to modify 123 lines of copula_estimate.R. The original code is: if(is.null(pi) == TRUE){
pi = c(Clayton = 1, Gumbel = 1, t = 1, Normal = 1, Frank = 1, Joe = 1)
}, I modify it as follows: if(is.null(pi) == TRUE){
pi = c(Clayton = 1/6, Gumbel = 1/6, t =1/6, Normal = 1/6, Frank =1/6 1, Joe = 1/6)
}
After the modification, Its results are as follows: 1 of 8
Iter: 1 fn: -1349.3177	 Pars:  1.185451489 0.000000078 1.884782512 0.054868385 0.517355370 9.338307771 0.945131537
Iter: 2 fn: -1349.3177	 Pars:  1.1854514890 0.0000000183 1.8848063293 0.0548664868 0.5173557482 9.3384527559 0.9451334949
Iter: 3 fn: -1349.3177	 Pars:  1.18545148897 0.00000001068 1.88476221200 0.05486982385 0.51735509669 9.33816085686 0.94513016548
solnp--> Completed in 3 iterations
Variable types for z_card_aux must be set to binary.
At this point, I don't know how to modify the code to correct the "Variable types for z_card_aux must be set to binary." And the result I ran was different from your portfolio_return data in excel in the result folder.
4.After making the above changes, I try to run your code with my own data set, and sometimes the following two problems occur:

In fitCopula.ml(copula, u = data, method = method, start = start,  ... :
possible convergence problem: optim() gave code=52
1: In .local(copula, tau, ...) :
For the Gumbel copula, tau must be >= 0. Replacing negative values by 0.

Thank you very much for your reply, your code is very excellent, but the following problems have occurred during my operation, and I have also made some modifications, but I don't know whether these modifications are correct. I can't find the old code under the current codebase, so I just run the R file main.R. I am not very familiar with the platform github, and I have not found any other contact information for you, so I still use this way to contact you, hoping to get in touch with you in this way. My email address is<EMAIL_ADDRESS>If it is convenient for you, we can also contact you by email.

When I run main.R on line 51：
mixture_portfolio_1y <- RollingWindowEstimation(returns = returns,
We = 252,
Wt = nrow(returns),
K = 1000,
Mixture = TRUE)，Its results are as follows: 1 of 2440
Error in purrr::map() at portfolio_analysis.R:101:2:
ℹ In index: 1.
Caused by error in association_measure_with_error_handling():
! object 'association_measure' not found
Run rlang::last_trace() to see where the error occurred.
Warning message:
In value[3L] :
An error occurred while computing the association measure: An error occurred evaluating the 'table' parameter while selecting a method for the '%in%' function: argument "combination" is missing, with no default
I tried to modify 48 lines of code in the portfolio.analysis.R file, The original code is: association_measure <- OptMixtureCopulas(unif_dist = unif_dist, K = K), I modify it as follows: association_measure <- OptMixtureCopulas(unif_dist = unif_dist, K = K,combination = c("Clayton","Gumbel","t"))
When I'm done with the above changes, run line 51 of main.R:
mixture_portfolio_1y <- RollingWindowEstimation(returns = returns,
We = 252,
Wt = nrow(returns),
K = 1000,
Mixture = TRUE)，Its results are as follows: 1 of 2440

solnp-->The linearized problem has no feasible
solnp-->solution.  The problem may not be feasible.
Iter: 1 fn: -1490.7666	 Pars:   1.18545  1.00000  1.59273  1.00000  0.52227 10.10246  1.00000
solnp--> Solution not reliable....Problem Inverting Hessian.
Error in purrr::map() at portfolio_analysis.R:101:2:
ℹ In index: 1.
Caused by error in CVaROptimization():
! unused argument (Turnover = 3e-04)
Run rlang::last_trace() to see where the error occurred.
There were 36 warnings (use warnings() to see them)，
Therefore, I deleted the first CVaROptimization function and the third one, and only saved the following CVaROptimization function code: CVaROptimization <- function(returns,
Alpha = 0.975,
TargetReturn = 0,
Turnover = 0.0003,
NumAssets = 8) {
cvar_objective <- function(r_mat, alpha, probs = NULL) {
x.names <- colnames(r_mat)
N <- NCOL(r_mat)
S <- NROW(r_mat)
mu <- colMeans(r_mat)
if (is.null(probs)) probs <- rep(1/S, S)
if (alpha < 0.5) alpha <- 1 - alpha
Amat <- cbind(as.matrix(r_mat),  diag(S), 1)
var.names <- c(x.names, paste0("z_cvar_aux", seq_len(S)), "gamma")

bnds <- ROI::V_bound(li = c(N + S + 1), lb = c( -Inf),
                     ui = c(N + S + 1), ub = c(  Inf))

constraint <- L_constraint(L = Amat, dir = rep(">=", S),
                           rhs = rep(0, S),
                           names = var.names)

objective <- L_objective(c(rep(0, N), probs/(1 - alpha), 1))

list(objective = objective, constraint = constraint, bounds = bnds)

}
budget_constraint <- function(r_mat, dir = "==", rhs = 1) {
x.names <- colnames(r_mat)
L_constraint(L = rep(1, NCOL(r_mat)),
dir = dir,  rhs = rhs, names = x.names)
}
reward_constraint <- function(r_mat, dir = ">=", rhs = TargetReturn) {
x.names <- colnames(r_mat)
L_constraint(L = colMeans(r_mat), dir = dir,
rhs = rhs, names = x.names)
}
turnover_constraint <- function(r_mat, x0 = NULL, dir = "<=", rhs = Turnover) {
x.names <- colnames(r_mat)
N <- NCOL(r_mat)
S <- NROW(r_mat)
if (is.null(x0)) x0 <- rep(1/N, N)
Amat <- cbind(diag(N), - diag(N), diag(N))
var.names <- c(x.names,
paste0("y_plus_aux", seq_len(N)),
paste0("y_minus_aux", seq_len(N)))
rbind(L_constraint(L = Amat, dir = rep("==", N), rhs = x0,
                   names = var.names),
      L_constraint(c(rep(0, N), rep(1, N), rep(1, N) ),
                   dir = dir, rhs = rhs, names = var.names))

}
cardinality_constraint <- function(r_mat, dir = "<=", rhs = NumAssets) {
x.names <- colnames(r_mat)
N <- NCOL(r_mat)
Amat <- cbind(diag(N), -diag(N))
var.names <- c(x.names, paste0("z_card_aux", seq_len(N)))
cat("Variable types for z_card_aux must be set to binary.\n")
rbind(L_constraint(L = Amat, dir = rep("<=", N),
rhs = rep(0, N), names = var.names),
L_constraint(L = c(rep(0, N), rep(1, N)), dir = dir,
rhs = rhs, names = var.names))
}
tmp <- cvar_objective(returns, 0.975)
lp <- OP()
constraints(lp) <- rbind(
tmp$constraint,
budget_constraint(returns),
reward_constraint(returns),
#turnover_constraint(returns),
cardinality_constraint(returns, dir = "<=", rhs = NumAssets),
use.names = TRUE
)
obj <- c((tmp$objective)$L)
objective(lp) <- c(obj, double(NCOL(constraints(lp)) - length(obj)))
types(lp) <- rep("C",  NCOL(constraints(lp)))
types(lp)[grep("z_card_aux", constraints(lp)$names)] <- "B"
(sol <- ROI_solve(lp, solver = "glpk"))
weights <- round(solution(sol)[1:ncol(returns)], 4)[1:ncol(returns)]
return(weights)
}
3. After I've made the above changes, continue running line 51 of main.R,:
mixture_portfolio_1y <- RollingWindowEstimation(returns = returns,
We = 252,
Wt = nrow(returns),
K = 1000,
Mixture = TRUE)，
No error is reported, but the calculated mixture_portfolio_1y$portfolio_return is all NA. Its results are as follows: 1 of 8
solnp-->The linearized problem has no feasible
solnp-->solution.  The problem may not be feasible.
Iter: 1 fn: -1490.7666	 Pars:   1.18545  1.00000  1.59273  1.00000  0.52227 10.10246  1.00000
solnp--> Solution not reliable....Problem Inverting Hessian.
Variable types for z_card_aux must be set to binary.
For this problem, I tried to modify 123 lines of copula_estimate.R. The original code is: if(is.null(pi) == TRUE){
pi = c(Clayton = 1, Gumbel = 1, t = 1, Normal = 1, Frank = 1, Joe = 1)
}, I modify it as follows: if(is.null(pi) == TRUE){
pi = c(Clayton = 1/6, Gumbel = 1/6, t =1/6, Normal = 1/6, Frank =1/6 1, Joe = 1/6)
}
After the modification, Its results are as follows: 1 of 8
Iter: 1 fn: -1349.3177	 Pars:  1.185451489 0.000000078 1.884782512 0.054868385 0.517355370 9.338307771 0.945131537
Iter: 2 fn: -1349.3177	 Pars:  1.1854514890 0.0000000183 1.8848063293 0.0548664868 0.5173557482 9.3384527559 0.9451334949
Iter: 3 fn: -1349.3177	 Pars:  1.18545148897 0.00000001068 1.88476221200 0.05486982385 0.51735509669 9.33816085686 0.94513016548
solnp--> Completed in 3 iterations
Variable types for z_card_aux must be set to binary.
At this point, I don't know how to modify the code to correct the "Variable types for z_card_aux must be set to binary." And the result I ran was different from your portfolio_return data in excel in the result folder.
4.After making the above changes, I try to run your code with my own data set, and sometimes the following two problems occur:

In fitCopula.ml(copula, u = data, method = method, start = start,  ... :
possible convergence problem: optim() gave code=52
1: In .local(copula, tau, ...) :
For the Gumbel copula, tau must be >= 0. Replacing negative values by 0.

Thank you very much for your reply, your code is very excellent, but the following problems have occurred during my operation, and I have also made some modifications, but I don't know whether these modifications are correct. I can't find the old code under the current codebase, so I just run the R file main.R. Hope to get in touch with you in this way. My email address is<EMAIL_ADDRESS>If it is convenient for you, we can also contact by email.

When I run main.R on line 51：
mixture_portfolio_1y <- RollingWindowEstimation(returns = returns,
We = 252,
Wt = nrow(returns),
K = 1000,
Mixture = TRUE)，Its results are as follows: 1 of 2440
Error in purrr::map() at portfolio_analysis.R:101:2:
ℹ In index: 1.
Caused by error in association_measure_with_error_handling():
! object 'association_measure' not found
Run rlang::last_trace() to see where the error occurred.
Warning message:
In value[3L] :
An error occurred while computing the association measure: An error occurred evaluating the 'table' parameter while selecting a method for the '%in%' function: argument "combination" is missing, with no default
I tried to modify 48 lines of code in the portfolio.analysis.R file, The original code is: association_measure <- OptMixtureCopulas(unif_dist = unif_dist, K = K), I modify it as follows: association_measure <- OptMixtureCopulas(unif_dist = unif_dist, K = K,combination = c("Clayton","Gumbel","t"))
When I'm done with the above changes, run line 51 of main.R:
mixture_portfolio_1y <- RollingWindowEstimation(returns = returns,
We = 252,
Wt = nrow(returns),
K = 1000,
Mixture = TRUE)，Its results are as follows: 1 of 2440

solnp-->The linearized problem has no feasible
solnp-->solution.  The problem may not be feasible.
Iter: 1 fn: -1490.7666	 Pars:   1.18545  1.00000  1.59273  1.00000  0.52227 10.10246  1.00000
solnp--> Solution not reliable....Problem Inverting Hessian.
Error in purrr::map() at portfolio_analysis.R:101:2:
ℹ In index: 1.
Caused by error in CVaROptimization():
! unused argument (Turnover = 3e-04)
Run rlang::last_trace() to see where the error occurred.
There were 36 warnings (use warnings() to see them)，
Therefore, I deleted the first CVaROptimization function and the third one, and only saved the following CVaROptimization function code: CVaROptimization <- function(returns,
Alpha = 0.975,
TargetReturn = 0,
Turnover = 0.0003,
NumAssets = 8) {
cvar_objective <- function(r_mat, alpha, probs = NULL) {
x.names <- colnames(r_mat)
N <- NCOL(r_mat)
S <- NROW(r_mat)
mu <- colMeans(r_mat)
if (is.null(probs)) probs <- rep(1/S, S)
if (alpha < 0.5) alpha <- 1 - alpha
Amat <- cbind(as.matrix(r_mat),  diag(S), 1)
var.names <- c(x.names, paste0("z_cvar_aux", seq_len(S)), "gamma")

bnds <- ROI::V_bound(li = c(N + S + 1), lb = c( -Inf),
                     ui = c(N + S + 1), ub = c(  Inf))

constraint <- L_constraint(L = Amat, dir = rep(">=", S),
                           rhs = rep(0, S),
                           names = var.names)

objective <- L_objective(c(rep(0, N), probs/(1 - alpha), 1))

list(objective = objective, constraint = constraint, bounds = bnds)

}
budget_constraint <- function(r_mat, dir = "==", rhs = 1) {
x.names <- colnames(r_mat)
L_constraint(L = rep(1, NCOL(r_mat)),
dir = dir,  rhs = rhs, names = x.names)
}
reward_constraint <- function(r_mat, dir = ">=", rhs = TargetReturn) {
x.names <- colnames(r_mat)
L_constraint(L = colMeans(r_mat), dir = dir,
rhs = rhs, names = x.names)
}
turnover_constraint <- function(r_mat, x0 = NULL, dir = "<=", rhs = Turnover) {
x.names <- colnames(r_mat)
N <- NCOL(r_mat)
S <- NROW(r_mat)
if (is.null(x0)) x0 <- rep(1/N, N)
Amat <- cbind(diag(N), - diag(N), diag(N))
var.names <- c(x.names,
paste0("y_plus_aux", seq_len(N)),
paste0("y_minus_aux", seq_len(N)))
rbind(L_constraint(L = Amat, dir = rep("==", N), rhs = x0,
                   names = var.names),
      L_constraint(c(rep(0, N), rep(1, N), rep(1, N) ),
                   dir = dir, rhs = rhs, names = var.names))

}
cardinality_constraint <- function(r_mat, dir = "<=", rhs = NumAssets) {
x.names <- colnames(r_mat)
N <- NCOL(r_mat)
Amat <- cbind(diag(N), -diag(N))
var.names <- c(x.names, paste0("z_card_aux", seq_len(N)))
cat("Variable types for z_card_aux must be set to binary.\n")
rbind(L_constraint(L = Amat, dir = rep("<=", N),
rhs = rep(0, N), names = var.names),
L_constraint(L = c(rep(0, N), rep(1, N)), dir = dir,
rhs = rhs, names = var.names))
}
tmp <- cvar_objective(returns, 0.975)
lp <- OP()
constraints(lp) <- rbind(
tmp$constraint,
budget_constraint(returns),
reward_constraint(returns),
#turnover_constraint(returns),
cardinality_constraint(returns, dir = "<=", rhs = NumAssets),
use.names = TRUE
)
obj <- c((tmp$objective)$L)
objective(lp) <- c(obj, double(NCOL(constraints(lp)) - length(obj)))
types(lp) <- rep("C",  NCOL(constraints(lp)))
types(lp)[grep("z_card_aux", constraints(lp)$names)] <- "B"
(sol <- ROI_solve(lp, solver = "glpk"))
weights <- round(solution(sol)[1:ncol(returns)], 4)[1:ncol(returns)]
return(weights)
}
3. After I've made the above changes, continue running line 51 of main.R,:
mixture_portfolio_1y <- RollingWindowEstimation(returns = returns,
We = 252,
Wt = nrow(returns),
K = 1000,
Mixture = TRUE)，
No error is reported, but the calculated mixture_portfolio_1y$portfolio_return is all NA. Its results are as follows: 1 of 8
solnp-->The linearized problem has no feasible
solnp-->solution.  The problem may not be feasible.
Iter: 1 fn: -1490.7666	 Pars:   1.18545  1.00000  1.59273  1.00000  0.52227 10.10246  1.00000
solnp--> Solution not reliable....Problem Inverting Hessian.
Variable types for z_card_aux must be set to binary.
For this problem, I tried to modify 123 lines of copula_estimate.R. The original code is: if(is.null(pi) == TRUE){
pi = c(Clayton = 1, Gumbel = 1, t = 1, Normal = 1, Frank = 1, Joe = 1)
}, I modify it as follows: if(is.null(pi) == TRUE){
pi = c(Clayton = 1/6, Gumbel = 1/6, t =1/6, Normal = 1/6, Frank =1/6 1, Joe = 1/6)
}
After the modification, Its results are as follows: 1 of 8
Iter: 1 fn: -1349.3177	 Pars:  1.185451489 0.000000078 1.884782512 0.054868385 0.517355370 9.338307771 0.945131537
Iter: 2 fn: -1349.3177	 Pars:  1.1854514890 0.0000000183 1.8848063293 0.0548664868 0.5173557482 9.3384527559 0.9451334949
Iter: 3 fn: -1349.3177	 Pars:  1.18545148897 0.00000001068 1.88476221200 0.05486982385 0.51735509669 9.33816085686 0.94513016548
solnp--> Completed in 3 iterations
Variable types for z_card_aux must be set to binary.
At this point, I don't know how to modify the code to correct the "Variable types for z_card_aux must be set to binary." And the result I ran was different from your portfolio_return data in excel in the result folder.
4.After making the above changes, I try to run your code with my own data set, and sometimes the following two problems occur:
1: In .local(copula, tau, ...) :
For the Gumbel copula, tau must be >= 0. Replacing negative values by 0.

Thank you very much for your reply, your code is very excellent, but the following problems have occurred during my operation, and I have also made some modifications, but I don't know whether these modifications are correct. I can't find the old code under the current codebase, so I just run the R file main.R. Hope to get in touch with you in this way. My email address is<EMAIL_ADDRESS>If it is convenient for you, we can also contact you by email.I have four questions as followings:

When I run main.R on line 51：
mixture_portfolio_1y <- RollingWindowEstimation(returns = returns,
We = 252,
Wt = nrow(returns),
K = 1000,
Mixture = TRUE)，Its results are as follows: 1 of 2440
Error in purrr::map() at portfolio_analysis.R:101:2:
ℹ In index: 1.
Caused by error in association_measure_with_error_handling():
! object 'association_measure' not found
Run rlang::last_trace() to see where the error occurred.
Warning message:
In value[3L] :
An error occurred while computing the association measure: An error occurred evaluating the 'table' parameter while selecting a method for the '%in%' function: argument "combination" is missing, with no default
I tried to modify 48 lines of code in the portfolio.analysis.R file, The original code is: association_measure <- OptMixtureCopulas(unif_dist = unif_dist, K = K), I modify it as follows: association_measure <- OptMixtureCopulas(unif_dist = unif_dist, K = K,combination = c("Clayton","Gumbel","t"))
When I'm done with the above changes, run line 51 of main.R:
mixture_portfolio_1y <- RollingWindowEstimation(returns = returns,
We = 252,
Wt = nrow(returns),
K = 1000,
Mixture = TRUE)，Its results are as follows: 1 of 2440

solnp-->The linearized problem has no feasible
solnp-->solution.  The problem may not be feasible.
Iter: 1 fn: -1490.7666	 Pars:   1.18545  1.00000  1.59273  1.00000  0.52227 10.10246  1.00000
solnp--> Solution not reliable....Problem Inverting Hessian.
Error in purrr::map() at portfolio_analysis.R:101:2:
ℹ In index: 1.
Caused by error in CVaROptimization():
! unused argument (Turnover = 3e-04)
Run rlang::last_trace() to see where the error occurred.
There were 36 warnings (use warnings() to see them)，
Therefore, I deleted the first CVaROptimization function and the third one, and only saved the following CVaROptimization function code: CVaROptimization <- function(returns,
Alpha = 0.975,
TargetReturn = 0,
Turnover = 0.0003,
NumAssets = 8) {
cvar_objective <- function(r_mat, alpha, probs = NULL) {
x.names <- colnames(r_mat)
N <- NCOL(r_mat)
S <- NROW(r_mat)
mu <- colMeans(r_mat)
if (is.null(probs)) probs <- rep(1/S, S)
if (alpha < 0.5) alpha <- 1 - alpha
Amat <- cbind(as.matrix(r_mat),  diag(S), 1)
var.names <- c(x.names, paste0("z_cvar_aux", seq_len(S)), "gamma")

bnds <- ROI::V_bound(li = c(N + S + 1), lb = c( -Inf),
                     ui = c(N + S + 1), ub = c(  Inf))

constraint <- L_constraint(L = Amat, dir = rep(">=", S),
                           rhs = rep(0, S),
                           names = var.names)

objective <- L_objective(c(rep(0, N), probs/(1 - alpha), 1))

list(objective = objective, constraint = constraint, bounds = bnds)

}
budget_constraint <- function(r_mat, dir = "==", rhs = 1) {
x.names <- colnames(r_mat)
L_constraint(L = rep(1, NCOL(r_mat)),
dir = dir,  rhs = rhs, names = x.names)
}
reward_constraint <- function(r_mat, dir = ">=", rhs = TargetReturn) {
x.names <- colnames(r_mat)
L_constraint(L = colMeans(r_mat), dir = dir,
rhs = rhs, names = x.names)
}
turnover_constraint <- function(r_mat, x0 = NULL, dir = "<=", rhs = Turnover) {
x.names <- colnames(r_mat)
N <- NCOL(r_mat)
S <- NROW(r_mat)
if (is.null(x0)) x0 <- rep(1/N, N)
Amat <- cbind(diag(N), - diag(N), diag(N))
var.names <- c(x.names,
paste0("y_plus_aux", seq_len(N)),
paste0("y_minus_aux", seq_len(N)))
rbind(L_constraint(L = Amat, dir = rep("==", N), rhs = x0,
                   names = var.names),
      L_constraint(c(rep(0, N), rep(1, N), rep(1, N) ),
                   dir = dir, rhs = rhs, names = var.names))

}
cardinality_constraint <- function(r_mat, dir = "<=", rhs = NumAssets) {
x.names <- colnames(r_mat)
N <- NCOL(r_mat)
Amat <- cbind(diag(N), -diag(N))
var.names <- c(x.names, paste0("z_card_aux", seq_len(N)))
cat("Variable types for z_card_aux must be set to binary.\n")
rbind(L_constraint(L = Amat, dir = rep("<=", N),
rhs = rep(0, N), names = var.names),
L_constraint(L = c(rep(0, N), rep(1, N)), dir = dir,
rhs = rhs, names = var.names))
}
tmp <- cvar_objective(returns, 0.975)
lp <- OP()
constraints(lp) <- rbind(
tmp$constraint,
budget_constraint(returns),
reward_constraint(returns),
#turnover_constraint(returns),
cardinality_constraint(returns, dir = "<=", rhs = NumAssets),
use.names = TRUE
)
obj <- c((tmp$objective)$L)
objective(lp) <- c(obj, double(NCOL(constraints(lp)) - length(obj)))
types(lp) <- rep("C",  NCOL(constraints(lp)))
types(lp)[grep("z_card_aux", constraints(lp)$names)] <- "B"
(sol <- ROI_solve(lp, solver = "glpk"))
weights <- round(solution(sol)[1:ncol(returns)], 4)[1:ncol(returns)]
return(weights)
}
3. After I've made the above changes, continue running line 51 of main.R,:
mixture_portfolio_1y <- RollingWindowEstimation(returns = returns,
We = 252,
Wt = nrow(returns),
K = 1000,
Mixture = TRUE)，
No error is reported, but the calculated mixture_portfolio_1y$portfolio_return is all NA. Its results are as follows: 1 of 8
solnp-->The linearized problem has no feasible
solnp-->solution.  The problem may not be feasible.
Iter: 1 fn: -1490.7666	 Pars:   1.18545  1.00000  1.59273  1.00000  0.52227 10.10246  1.00000
solnp--> Solution not reliable....Problem Inverting Hessian.
Variable types for z_card_aux must be set to binary.
For this problem, I tried to modify 123 lines of copula_estimate.R. The original code is: if(is.null(pi) == TRUE){
pi = c(Clayton = 1, Gumbel = 1, t = 1, Normal = 1, Frank = 1, Joe = 1)
}, I modify it as follows: if(is.null(pi) == TRUE){
pi = c(Clayton = 1/6, Gumbel = 1/6, t =1/6, Normal = 1/6, Frank =1/6 1, Joe = 1/6)
}
After the modification, Its results are as follows: 1 of 8
Iter: 1 fn: -1349.3177	 Pars:  1.185451489 0.000000078 1.884782512 0.054868385 0.517355370 9.338307771 0.945131537
Iter: 2 fn: -1349.3177	 Pars:  1.1854514890 0.0000000183 1.8848063293 0.0548664868 0.5173557482 9.3384527559 0.9451334949
Iter: 3 fn: -1349.3177	 Pars:  1.18545148897 0.00000001068 1.88476221200 0.05486982385 0.51735509669 9.33816085686 0.94513016548
solnp--> Completed in 3 iterations
Variable types for z_card_aux must be set to binary.
At this point, the result I ran was different from your portfolio_return data in excel in the result folder.
4.After making the above changes, I try to run your code with my own data set, and sometimes the following two problems occur:
1: In .local(copula, tau, ...) :
For the Gumbel copula, tau must be >= 0. Replacing negative values by 0.

When I have time to test the code again, I'll come back with a solution for your doubts.

Okay,thank you very much. And I also have a question,do these files contain the old version?I cannot find the old version.I'm a little worried.

I checked the files again and found that I had removed the old version of the OptMixtureCopulas function. If you try to run main.R, you'll encounter an error because it was designed for my conclusion project. Instead, please run test.R, which has been updated with new functionalities.

Thanks for your answer, I re-downloaded your codebase, I ran test.R, but something went wrong, I was running 63 lines of test.R:
MarketComposition <- read_excel("data_directory/MarketComposition.xlsx") %>%
mutate(date = as.Date(Data), # convert to date format
m = month(date, label = TRUE)) %>% # convert to numeric format
dplyr::filter(m == "dez") %>% # update factors
select(date, everything(),-c(Data, m)) %>% # select date, month and tickers
gather("Ticker", "Composition", -date, na.rm=TRUE) %>% # adjust to panel data
group_by(date) %>% # Select tickers by last date of the month
reframe(Tickers = Ticker)
MarketComposition
The resulting MarketComposition is empty, 0 obs. of 2 variables. I don't know how to solve this problem.
In addition, I would like to ask you about the problems that occur when running the main.R file. Can you show me the latest portfolio_optimization.R and portfolio_analysis.R files that I need to run the main.R file. In view of the problems caused by running main.R, I made some code modifications last time, and I also told you my modification scheme, but I am not sure whether the modification method is correct.

It's all good with MarketComposition; it might be a misidentification of a function. Try declaring the library first in all tidyverse functions as in "dplyr::filter()".

MarketComposition <- read_excel("data_directory/MarketComposition.xlsx") %>%

mutate(date = as.Date(Data), # convert to date format

     m = month(date, label = TRUE)) %>% # convert to numeric format

dplyr::filter(m == "dez") %>% # update factors
select(date, everything(), -c(Data, m)) %>% # select date, month, and tickers
gather("Ticker", "Composition", -date, na.rm=TRUE) %>% # adjust to panel data
group_by(date) %>% # Select tickers by last date of the month
reframe(Tickers = Ticker)

MarketComposition

A tibble: 1,557 × 2
date       Tickers

1 1997-12-31 ITUB4
2 1997-12-31 PETR4
3 1997-12-31 BBDC4
4 1997-12-31 ELET3
5 1997-12-31 BBAS3
6 1997-12-31 ITSA4
7 1997-12-31 CMIG4
8 1997-12-31 VIVT3
9 1997-12-31 ELET6
10 1997-12-31 CSNA3
ℹ 1,547 more rows
ℹ Use print(n = ...) to see more rows
On the other hand, I will reorganize this repository and include the old version.

Thanks for your patient answer. I tried the method you suggested again, but the result of MarketComposition is still
MarketComposition
A tibble: 0 × 2
ℹ 2 variables: date , Tickers
Now I guess there is a problem with MarketComposition.xlsx. The first column of my MarketComposition.xlsx file is Data, and the data format is "1997/12/31". MarketComposition.xlsx has 301 rows and 214 columns, but some columns are all NA
Also, thank you very much for reorganizing your code base and uploading code files containing older versions.


accept feature class string as config

Let feature_class accepting string as well so we can lazy load the constant.
 config.feature_class = "::Features" # OR  config.feature_class = Features
 config.feature_name = :password_validation_using_pbkdf2

Using symbol would visually looks better, but less control on the caller side. As we would magically do the transformation to_s.camelize (classify doesn't work as it will turn :features into Feature) which doesn't add much benefits.

This looks pretty good, though I think we might still need a railtie or similar to re-constantize the class after a reload.

Right. I have a hard time justify to make development auto reload working by introduce another Railtie module, as this is a class variable injected into the client User model, can't think of a clean way of not polluting the main migratable/model.rb file in order to achieve this. Things I can think of to make this work:

add a hook in migratable/model.rb to capture the parent User class. (This might introducing User class reload support cycle problem 🤕)
inject a reload_feature_class! method to the User class.
Then during config.to_prepare call the "captured" model's reload_feature_class!

Am I over complicated things like there is a simpler/better way to do this?
If this is only used for development, and Features class would be rarely reloaded, I think it might be a good trade off to not support this in order to get a simpler code? Let me know what do you think?

Using block now, updated description. Thanks @f1sherman !


Module not found core import error NEXTJS 13

Describe the bug
Module not found even when providing unpkg url as corepath
Locally works without defining corepath but same does not work when deployed.
When providing anything as corepath it fails both locally and when deployed.
I have tried multiple versions of @ffmpeg and @ffmpeg/core, and they have the same issue.
ComingAlive has created this with nextjs https://github.com/comingAlive/ffmpegaudioextract.vercel.app
And it seems to work fine with defining the corepath. But he seems to be using nextjs 10 and an older version of webpack.
So I'm not too sure what the issue here is. Maybe something changed in nextjs 13 that's affecting this.
To Reproduce
Steps to reproduce the behavior:
Create next app
Create createFFmpeg
Define corepath
Screenshots
Logs from Vercel without corepath and with corepath.

Desktop (please complete the following information):

Ubuntu 20.04

@Sleepingpirates Vercel is using Node 18, IIRC. Have you tried setting the engine to Node 16? This library is currently not working with Node > 16:
https://github.com/ffmpegwasm/ffmpeg.wasm/issues/409

@Sleepingpirates You might also need to nominally import { getCreateFFmpegCore } from '@ffmpeg/core'; in your function. That fixed it for me with Vercel.

I'm also running into this issue when trying to deploy a serverless function on Vercel. I have my Vercel project settings at Node 16 and was getting the same cannot find module error. When I added @spiceee's recommended import I started getting a different error:
[info] load ffmpeg-core
[info] loading ffmpeg-core
[fferr] Error: ENOENT: no such file or directory, open<EMAIL_ADDRESS>[fferr] failed to asynchronously prepare wasm: RuntimeError: abort(Error: ENOENT: no such file or directory, open '/var/task/node_modules/@ffmpeg/core/dist/ffmpeg-core.wasm'). Build with -s ASSERTIONS=1 for more info.
[fferr] RuntimeError: abort(Error: ENOENT: no such file or directory, open '/var/task/node_modules/@ffmpeg/core/dist/ffmpeg-core.wasm'). Build with -s ASSERTIONS=1 for more info.
2023-02-06T06:22:36.484Z	0149a55d-8026-4788-ba9f-cade5c1f7653	ERROR	RuntimeError: abort(Error: ENOENT: no such file or directory, open '/var/task/node_modules/@ffmpeg/core/dist/ffmpeg-core.wasm'). Build with -s ASSERTIONS=1 for more info.
    at u (/var/task/node_modules/@ffmpeg/core/dist/ffmpeg-core.js:25:109)
    at lb (/var/task/node_modules/@ffmpeg/core/dist/ffmpeg-core.js:26:136)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
2023-02-06T06:22:36.484Z	0149a55d-8026-4788-ba9f-cade5c1f7653	ERROR	RuntimeError: abort(Error: ENOENT: no such file or directory, open '/var/task/node_modules/@ffmpeg/core/dist/ffmpeg-core.wasm'). Build with -s ASSERTIONS=1 for more info.
    at u (/var/task/node_modules/@ffmpeg/core/dist/ffmpeg-core.js:25:109)
    at lb (/var/task/node_modules/@ffmpeg/core/dist/ffmpeg-core.js:26:136)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
RequestId: 0149a55d-8026-4788-ba9f-cade5c1f7653 Error: Runtime exited with error: exit status 1
Runtime.ExitError```

Any workarounds?

I got the same error on both vercel and slightly different on heroku
2023-03-09T11:44:14.772388+00:00 app[web.1]: { in: 19696 }
2023-03-09T11:44:14.773177+00:00 app[web.1]: [info] use ffmpeg.wasm v0.11.6
2023-03-09T11:44:14.773499+00:00 app[web.1]: [info] load ffmpeg-core
2023-03-09T11:44:14.773747+00:00 app[web.1]: [info] loading ffmpeg-core
2023-03-09T11:44:14.809408+00:00 app[web.1]: Error with OpenAI API request: Failed to parse URL from<EMAIL_ADDRESS>

I got same error in my next13 project, but works will in another gatsby project.

check :
https://github.com/ffmpegwasm/ffmpeg.wasm/tree/main/apps/nextjs-app/app


Issues in the List of extensions

The list of extensions: https://camel.apache.org/camel-quarkus/latest/list-of-camel-quarkus-extensions.html

Some entries have bad Since version. The plugin should not assume 0.2 as a default. I think it should rather fail if <firstVersion> is not set for the given extension.
The description of camel-quarkus-attachments and camel-quarkus-core-xml Maven plugins configuration is apparently inherited from the build parent. The plugin should not use the inherited value and I think it should rather fail if the description is not there in the runtime module.
Not sure how the extensions are are assigned to the Misc. category, but at least opentracing, MP health and Platform HTTP seem to rather belong to Camel components category.

Fixing this should be coordinated with whoever works on the potentially conflicting #336

Plz. assign to me.

Misc category are correct, this should be for extensions that are NOT a

regular Camel component
regular Camel data format
regular Camel language

In other words, all the other / misc stuff


Move pyproject build-system to poetry-core to support editable installs

Update pyproject.toml's build-system to point to poetry-core. Poetry changed to using a separate (smaller, I think) build backend and suggest changing over to it in the docs. I think this also allows installing the package in editable mode with pip.

 Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.You have signed the CLA already but the status is still pending? Let us recheck it.


filtering security center alerts or recommendations from log analytics workspace

Security center export of alerts/recommendations to log analytics workspace includes multiple resource types (VMs, storage, networking, etc.).
ASC automation schema includes AssessedResourceId for SecurityRecommendation table and ResourceId for  SecurityAlert table.
However, there is no field for resource type.
This makes it difficult to write LA queries for a severity AND a specific resource type (storage only!).
What is the best way to filter on these resource types so that alerts can be created only for selected resource types?
Is there any example/sample log analytics query that shows this?

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ID: efaf8e6d-7f77-33b4-04ea-e692fa377bfc
Version Independent ID: 26885d0b-3696-ef26-8959-87b09db7c58a
Content: Export Azure Security Center alerts and recommendations to SIEMs
Content Source: articles/security-center/continuous-export.md
Service: security-center
GitHub Login: @memildin
Microsoft Alias: memildin

@Mahesh-MSFT
Thanks for your feedback! We will investigate and update as appropriate.

@Mahesh-MSFT
I was able to reach out to our Log Analytics experts and will post their response below.
Log Analytics Team:
Resource type is part of resource ids, so you could query on ResourceId contains "microsoft.compute/virtualmachines" (or use has if you can?) to filter on just virtual machines, etc.
If you have any other questions, please let me know.
Thank you for your time and patience throughout this issue.


Invalid hash code when using EfficientNet

I am currently on step 3.2 of 06. PyTorch Transfer Learning. When I try to run this code on a Colab notebook:
weights = torchvision.models.EfficientNet_B0_Weights.DEFAULT # .DEFAULT = best available weights
model = torchvision.models.efficientnet_b0(weights=weights).to(device)

I keep getting the following error:
RuntimeError: invalid hash value (expected "3dd342df", got "7f5810bc96def8f7552d5b7e68d53c4786f81167d28291b21c0d90e1fca14934")

Both the expected and got hash values stay the same if I run the code again.
My torch version is 2.1.0+cu118 and torchvision is 0.16.0+cu118

Hi @jdrp ,
Looks like a few people are getting this issue with the latest version of torchvision.
You can find a solution here: https://github.com/mrdbourke/pytorch-deep-learning/discussions/693#discussioncomment-7354189
In short,
This should help fix it:
Overriding torchvision.models._api.WeightsEnum.get_state_dict() should do the trick, LMK if it doesn't work
from torchvision.models import efficientnet_b0, EfficientNet_B0_Weights
from torchvision.models._api import WeightsEnum
from torch.hub import load_state_dict_from_url

def get_state_dict(self, *args, **kwargs):
    kwargs.pop("check_hash")
    return load_state_dict_from_url(self.url, *args, **kwargs)
WeightsEnum.get_state_dict = get_state_dict

efficientnet_b0(weights=EfficientNet_B0_Weights.IMAGENET1K_V1)
efficientnet_b0(weights="DEFAULT")

Source: https://github.com/pytorch/vision/issues/7744#issuecomment-1757321451

That worked, thanks for the quick help!

that worked thank you !!


updated ./gallery/ directory

Added a rabbit photo to the ./gallery/ directory.

@bkayranci please check. Thankyou .


Error when building with Carthage

When building DBNetworkStack with Carthage I get the following errors.
Done linting! Found 0 violations, 0 serious in 41 files.
swiftlint(8910,0x7000075e5000) malloc: *** error for object 0x7000075e2150: Non-aligned pointer being freed (2)
*** set a breakpoint in malloc_error_break to debug
/Users/dennis/Library/Caches/org.carthage.CarthageKit/DerivedData/9.4_9Q1019a/DBNetworkStack/1.1/Build/Intermediates.noindex/ArchiveIntermediates/DBNetworkStack/IntermediateBuildFilesPath/DBNetworkStack.build/Release-iphoneos/DBNetworkStack.build/Script-C60F0D0D1D9A76B90028C417.sh: line 6:  8910 Abort trap: 6           swiftlint
Command /bin/sh failed with exit code 134

** ARCHIVE FAILED **

The following build commands failed:
	PhaseScriptExecution 🚧\ Swift\ Lint /Users/dennis/Library/Caches/org.carthage.CarthageKit/DerivedData/9.4_9Q1019a/DBNetworkStack/1.1/Build/Intermediates.noindex/ArchiveIntermediates/DBNetworkStack/IntermediateBuildFilesPath/DBNetworkStack.build/Release-iphoneos/DBNetworkStack.build/Script-C60F0D0D1D9A76B90028C417.sh
(1 failure)

My current solution is to remove the SwiftLint build phase.

Quick fix for this is to disable swiftlint I guess.
In the long term it would be great do disable lining during dependency manager builds like Carthage completely and only enable it inside DBNetworkStack.

Upgrade swiftlint to version 0.25.1 seems to solve this bug 🤷🏼♂


r-value needs to be squared

https://github.com/quantopian/qrisk/blob/master/qrisk/stats.py#L638
linregress returns the r-value or correlation coefficient.
The docstring for stability_of_timeseries says it returns the r-squared as the stability score, but currently it doesn't look like it is being squared.

https://github.com/quantopian/qrisk/blob/travis/qrisk/stats.py#L648


feat(chromium): add ability to export images

Hi, this PR implements https://github.com/gotenberg/gotenberg/issues/110
First time using go, hope the code is clear enough, didn't add any test though
How

Based on a format parameter:

pdf: default if not specified
img: exports a png if quality parameter is 100 (default), otherwise a jpeg

Example
curl --request POST 'http://localhost:3000/forms/chromium/convert/url' \
--form 'url="https://www.google.com"' --form 'landscape="true"' --form 'marginTop="1"' \
--form 'marginBottom="1"' --form 'format="img"' -o my.png

Thank you for the work on gotenberg !

Hello @andreamouraud,
Thanks for this well written PR. I do not have much time to work on Gotenberg with a young kid at home, so no ETA on a review 😅.

Gotenberg is really amazing and solves so many problems for us. Only this feature is missing to make it perfect for us. Thanks for that!

Hi @gulien, any update on this?
I'm willing to provide further help if needed !

Hello @andreamouraud,
Sorry for the delay; it's still on my TODO list, but no ETA yet. In the mean time, I strongly suggest creating your own Docker image, using the template-repository (see for instance https://github.com/Vrex123/gotenberg-ghostscript) or else.

@gulien is there anything preventing this PR from being merged? Or is there something I can do to help move this along since it would be great to have this feature in the main branch

👋 sorry for the delay, but I'm currently working on this feature for the release of Gotenberg 8.

End of the year or january, depending on my available free time.

Closing this in favor of #765.


[Feature][UI] Provide a warning or error if Blob format field does not match expected value.

Motivation: Why do you think this is important?
It can be confusing when attempting to provide a value for a Blob input and being unsure what format is expected. There is no clear help for the user in Console, and the only recourse would be to look at the code for the selected workflow version and find the Task/Workflow input definition to check the format type.
Additionally, if you specify a format value that does not match the one in the input definition, you will receive an error when attempting to launch.
Goal: What should the final outcome look like, ideally?

If the format field is set in a Blob input definition, I should have a hint in the UI telling me what format is expected.
The value of the format field can/should be pre-filled with the value taken from the workflow/task definition and/or the launch plan.
If I attempt to specify a format type that does not match the expected value, I get a client-side warning or error.

Describe alternatives you've considered
N/A
Flyte component

[ ] Overall
[ ] Flyte Setup and Installation scripts
[ ] Flyte Documentation
[ ] Flyte communication (slack/email etc)
[ ] FlytePropeller
[ ] FlyteIDL (Flyte specification language)
[ ] Flytekit (Python SDK)
[ ] FlyteAdmin (Control Plane service)
[ ] FlytePlugins
[ ] DataCatalog
[ ] FlyteStdlib (common libraries)
[x] FlyteConsole (UI)
[ ] Other

[Optional] Propose: Link/Inline

Decorate either the placeholder text or helper text for a blob input with the format value taken from the input definition. This serves as a hint to the user of the expected format of the data stored at the given uri
Read the format value from the workflow/task/launch plan and pre-fill the format field.
If the user chooses not to provide a value for format, but one exists in the spec, copy that value over when constructing the inputs for the launch request.
Either:

When validating inputs on the client side, generate an error if the format field does not match the type specified in the input definition
Add functionality to generate a validation warning client side if the value doesn't match the expected value. This would differ from our existing functionality in that it would not wait for first submission to begin showing the warning. It would use the same debouncing logic (don't validate until no input has been received for some time) and then immediately set the field to a warning and revalidate on new user input.

I think we should set the format field and dimensionality and probably make them immutable
The input form should set the "type" and "meta type" information for the form. For example set the format in the case of Blob or Multipart-blob, set the schema columns to be what are expected.


Restrict search to certain namespace

The old mappings viewer allowed to search in specific namespaces (Spigot, Mojang, Obfuscated, ...) while the new viewer doesn't allow this. It'd be nice if the filter could get added to the new version, too.

Currently you can search in specific namespace by writing ns:<namespace> (eg. ns:spigot) before the searched term.

I plan to add a visual guide to the site that explains that and/or add it to the planned documentation (#9).

After more consideration, a namespace-choice component is more favourable for site users (multi-select, you'll still be able to search within all namespaces). This will be added to the site before the initial release and NMSMapper deprecation.


Add UUID json format

This PR adds an instance of JsonFormat[UUID] as requested in https://github.com/spray/spray-json/issues/243.
I'm not sure as to where to place this object, currently BasicFormats is my best guess, but feel free to request any changes.
Closes https://github.com/spray/spray-json/issues/243

UUID.fromString behaves differently on different version of Java and allows illegal (or non standard) string values...
Please consider to pick more efficient and stable implementation, like here or here

@plokhotnyuk Thanks for pointing that out. I guess including fast-uuid as an external dependency is not a good option. Would it be appropriate (e.g. from the legal perspective) to borrow the implementation from jsoniter-scala?

@atararaksin 1st one (from fast-uuid) is for sequences of characters.
While 2nd one (from jsoniter-scala) is for array of bytes - feel free to reuse if you will find something suitable there.

This addition should make sure that uuid's follow RFC4122, have a look at https://github.com/akka/akka-http/pull/2569 and https://github.com/akka/akka-http/pull/2596 for inspiration.

@Philippus IMHO validation of the hexadecimal representation with dashes is enough... and limiting of allowed Msb bits will broke backward compatibility with NCS and custom (or future) extensions.
Also,  using of regexp for that can be revised for more efficient implementation