max and min scan x partition y

19 May 2014 | , , ,
Share on:

maximum scan readout

I’m joining idioms 2 and 3 here as it’s important to see the pattern.

q)x:1 1 0 0 0 1 0 0 1 1
q)y:3 4 8 2 5 6 9 4 5 4
q)maxs each(where x)_y
,3
4 8 8 8
6 9 9
,5
,4
q)raze maxs each(where x)_y
3 4 8 8 8 6 9 9 5 4
q)max each(where x)_y
3 8 9 5 4
q)mins each(where x)_y
,3
4 4 2 2
6 6 4
,5
,4
q)raze mins each(where x)_y
3 4 4 2 2 6 6 4 5 4
q)raze min each(where x)_y
3 2 4 5 4
q)min each(where x)_y
3 2 4 5 4
q)

and when working with tables you’d do something like:

q)t:([]x;y)
q)t
x y
---
1 3
1 4
0 8
0 2
0 5
1 6
0 9
0 4
1 5
1 4
q)select mins y by sums x from t
x| y
-| -------
1| ,3
2| 4 4 2 2
3| 6 6 4
4| ,5
5| ,4
q)select min y by sums x from t
x| y
-| -
1| 3
2| 2
3| 4
4| 5
5| 4
q)value exec min y by sums x from t
3 2 4 5 4
q)value exec mins y by sums x from t
,3
4 4 2 2
6 6 4
,5
,4
q)raze value exec mins y by sums x from t
3 4 4 2 2 6 6 4 5 4
q)

SUGGESTED ARTICLES

Kx Insights: Machine learning subject matter experts in semiconductor manufacturing

9 Jul 2018 | , ,

Subject matter experts are needed for ML projects since generalist data scientists cannot be expected to be fully conversant with the context, details, and specifics of problems across all industries. The challenges are often domain-specific and require considerable industry background to fully contextualize and address. For that reason, successful projects are typically those that adopt a teamwork approach bringing together the strengths of data scientists and subject matter experts. Where data scientists bring generic analytics and coding capabilities, Subject matter experts provide specialized insights in three crucial areas: identifying the right problem, using the right data, and getting the right answers.

Transitive Comparison

Kdb+ Transitive Comparisons

6 Jun 2018 | , ,

By Hugh Hyndman, Director, Industrial IoT Solutions. A direct comparison of the performance of kdb+ against InfluxData and, by transitivity, against Cassandra, ElasticSearch, MongoDB, and OpenTSDB