Машинное обучение в трейдинге: теория, модели, практика и алготорговля - страница 2965

 
Rashid Umarov #:
Первая же ссылка в поиске даёт результат https://docs.h2o.ai/h2o/latest-stable/h2o-docs/productionizing.html

Спасибо я пробовал этот пакет, безуспешно. Только одна модель GBM конвертируется. Не годится.

 
Vladimir Perervenko #:

Спасибо я пробовал этот пакет, безуспешно. Только одна модель GBM конвертируется. Не годится.

Не вникал, но там написано

Converting MOJOs to ONNX format

To convert a H2O MOJO into the ONNX format, use the onnxmltools python package. Currently, only a subset of H2O MOJOs can be converted to the ONNX format:

  • supported algorithms: GBM

  • supports multinomial distribution with 3 or more classes (use binomial otherwise)

  • does not support poisson, gamma, or tweedie distributions

  • does not support models with categorical splits

For examples and further documentation, check the onnxmltools project on github.


 
Vladimir Perervenko #:

Спасибо я пробовал этот пакет, безуспешно. Только одна модель GBM конвертируется. Не годится.

https://github.com/PINTO0309/json2onnx не пробовали?
GitHub - PINTO0309/json2onnx: Converts a JSON file to an ONNX file.
GitHub - PINTO0309/json2onnx: Converts a JSON file to an ONNX file.
  • PINTO0309
  • github.com
Converts a JSON file to an ONNX file. Click here for onnx2json . 1. Setup 1-1. HostPC 1-2. Docker 2. CLI Usage 3. In-script Usage
 
Rorschach #:
https://github.com/PINTO0309/json2onnx не пробовали?

Спасибо, видел. Он входит в большой пакет simple-onnx-processing-tools(v1.1.16). Я не настолько хорошо знаю Питон, поэтому не смог въехать. Судя по всему это отдельная и не очень простая тема. Нужно время.

simple-onnx-processing-tools
  • 2023.03.15
  • pypi.org
A set of simple tools for splitting, merging, OP deletion, size compression, rewriting attributes and constants, OP generation, change opset, change to the specified input order, addition of OP, RGB to BGR conversion, change batch size, batch rename of OP, and JSON convertion for ONNX models.
 
Vladimir Perervenko #:

Спасибо, видел. Он входит в большой пакет simple-onnx-processing-tools(v1.1.16). Я не настолько хорошо знаю Питон, поэтому не смог въехать. Судя по всему это отдельная и не очень простая тема. Нужно время.

Еще попадались такие варианты:

https://www.programmersought.com/article/33959514933/

https://github.com/onnx/onnx/issues/2456

 
Vladimir Perervenko #:

Спасибо, видел. Он входит в большой пакет simple-onnx-processing-tools(v1.1.16). Я не настолько хорошо знаю Питон, поэтому не смог въехать. Судя по всему это отдельная и не очень простая тема. Нужно время.

Правильно понимаю, что в R с конвертацией в ONNX совсем никак? Мои поиски в этом направлении ни к чему не привели.

 

Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий

Разговор с искусственным интеллектом (ИИ) о форексе.

Lilita Bogachkova, 2023.03.16 20:47

Can the ChatGPT generate R code to convert JSON to ONNX?

-

Yes, I can help generate R code to convert JSON to ONNX.

First, you will need to have the required R packages installed, including "jsonlite" and "onnx". You can install these packages using the following commands in R:

install.packages("jsonlite")
install.packages("onnx")

Assuming you have a JSON file with the data you want to convert to ONNX, you can use the following R code to load the JSON data, convert it to a data frame, and then convert it to ONNX:
library(jsonlite)
library(onnx)

# Load the JSON data from file
json_data <- fromJSON("path/to/json/file.json")

# Convert the JSON data to a data frame
df <- as.data.frame(json_data)

# Convert the data frame to ONNX
onnx_model <- convertToONNX(df, "model_name")

# Save the ONNX model to file
saveONNXModel(onnx_model, "path/to/onnx/model.onnx")

In the above code, replace "path/to/json/file.json" with the actual path to your JSON file, "model_name" with the name you want to give your ONNX model, and "path/to/onnx/model.onnx" with the desired path and file name for your ONNX model.

This code assumes that your JSON data is in a format that can be easily converted to a data frame, such as a JSON array of objects. If your JSON data is in a more complex format, you may need to do additional data manipulation before converting it to ONNX.


 
Какая же детская наивность
 
Rorschach #:

Передайте ChatGPT, что функций convertToONNX() и saveONNXModel() нет в пакете onnx) Вот его описаниеChatGPT конечно же извинится и наврёт следующий вариант) Уже проверено.

 
Aleksey Nikolayev #:

Передайте ChatGPT, что функций convertToONNX() и saveONNXModel() нет в пакете onnx) Вот его описаниеChatGPT конечно же извинится и наврёт следующий вариант) Уже проверено.

По идее можно обобщить вопрос или заставить в несколько шагов сделать, но это уже не ко мне, проще в поиске искать.


https://github.com/PINTO0309/json2onnx/blob/main/json2onnx/json2onnx.py

Основной код вроде короткий

# Convert JSON to onnx model
    onnx_str = json.dumps(json_file)
    onnx_graph = Parse(onnx_str, onnx.ModelProto())
Причина обращения: