提交 4331a161 编写于 作者: S Sergei Bocharov

Fixes after review

上级 61709ccb
......@@ -768,8 +768,8 @@ Gets data from [Join](../../operations/table_engines/join.md) tables using the s
Only supports tables created with the `ENGINE = Join(ANY, LEFT, <join_keys>)` statement.
## modelEvaluate(model_name, ...)
Evaluate model.
## modelEvaluate(model_name, ...) {#function-modelevaluate}
Evaluate external model.
Accepts a model name and model arguments. Returns Float64.
## throwIf(x\[, custom_message\])
......
......@@ -4,10 +4,12 @@
To apply a CatBoost model in ClickHouse:
1. [Create a table for the train sample](#create-a-table).
1. [Insert the data to the table](#insert-the-data-to-the-table).
1. [Configure the model](#configure-the-model).
1. [Test the trained model](#test-the-trained-model).
1. [Create a table](#create-table).
2. [Insert the data to the table](#insert-the-data-to-the-table).
3. [Configure the model](#configure-the-model).
4. [Run the model inference from SQL](#run-the-model-inference).
For more information about training CatBoost models, see [Training and applying models](https://catboost.ai/docs/features/training.html#training).
## Before you start {#before-you-start}
......@@ -41,7 +43,7 @@ $ docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhouse
> **Note:** Example running a Jupyter Notebook with this manual materials to [http://localhost:8888](http://localhost:8888).
## 1. Create a table {#create-a-table}
## 1. Create a table {#create-table}
To create a ClickHouse table for the train sample:
......@@ -106,7 +108,7 @@ FROM amazon_train
This step is optional: the Docker container contains all configuration files.
**1.** Create a config file (for example, `config_model.xml`) with the model configuration:
Create a config file (for example, `config_model.xml`) with the model configuration:
```xml
<models>
......@@ -125,22 +127,15 @@ This step is optional: the Docker container contains all configuration files.
> **Note:** To show contents of the config file in the Docker container, run `cat models/amazon_model.xml`.
**2.** Add the following lines to the `/etc/clickhouse-server/config.xml` file:
The ClickHouse config file should already have this setting:
```xml
<catboost_dynamic_library_path>/home/catboost/.data/libcatboostmodel.so</catboost_dynamic_library_path>
<models_config>/home/catboost/models/*_model.xml</models_config>
```
> **Note:** To show contents of the ClickHouse config file in the Docker container, run `cat ../../etc/clickhouse-server/config.xml`.
**3.** Restart ClickHouse server:
```bash
$ sudo service clickhouse-server restart
```
To check it, run `tail ../../etc/clickhouse-server/config.xml`.
## 4. Test the trained model {#test-the-trained-model}
## 4. Run the model inference from SQL {#run-the-model-inference}
For test run the ClickHouse client `$ clickhouse client`.
......@@ -163,7 +158,7 @@ FROM amazon_train
LIMIT 10
```
> **Note:** Function `modelEvaluate` returns tuple with per-class raw predictions for multiclass models.
> **Note:** Function [modelEvaluate](../query_language/functions/other_functions.md#function-modelevaluate) returns tuple with per-class raw predictions for multiclass models.
- Let's predict probability:
......@@ -206,7 +201,4 @@ FROM
ACTION AS tg
FROM amazon_train
)
```
```
\ No newline at end of file
......@@ -2,4 +2,4 @@
Detailed step-by-step instructions that will help you solve various tasks using ClickHouse.
- [Applying a CatBoost model in ClickHouse](apply-catboost-model.md)
\ No newline at end of file
- [Applying a CatBoost model in ClickHouse](apply_catboost_model.md)
\ No newline at end of file
......@@ -4,10 +4,12 @@
Чтобы применить модель CatBoost в ClickHouse:
1. [Создайте таблицу для обучающей выборки](#create-a-table).
1. [Вставьте данные в таблицу](#insert-the-data-to-the-table).
1. [Настройте конфигурацию модели](#configure-the-model).
1. [Протестируйте обученную модель](#test-the-trained-model).
1. [Создайте таблицу](#create-table).
2. [Вставьте данные в таблицу](#insert-the-data-to-the-table).
3. [Настройте конфигурацию модели](#configure-the-model).
4. [Запустите вывод модели из SQL](#run-the-model-inference).
Подробнее об обучении моделей в CatBoost, см. [Обучение и применение моделей](https://catboost.ai/docs/features/training.html#training).
## Подготовка к работе {#before-you-start}
......@@ -41,7 +43,7 @@ $ docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhouse
> **Примечание.** После запуска по адресу [http://localhost:8888](http://localhost:8888) будет доступен Jupyter Notebook с материалами данной инструкции.
## 1. Создайте таблицу {#create-a-table}
## 1. Создайте таблицу {#create-table}
Чтобы создать таблицу в ClickHouse для обучающей выборки:
......@@ -106,7 +108,7 @@ FROM amazon_train
Опциональный шаг: Docker-контейнер содержит все необходимые файлы конфигурации.
**1.** Создайте файл с конфигурацией модели (например, `config_model.xml`):
Создайте файл с конфигурацией модели (например, `config_model.xml`):
```xml
<models>
......@@ -125,22 +127,15 @@ FROM amazon_train
> **Примечание.** Чтобы посмотреть конфигурационный файл в Docker-контейнере, выполните команду `cat models/amazon_model.xml`.
**2.** Добавьте следующие строки в файл `/etc/clickhouse-server/config.xml`:
В конфигурации ClickHouse уже прописан параметр:
```xml
<catboost_dynamic_library_path>/home/catboost/.data/libcatboostmodel.so</catboost_dynamic_library_path>
<models_config>/home/catboost/models/*_model.xml</models_config>
```
> **Примечание.** Чтобы посмотреть конфигурационный файл ClickHouse в Docker-контейнере, выполните команду `cat ../../etc/clickhouse-server/config.xml`.
**3.** Перезапустите ClickHouse-сервер:
Чтобы убедиться в этом, выполните команду `tail ../../etc/clickhouse-server/config.xml`.
```bash
$ sudo service clickhouse-server restart
```
## 4. Протестируйте обученную модель {#test-the-trained-model}
## 4. Запустите вывод модели из SQL {#run-the-model-inference}
Для тестирования запустите ClickHouse-клиент `$ clickhouse client`.
......@@ -206,5 +201,4 @@ FROM
ACTION AS tg
FROM amazon_train
)
```
```
\ No newline at end of file
......@@ -2,4 +2,4 @@
Подробные пошаговые инструкции, которые помогут вам решать различные задачи с помощью ClickHouse.
- [Применение модели CatBoost в ClickHouse](apply-catboost-model.md)
\ No newline at end of file
- [Применение модели CatBoost в ClickHouse](apply_catboost_model.md)
\ No newline at end of file
......@@ -204,9 +204,9 @@ nav:
- 'clickhouse-copier': 'operations/utils/clickhouse-copier.md'
- 'clickhouse-local': 'operations/utils/clickhouse-local.md'
- 'Solution tutorials':
- 'Solution Tutorials':
- 'Overview': 'solutions/index.md'
- 'Applying a CatBoost model in ClickHouse': 'solutions/apply-catboost-model.md'
- 'Applying CatBoost Models': 'solutions/apply_catboost_model.md'
- 'Development':
- 'hidden': 'development/index.md'
......
......@@ -205,7 +205,7 @@ nav:
- 'Сценарии использования':
- 'Обзор': 'solutions/index.md'
- 'Применение модели CatBoost в ClickHouse': 'solutions/apply-catboost-model.md'
- 'Применение CatBoost моделей': 'solutions/apply_catboost_model.md'
- 'F.A.Q.':
- 'Общие вопросы': 'faq/general.md'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册