Forum Replies Created

Page 6 of 14
  • megan_mcp

    Administrator
    June 14, 2024 at 8:40 am in reply to: Error Loading and Continue KX Academy

    Hi @biman

    I am sorry to hear you are experiencing issues with our academy.

    Can you try accessing the academy in incognito mode ?

    If you are trying to access the KX Sandbox through the academy, you can do this by going directly to “edu.kx.com”.

    If this issue still persists, please let me know and we will investigate it further.

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 11, 2024 at 1:15 pm in reply to: What is the need of a flip of splay or partitioned table ?

    Hi @newstudent2017

    This operation is used internally by kdb+ to represent the flip of a memory-mapped splayed table. When loading a database with \l, the tables in the database are added to the root namespace using this operation.

    x!y ![x;y]

    The result must be flipped in order to use it as a table. After doing that, select statements will operate on the on-disk table. Many operations (including certain overloads of select) will throw a par error when used on this table.

    Examples:

    q):db/t/ set ([]a:1 2)<br>:db/t/
    q)\l db
    q).Q.s1 t
    "+(,a)!:./t/"

    It is possible to manually create this representation:

    q)enlist[a]!:./t/
    (,a)!:./t/
    q)flip enlist[a]!:./t/
    a
    -
    1
    2

    The equivalent for a partitioned table:

    q):db/2001.01.01/t/ set ([]a:1 2)<br>:db/2001.01.01/t/
    q):db/2001.01.02/t/ set ([]a:3 4)<br>:db/2001.01.02/t/
    q)\l db
    q).Q.s1 t
    "+(,a)!t"
    q)enlist[a]!t
    (,a)!t
    q)flip enlist[a]!t
    date a
    ------------
    2001.01.01 1
    2001.01.01 2
    2001.01.02 3
    2001.01.02 4

    If the specified table does not exist on disk, the expression remains unresolved and any attempt to select from it fails:

    q)flip enlist[a]!:./s/
    +(,a)!:./s/
    q)select from flip enlist[a]!:./s/
    './s/a. OS reports: No such file or directory
    [0] select from flip enlist[a]!:./s/
    q)flip enlist[a]!s
    +(,a)!s
    q)select from flip enlist[a]!s
    's
    [0] select from flip enlist[a]!s
    ^

    We are adjusting our documentation to make this clearer in future.

    If you have any further questions, please let me know!

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 11, 2024 at 11:17 am in reply to: PyKx transaction cost analysis

    Hi @baichen111

    Thank you for reporting this. We will investigate this further and adjust it accordingly.

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 11, 2024 at 11:16 am in reply to: question help

    Hi @miaaaal

    Apologies for the late response.

    You have defined your .z.pw function correctly, but you now must apply this to .perm.users to give them access.

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 11, 2024 at 11:08 am in reply to: .z.pd function throwing error for non unique handles

    Hi @user931206

    Is it possible you could send a screenshot of the code rather than pasting it in the editor?

    Apologies as this is a problem on our end, not yours.

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 11, 2024 at 10:56 am in reply to: Can someone clarify implicit composition here ?

    Hi @newstudent2017

    In the documentation it states the derived function ‘[f;ff] has the rank of ff and returns f ff[x;y;z]

    If we use the following examples:

    q)ff:{[w;x;y;z]w+x+y+z}

    q)ff[1;2;3;4]

    10

    If the syntax returns f ff[x;y;z] then essentially the result for ff[w;x;y;z] is our x parameter for f.

    We know that ff[1;2;3;4] = 10

    q)f:{2*x}

    q)f[10]

    20

    We use composition to combine these steps together:

    q)'[f;ff][1;2;3;4]

    20

    If you have any questions about this, please let me know!

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 7, 2024 at 10:18 am in reply to: Advanced Capstone 2.4

    Hi @moshe-hamaoui

    Your error message seems to be correct.

    Can you send me your full .f1.checkSensor function in normal text (without the code tag)?

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 5, 2024 at 11:27 am in reply to: Fast file reading

    Hi @roryk

    If the content of the file contains spaces, 0: only loads a subset of the data.

    It could also just be the read vs mmap performance.

    Hope this helps.

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 3, 2024 at 11:39 am in reply to: Test Case Help

    Hi @Treese_H85

    Apologies for the delay in response.

    Can you make sure you are not running this cell after defining .z.pg, as this reverts it on the server process.

    Let me know if this works !

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 3, 2024 at 11:29 am in reply to: Sandbox Button Doesn’t Exist

    Hi @KDDevLearning

    Just so that I understand correctly, you missing the following button in your lessons?

    Thanks,

    Megan

  • megan_mcp

    Administrator
    May 23, 2024 at 5:12 pm in reply to: Advanced capstone 3.5 Help

    Hi @nihS

    When the question states “Define a function on our local process” – this is the process you saved to hdbH.

    Try defining the function on this process instead.

    Thanks,

    Megan

  • megan_mcp

    Administrator
    May 20, 2024 at 4:38 pm in reply to: Get the cosine similarity scores along with the retrieved docs

    Hi @Sosycs

    As an example I’ve used snippets from our Document Search sample (screenshot below):

    Simply change the metric to: “metric” : “CS”.

    To see the distance print the results of the similarity search (the distance will be in a column in the result called “__nn_distance”:

    print(table.search(query_vector, n=3))

    Also take a look at our documentation on cosine similarity for extra help – KDB.AI Similarity Metrics – Documentation (kx.com)

    Hope this helps!

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 10, 2024 at 1:47 pm in reply to: Advanced Capstone 2.4

    Hi @moshe-hamaoui

    I have sourced the issue and apologies that it is so minor.

    When I tested your code, I was receiving the error you had mentioned above however when I replaced the message with one that is provided in the project file, the test case passed.

    I believe it was the format of the hyphen that caused this issue.

    As you can see in screenshot_1 (provided below) the hyphen used in your code is slightly thinner than the hyphen used in the message provided (screenshot_2).

    The test case must have picked up as a different character, hence why the test case failed.

    If you have any further questions please let me know.

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 7, 2024 at 12:10 pm in reply to: Fast file reading

    @roryk

    I can follow up on this further if you would like to know why read0 doesn’t use memchr (&/ mmap)?

  • megan_mcp

    Administrator
    June 7, 2024 at 12:00 pm in reply to: Fast file reading

    Hi @roryk

    I reached out to one of our developers on this and this was their response:

    “Actually looks like read0 is using a load of memcmp calls & scanning for \n
    where 0: is using memchr to find it in a single call:

    q)\ts:1 (1#"*";"-")0:`:testf 
    221 36800   
    seconds  usecs/call     calls      function 
    -------- ----------- --------- -------------------- 
    0.095358          95      1003 memchr 
    0.060194         106       564 memmove  
    240799   0.000319 memchr("qwertyuiopasdfghjklzxcvbnm\nqwert"..., '\n', 13311)                              
    = 0x7fa1eaf3d0d7 
    240799   0.005258 memchr("qwertyuiopasdfghjklzxcvbnm\nqwert"..., '-', 26)                                  
    = 0 
    240799   0.005147 memmove(0x7fa1e6b121d0, "qwertyuiopasdfghjklzxcvbnm", 26)                                
    = 0x7fa1e6b121d0
    
    q) \ts:1 read0 `:testf
    2161 52624
    seconds usecs/call calls function
    -------- ----------- --------- --------------------
    1.332051 98 13505 memcmp
    
    0.102397 97 1046 memmove
    
    240799 0.000144 memcmp(0x4bf876, 0x7fa1e6b7f410, 1, 113) = 0xffffff93
    
    240799 0.000152 memcmp(0x4bf876, 0x7fa1e6b7f411, 1, 119) = 0xffffffa5
    
    240799 0.000172 memcmp(0x4bf876, 0x7fa1e6b7f412, 1, 101) = 0xffffff98
    
    240799 0.000160 memcmp(0x4bf876, 0x7fa1e6b7f413, 1, 114) = 0xffffff96
    
    240799 0.000144 memcmp(0x4bf876, 0x7fa1e6b7f414, 1, 116) = 0xffffff91
    
    240799 0.000144 memcmp(0x4bf876, 0x7fa1e6b7f415, 1, 121) = 0xffffff95
    
    240799 0.000144 memcmp(0x4bf876, 0x7fa1e6b7f416, 1, 117) = 0xffffffa1
    
    240799 0.000154 memcmp(0x4bf876, 0x7fa1e6b7f417, 1, 105) = 0xffffff9b
    
    240799 0.000162 memcmp(0x4bf876, 0x7fa1e6b7f418, 1, 111) = 0xffffff9a
    
    240799 0.000236 memcmp(0x4bf876, 0x7fa1e6b7f419, 1, 112) = 0xffffffa9
    
    240799 0.000150 memcmp(0x4bf876, 0x7fa1e6b7f41a, 1, 97) = 0xffffff97
    
    240799 0.000149 memcmp(0x4bf876, 0x7fa1e6b7f41b, 1, 115) = 0xffffffa6
    
    240799 0.000149 memcmp(0x4bf876, 0x7fa1e6b7f41c, 1, 100) = 0xffffffa4
    
    240799 0.000222 memcmp(0x4bf876, 0x7fa1e6b7f41d, 1, 102) = 0xffffffa3
    
    240799 0.000175 memcmp(0x4bf876, 0x7fa1e6b7f41e, 1, 103) = 0xffffffa2
    
    240799 0.000313 memcmp(0x4bf876, 0x7fa1e6b7f41f, 1, 104) = 0xffffffa0
    
    240799 0.000311 memcmp(0x4bf876, 0x7fa1e6b7f420, 1, 106) = 0xffffff9f
    
    240799 0.000312 memcmp(0x4bf876, 0x7fa1e6b7f421, 1, 107) = 0xffffff9e
    
    240799 0.000239 memcmp(0x4bf876, 0x7fa1e6b7f422, 1, 108) = 0xffffff90
    
    240799 0.000149 memcmp(0x4bf876, 0x7fa1e6b7f423, 1, 122) = 0xffffff92
    
    240799 0.000148 memcmp(0x4bf876, 0x7fa1e6b7f424, 1, 120) = 0xffffffa7
    
    240799 0.000218 memcmp(0x4bf876, 0x7fa1e6b7f425, 1, 99) = 0xffffff94
    
    240799 0.000156 memcmp(0x4bf876, 0x7fa1e6b7f426, 1, 118) = 0xffffffa8
    
    240799 0.000148 memcmp(0x4bf876, 0x7fa1e6b7f427, 1, 98) = 0xffffff9c
    
    240799 0.000208 memcmp(0x4bf876, 0x7fa1e6b7f428, 1, 110) = 0xffffff9d
    
    240799 0.000326 memcmp(0x4bf876, 0x7fa1e6b7f429, 1, 109) = 0
    
    240799 0.000270 memmove(0x7fa1e6b121d0, "qwertyuiopasdfghjklzxcvbnm", 26) = 0x7fa1e6b121d0
    
    240799 0.000174 memmove(0x7fa1e6b75f78, "\300!\261\346\241\177\0\0", 8) = 0x7fa1e6b75f78
Page 6 of 14