Skip to content

Commit

Permalink
Fix: model training intermittent test failure.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Oct 24, 2024
1 parent abc7163 commit 078608f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 13 deletions.
6 changes: 5 additions & 1 deletion spec/namespaces/knn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,11 @@ components:
required: true
responses:
knn.delete_model@200: {}
knn.get_model@200: {}
knn.get_model@200:
content:
application/json:
schema:
type: object
knn.search_models@200: {}
knn.stats@200: {}
knn.train_model@200:
Expand Down
41 changes: 29 additions & 12 deletions tests/default/knn/train_model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ prologues:
knn: true
mappings:
properties:
recommendation_vector:
vector:
type: knn_vector
dimension: 8
status: [200]
Expand All @@ -23,23 +23,26 @@ prologues:
content_type: application/x-ndjson
payload:
- {index: {_index: movies, _id: '1'}}
- {recommendation_vector: [1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5], duration: 12.2}
- {vector: [1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5], duration: 12.2}
- {index: {_index: movies, _id: '2'}}
- {recommendation_vector: [2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5], duration: 7.1}
- {vector: [2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5], duration: 7.1}
- {index: {_index: movies, _id: '3'}}
- {recommendation_vector: [3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5], duration: 12.9}
- {vector: [3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5], duration: 12.9}
- {index: {_index: movies, _id: '4'}}
- {recommendation_vector: [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5], duration: 1.2}
- {vector: [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5], duration: 1.2}
- {index: {_index: movies, _id: '5'}}
- {recommendation_vector: [5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5], duration: 3.7}
- {vector: [5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5], duration: 3.7}
- {index: {_index: movies, _id: '6'}}
- {recommendation_vector: [6.5, 6.5, 6.5, 6.5, 6.5, 6.5, 6.5, 6.5], duration: 10.3}
- {vector: [6.5, 6.5, 6.5, 6.5, 6.5, 6.5, 6.5, 6.5], duration: 10.3}
- {index: {_index: movies, _id: '7'}}
- {recommendation_vector: [7.5, 7.5, 7.5, 7.5, 7.5, 7.5, 7.5, 7.5], duration: 5.5}
- {vector: [7.5, 7.5, 7.5, 7.5, 7.5, 7.5, 7.5, 7.5], duration: 5.5}
- {index: {_index: movies, _id: '8'}}
- {recommendation_vector: [8.5, 8.5, 8.5, 8.5, 8.5, 8.5, 8.5, 8.5], duration: 4.4}
- {vector: [8.5, 8.5, 8.5, 8.5, 8.5, 8.5, 8.5, 8.5], duration: 4.4}
- {index: {_index: movies, _id: '9'}}
- {recommendation_vector: [9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5], duration: 8.9}
- {vector: [9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5], duration: 8.9}
status: [200]
- method: POST
path: /_refresh
status: [200]
epilogues:
- path: /movies
Expand All @@ -59,7 +62,7 @@ chapters:
request:
payload:
training_index: movies
training_field: recommendation_vector
training_field: vector
dimension: 8
max_training_vector_count: 1200
search_size: 100
Expand All @@ -70,4 +73,18 @@ chapters:
response:
status: 200
output:
test_model_id: payload.model_id
test_model_id: payload.model_id
- synopsis: Wait for the model to get trained.
warnings:
multiple-paths-detected: false
method: GET
path: /_plugins/_knn/models/{model_id}
parameters:
model_id: ${train_model.test_model_id}
retry:
count: 3
response:
status: 200
payload:
model_id: ${train_model.test_model_id}
state: created

0 comments on commit 078608f

Please sign in to comment.