text
stringlengths
1.46k
56.1k
.ml.mm:.qml.mm .ml.mmt:.qml.mmx[`rflip] .ml.mtm:.qml.mmx[`lflip] .ml.minv:.qml.minv .ml.mlsq:{.qml.mlsqx[`flip;y;x]} .ml.dot:.qml.dot .ml.mdet:.qml.mdet .ml.mchol:.qml.mchol .fmincg.dot:.qml.dot ================================================================================ FILE: funq_randomforest.q SIZE: 1,085 char...
Implementing trend indicators in kdb+¶ The compactness of kdb+ and the terseness of q focus code on a small number of high-performing native built-in functions rather than extensive libraries. kdb+ users often develop libraries of their own domain-specific algorithms and functions, for convenience and to support reuse....
Working with MATLAB¶ Installation¶ Versions As MATLAB/datafeed toolbox evolves features or instruction below are subject to revisions. Please refer to toolbox documentation for latest version. Users have reported that this works with more recent versions (e.g. R2015b on RHEL 6.8/2016b and 2017a on macOS). See also comm...
Frequently-asked questions from the k4 listbox¶ If you notice a question that is asked more then once on the k4 list, please feel free to add it here. Where can I find archives of the k4 list?¶ Archives are available to subscribers at the Topicbox. When you follow that link, you will be asked for your e-mail address an...
Geospatial indexing¶ This demo shows the basics of geospatial indexing with q. A 1-million-point random data set is queried from the HTML map client. Click on the map to see nearby points. Download KxSystems/kdb/e/geo.zip and run: $ make -C s2 $ q q/geo.q $ open html/geo.html This should then open a browser, connect to...
Reference architecture for Azure¶ Lift and shift your kdb+ plants to the cloud and leverage virtual machines (VM) with storage kdb Insights provides a range of tools to build, manage and deploy kdb+ applications in the cloud. kdb Insights supports: - interfaces for deployment and common ‘Devops’ orchestration tools suc...
kdb+ and FIX messaging¶ Electronic trading volumes have increased significantly in recent years, prompting financial institutions, both buy and sell side, to invest in increasingly sophisticated Order Management Systems (OMS). OMSs efficiently manage the execution of orders using a set of pre-defined conditions to obta...
if[not[app.describeOnly] and not app.passOnly; / Only want to print this when running to see results .tst.callbacks.expecRan:{[s;e]; app.expectationsRan+:1; r:e[`result]; if[r ~ `pass; app.expectationsPassed+:1]; if[r in `testFail`fuzzFail; app.expectationsFailed+:1]; if[r like "*Error"; app.expectationsErro...
replay:{[tabs;realsubs;schemalist;logfilelist] // realsubs is a dict of `subtabs`errtabs`instrs // schemalist is a list of (tablename;schema) // logfilelist is a list of (log count; logfile) .lg.o[`subscribe;"replaying the log file(s)"]; // store the orig version of upd origupd:@[value;`..upd;{{[x;y]}}]; ...
Dictionary programs¶ From GeeksforGeeks Python Programming Examples Follow links to the originals for more details on the problem and Python solutions. Sort dictionary by keys or values¶ Sort keys ascending¶ >>> kv = {2:'56', 1:'2', 5:'12', 4:'24', 6:'18', 3:'323'} >>> sorted(kv.keys()) [1, 2, 3, 4, 5, 6] q)kv:2 1 4 5 ...
// @kind function // @category utility // @desc Retrieve previous generated model from disk // @param config {dictionary} Information about a previous run of AutoML // including the feature extraction procedure used and the best model // produced // @returns {table} Features produced using config feature extracti...
.dotz.set[`.z.pw;p0[`pw;value .dotz.getcommand[`.z.pw];;]]; .dotz.set[`.z.po;p1[`po;value .dotz.getcommand[`.z.po];]]; .dotz.set[`.z.pc;p1[`pc;value .dotz.getcommand[`.z.pc];]]; .dotz.set[`.z.wo;p1[`wo;value .dotz.getcommand[`.z.wo];]]; .dotz.set[`.z.wc;p1[`wc;value .dotz.getcommand[`.z.wc];]]; .dotz.set[`.z.ws;p2...
defeps:(!) . flip ( (L2R_LR;0.01); (L2R_L2LOSS_SVC;0.01); (L2R_L2LOSS_SVR;0.001); (L2R_L2LOSS_SVC_DUAL;0.1); (L2R_L1LOSS_SVC_DUAL;0.1); (MCSVM_CS;0.1); (L2R_LR_DUAL;0.1); (L1R_L2LOSS_SVC;0.01); (L1R_LR;0.01); (L2R_L1LOSS_SVR_DUAL;0.1); (L2R_L2LOSS_SVR_DUAL;0.1)) defparam:{[prob;param] if[0f>=param`eps;para...
Predicting floods with q and machine learning¶ The Frontier Development Lab (FDL) is a public-private partnership run annually with both the European Space Agency (ESA) and National Aeronautics and Space Administration (NASA). The objective of FDL is to bring together researchers from the Artificial Intelligence (AI) a...
SSL/TLS¶ Since V3.4t 2016.05.12, kdb+ can use Secure Sockets Layer (SSL)/Transport Layer Security (TLS) to encrypt connections using the OpenSSL libraries. Configuration¶ OpenSSL library¶ Ensure that your OS has the latest OpenSSL libraries installed, and that they are in your LD_LIBRARY_PATH (Unix), DYLD_LIBRARY_PATH ...
================================================================================ FILE: TorQ-Finance-Starter-Pack_code_processes_metrics.q SIZE: 4,096 characters ================================================================================ / schemas for tables sumstab:([] time:`timestamp$(); sym:`g#`symbol$(); sumss...
Installing kdb+¶ You can run kdb+ on Linux, macOS, or Windows Step 1: Download¶ The 64-bit kdb+ Personal Edition interpreter is licensed for non-commercial use. It is not licensed for use on cloud servers. The provided license-key file (kc.lic ) requires an always-on Internet connection. Commercial versions of kdb+ are...
// Load all utilties if[not @[get;".ml.registry.q.main.utils.init";0b]; loadfile`:registry/q/main/utils/requirements.q; loadfile`:registry/q/main/utils/check.q; loadfile`:registry/q/main/utils/create.q; loadfile`:registry/q/main/utils/copy.q; loadfile`:registry/q/main/utils/delete.q; loadfile`:registry/q/ma...
// Server connection details \d .servers CONNECTIONS:() // sortworker doesn't need to connect to other processes STARTUP:1b // create connections ================================================================================ FILE: TorQ_config_settings_tic...
// maintain a dictionary of the db partitions which have been written to by the loader partitions:()!() // maintain a list of files which have been read filesread:() // loader function loaddata:{[loadparams;rawdata] .lg.o[`dataloader;"reading in data chunk"]; // check if we have already read some data from this ...
// @private // @kind function // @category nlpSentUtility // @desc Decrease the weight of valences before "but", and increase // the weight of valences after it // @param tokens {symbol[]} The tokenized sentence // @param valences {number[]} The sentiment of each token // @returns {number[]} The modified valences se...
^ Fill, fills ¶ Replace nulls ^ Fill¶ Replace nulls x^y ^[x;y] Where x and y are conforming lists or dictionaries returns y with any nulls replaced by the corresponding item of x . q)0^1 2 3 0N 1 2 3 0 q)100^1 2 -5 0N 10 0N 1 2 -5 100 10 100 q)1.0^1.2 -4.5 0n 0n 15 1.2 -4.5 1 1 15 q)`nobody^`tom`dick``harry `tom`dick`n...
Exposed infrastructure¶ The k programming language¶ Q is an embedded domain-specific language for time-series analysis, implemented in the proprietary programming language k. As such, q leaves features of k exposed. They should be avoided. The k language has no public documentation and is for use by KX system programme...
/ The environment variables to query proxy information for each URL scheme and the 'bypass' configuration .http.cfg.proxyEnvVars:(`symbol$())!`symbol$(); .http.cfg.proxyEnvVars[`$("http://"; "ws://")]: 2#`HTTP_PROXY; .http.cfg.proxyEnvVars[`$("https://"; "wss://")]: 2#`HTTPS_PROXY; .http.cfg.proxyEnvVars[`bypass]...
// @private // @kind function // @category nlpClusteringUtility // @desc Graph clustering that works on a similarity matrix // @param matrix {boolean[][]} NxN adjacency matrix // @returns {long[][]} Lists of indices in the corpus where each row // is a cluster cluster.i.similarityMatrix:{[matrix] matrix:"f"$matrix...
// Get high-level stats per second with bulk multiplier seconds:$[`bulk=last scenario;.observer.bulkrows;1]*select count i by time.second from midtab; // 1_??? // Conglomerate transit time stats into a keyed table and grab message per second data from table and return stats1:`stats xcols update stats:`med`av...
Developing with kdb+ and the q language¶ kdb+ is - a high-performance cross-platform historical timeseries columnar database - an in-memory compute engine - a realtime streaming processor - an expressive query and programming language called q For cloud deployment, see kdb Insights Core. Architecture of kdb+ systems¶ ...
Tables¶ Tables are first-class objects in q. Construct¶ Construct a small table using table notation. q)ec1:([]city:`Istanbul`Moscow`London`StPetersburg;country:`Turkey`Russia`UK`Russia;pop:15067724 12615279 9126366 5383890) q)ec1 city country pop ----------------------------- Istanbul Turkey 15067724 Moscow Russia 126...
// @private // @kind data // @category nlpRegexUtilityPattern // @desc A string of special characters // @type string regex.i.patterns.money:"[$¥€£¤฿]?\\s*((?<![.0-9])([0-9][0-9, ]*(\\.", "([0-9]{0,2})?)?|\\.[0-9]{1,2})(?![.0-9]))\\s*((hundred|thousand|million", "|billion|trillion|[KMB])?\\s*([$¥€£¤฿]|dollars?|yen|...
Pattern Matching¶ Pattern matching allows an object such as a list or dictionary to be matched to a pattern, assigning variables to its parts, checking types, and/or modifying values via a filter function. It can simplify unpacking multiple objects passed to and returned from functions, and reduce the overhead of type ...
Serverless q/kdb+ on AWS Lambda¶ Although kdb+ is already widely used within AWS, we are often asked by users to explain how we run kdb+ under a “serverless” framework. One way of running kdb+ in this mode is to use the AWS Lambda service. AWS Lambda is an event-driven, serverless computing platform. It runs code in re...
Atomic functions¶ Many q functions iterate recursively through list or dictionary arguments down to items of some depth. Where a function recurses to the atoms of an argument, it is atomic in that domain: typically, left-atomic, right-atomic; or simply atomic for all its arguments. A function that recurses to strings i...
WebSockets¶ kdb+ supports the WebSocket protocol since V3.0 WebSockets provide a protocol between a client and server which runs over a persistent TCP connection. The client-server connection can be kept open as long as needed and can be closed by either the client or the server. This open connection allows bi-directio...
//postconditions `.finos.init.priv.dependency.edges insert flip flip(providesEscaped;funNameEscaped); .finos.init.priv.dependency.nodes[providesEscaped]:flip flip(provides;`condition); }; .finos.init.priv.dependency.addProviderDependency:{[name] provider: `$"provide_",string[name]; $[provider in ke...
// @private // @kind function // @category utility // @desc Warning function i.deprecatedWarning:"Deprecation Warning: function no longer supported as of", " version '" // @private // @kind function // @category utility // @desc Warning function i.futureWarning:"Future Deprecation Warning: function will no longer be...
A mountain tour of kdb+ and q¶ This is a mountain tour of q, the programming language built into kdb+. It takes the form of a one-page ‘ridge walk’ along the tops, with optional side descents to see more detail. Use it as a very fast start with kdb+, or for a quick overview of what it is like to work in q. Before you s...
Skip to content kdb+ and q documentation and – Reference – kdb+ and q documentation Initializing search Ask a question Home kdb+ and q kdb Insights SDK kdb Insights Enterprise KDB.AI PyKX APIs Help kdb+ and q documentation Home kdb+ and q kdb+ and q About Getting Started Getting Started Install Licenses Learn Learn Ove...
/-these parameters are only used once their value has been set with values retrieved from the WBD. writedownmode:idbdir:savedir:currentpartition:symfilepath:`; symsize:partitionsize:0; /-force loads sym file loadsym:{[] .lg.o[`load;"loading the sym file"]; @[load;symfilepath; {.lg.e[`load;"failed to load sym f...
Serialize a table as an object¶ The simplest way to serialize a table is as a single object. save and load ¶ Keywords save and load let you serialize and write any q object to a file of the same name in the working directory. That includes tables, and is the simplest way to persist one. q)cities:([]city:`Tokyo`Delhi`Sh...
// @kind function // @category tests // @fileoverview Ensure that a test that is expected to pass, // does so with an appropriate return // @param function {(func;proj)} The function or projection to be tested // @param data {any} The data to be applied to the function as an individual item for // unary functions ...
// Bespoke WDB config .merge.mergebybytelimit:0b // merge limit configuration - default is 0b row count limit 1b is byte size limit .merge.partlimit:1000 // limit the number of partitio...
asc , iasc , xasc ¶ Sort and grade: ascending Q chooses from a variety of algorithms, depending on the type and data distribution. asc ¶ Ascending sort asc x asc[x] Where x is a: - vector, returns its items in ascending order of value, with the sorted attribute set, indicating the list is sorted; where the argument vec...
// @kind function // @category dataCheck // @desc Ensure that any non-default functions a user wishes to use // exist within the current process such that they are callable // @param config {dictionary} Information relating to the current run of AutoML // @return {::|err} Null on success, error if function invalid d...
/ return weekdays from list of dates wday:{x where 1<x mod 7} / return a range of numbers between (s)tart and (e)nd / with specified (w)indow size rng:{[w;s;e]s+w*til ceiling(e-s)%w} / round y to nearest x rnd:{x*"j"$y%x} / generate (n) uniform random numbers between (s)tart and (e)nd randrng:{[n;s;e]s+n?e-s} / au...
Joins¶ Keyed: As of: ej equi aj aj0 as-of ij ijf inner ajf ajf0 lj ljf left asof simple as-of pj plus wj wj1 window uj ujf union upsert , join ^ coalesce A join combines data from two tables, or from a table and a dictionary. Some joins are keyed, in that columns in the first argument are matched with the key columns o...
Variadic syntax¶ An applicable value is variadic if its rank is not fixed. Lists and dictionaries of depth ≥2 and tables are variadic. q)m:4 5#"abcdefghijklmnopqrst" q)m[1 3] / unary "fghij" "pqrst" q)m[1 3;2 4] / binary "hj" "rt" q)t:([]name:`Tom`Dick`Harry;city:`London`Paris`Rome) q)t[`name] / unary `Tom`Dick`Harry q...
Installing multiple versions of kdb+¶ For any version of q, the 64-bit and 32-bit interpreter binaries share the same q.k file, located in QHOME for that version. All versions share the same k4.lic or kc.lic license-key file. Arrange your files as in this example: $ tree q q ├── k4.lic ├── phrases.q ├── sp.q ├── trade....
$ Tok¶ Interpret a string as a data value x$y $[x;y] Where y is a stringx is a non-positive short or upper-case char as below (or the null symbol as a synonym for"S" ) returns y as an atom value interpreted according to x . x values for Tok: q){([result:key'[x$\:()]];short:neg x;char:upper .Q.t x)}5h$where" "<>20#.Q.t ...
File compression¶ kdb+ can compress data as it is written to disk. Q operators and keywords read both compressed and uncompressed files. Write compressed files¶ Use set with a left argument that specifies the file or splay target, and the compression parameters. (For a splayed table, you can specify the compression of ...
System commands¶ \a tables \s number of secondary threads \b views \S random seed \B pending views \t timer \c console size \T timeout \cd change directory \ts time and space \C HTTP size \u reload user password file \d directory \v variables \e error trap clients \w workspace \E TLS server mode \W week offset \f funct...
ss , ssr ¶ String search – and replace ss ¶ String search x ss y ss[x;y] Where x is a stringy is a pattern as a string (no asterisk) returns an int vector of position/s within x of substrings that match pattern y . q)"We the people of the United States" ss "the" 3 17 q)s:"toronto ontario" q)s ss "ont" 3 8 q)s ss "[ir]o...
/ - function for loading in config csv with multiple processes in one line duplicateconfig:{[t] update proc:raze[t `proc] from ((select from t)where count each t[`proc])}; / - end of default parameters /- called at every EOD by .u.end init:{ .lg.o[`init;"searching for servers"]; /- Open connection to discovery. R...
// @kind function // @category private // @fileoverview Get stored cookie(s) relevant to current query // @param q {dict} query object // @return {string} cookie(s) getcookies:{[q] h:q`host;p:q`path;pr:q`protocol; //extact necessary components h:".",h; ...
Comparing option pricing methods in q¶ In this paper, we compare the use of both Monte Carlo (MC) and Quasi-Monte Carlo (QMC) methods in the process of pricing European and Asian options. In doing so, we consider the use of two discretization schemes - standard discretization and Brownian-bridge construction. Results p...
mod ¶ Modulus x mod y mod[x;y] Where x and y are numeric, returns the remainder of x%y . q)-3 -2 -1 0 1 2 3 4 mod 3 0 1 2 0 1 2 0 1 q)7 mod 2 3 4 1 1 3 q)-7 7 mod/:\:-2.5 -2 2 2.5 -2 -1 1 0.5 -0.5 -1 1 2 mod is a multithreaded primitive. Implicit iteration¶ mod is an atomic function. q)(10;20 30)mod(7 13;-12) 3 10 -4 -...
// Set the timer to 200ms if not set already if[not system"t"; system"t 200"]]; if[@[value;`.proc.lowerpowermode;0b]; if[.timer.enabled; // Set the timer to 1000ms if lowpowermode system"t 1000"]]; \ f:{0N!`firing;x+1} f1:{0N!`firing;system"sleep ",string x} repeat[.proc.cp[];.proc.cp[]+0D00:01;0D00:00:15;(f1;2);"t...
The q language¶ Q is the programming system for working with kdb+. This corresponds to SQL for traditional databases, but unlike SQL, q is a powerful programming language in its own right. Q is an interpreted language. Q expressions can be entered and executed in the q console, or loaded from a q script, which is a tex...
About this site¶ This site is the official documentation for kdb+ and the q programming language. It reflects the work of the KX community since 1993, has many authors, and continues to evolve. Search¶ The Search Box on this site is customized for the q language. Some examples: Operator glyphs $ ^ . <> /: ': and their ...
// @private // // @overview // Set a Keras model within the ML Registry // // @param registryPath {string} Full/relative path to the model registry // @param model {any} `(<|foreign)` The Keras object to be saved as a h5 file. // @param modelInfo {dict} Information relating to the model which is // being saved, this ...
C# client for kdb+¶ A kdb+ interface for the C# programming language is documented and available to download from https://github.com/KxSystems/csharpkdb. The interface permits connecting C# and kdb+ processes via IPC. A kdb+ interface for the C# programming language is documented and available to download from https://...
\d .gw // if error & sync message, throws an error. Else passes result as normal // status - 1b=success, 0b=error. sync - 1b=sync, 0b=async formatresponse:{[status;sync;result]$[not[status]and sync;'result;result]}; synccallsallowed:0b // whether synchronous calls are allowed querykeeptime:0D00:30 ...
h:-2 / handle to print log lvl:2 / log level unit:"BKMGTP" / memory unit character mult:5 (1024*)\ 1 / memory multiplier / build memory string mem:{@[string"i"$(3#x)%mult m;2;,;unit m:mult bin x 2]} / build log header hdr:{string[(.z.D;.z.T)],mem system "w"} / build log message msg:{if[x...
Multi-partitioned kdb+ databases: an equity options case study¶ kdb+ is well suited to managing massive datasets and offers an unrivalled performance advantage when it comes to processing and analyzing data. This is a case study highlighting some of the key points we have found with regard to the storage and maintenanc...
// log stubs .finos.log.critical:{-1"CRITICAL: ",x;} .finos.log.error :{-1"ERROR: " ,x;} .finos.log.warning :{-1"WARNING: " ,x;} .finos.log.info :{-1"INFO: " ,x;} .finos.log.debug :{-1"DEBUG: " ,x;} .finos.util.shr :{0b sv x xprev 0b vs y} / right shift .finos.util.xor :{0b sv (<>/) 0b vs'(x;y)} / ...
Summarize and say¶ Analyze a dictionary of results; map between dictionaries A lambda for the Look & Say sequence composes with desc and the Do iterator to produce the Summarize & Say sequence. A million integers in string form hashes with group and desc to a dictionary of 8002 unique seeds. A dictionary of sequences, ...
// @kind function // @category preprocessing // @desc Transform a list of integers based on a previously generated // label encoding // @param data {int[]} Data to be reverted to original representation // @param map {dictionary} Maps true representation to associated integer or // the return from .ml.labelEncode....
Timezones (TZ) and Daylight Savings Time (DST)¶ Q has two built-in functions ltime and gtime which can be used to get the UTC time or local time according to the TZ shell environment setting. One solution for more comprehensive timezone calculations is to have a table that contains the timezones, their UTC offsets, and...
// @private // // @overview // Delete all folders relating to an experiment or to 1/all versions of a model // // @param config {dict} Configuration information provided by the user // @param objectType {symbol} ``` `experiment `allModels or `modelVersion``` // // @return {null} registry.util.delete.object:{[config;obj...
Circles in a Circle, 1923 Everything begins with a dot. — W.W. Kandinsky . Apply, Index, Trap @ Apply At, Index At, Trap At¶ - Apply a function to a list of arguments - Get items at depth in a list - Trap errors | rank | syntax | function semantics | list semantics | |---|---|---|---| | 2 | v . vx .[v;vx] | Apply Apply...
Connection handles¶ kdb+ communicates with the console, stdout, stderr, file system, and other processes through connection handles. There are three permanent system handles: 0 console 1 stdout 2 stderr File and process handles are created by hopen and destroyed by hclose . Write¶ Syntax: h x neg[h] x where h is a hand...
deltas ¶ Differences between adjacent list items deltas x deltas[x] Where x is a numeric or temporal vector, returns differences between consecutive pairs of its items. q)deltas 1 4 9 16 1 3 5 7 In a query to get price movements: update diff:deltas price by sym from trade With signum to count the number of up/down/same...
The .Q namespace¶ Tools General Datatype addmonths btoa b64 encode dd join symbols j10 encode binhex f precision format j12 encode base 36 fc parallel on cut ty type ff append columns x10 decode binhex fmt precision format x12 decode base 36 ft apply simple fu apply unique Database gc garbage collect chk fill HDB gz GZ...
Common design principles for kdb+ gateways¶ In the vast majority of kdb+ systems, data is stored across several processes. These setups can range from a single real-time and historic database on the same server to multi-site architectures where data of various forms is stored in hundreds of different processes. In eith...
Linear programming¶ Linear Programming is a large topic, of which this article reviews just a few applications. More articles on it would be very welcome: please contact docs@kx.com. Iverson Notation and linear algebra Q is a descendant of the notation devised at Harvard by the Turing Award winner, mathematician Ken Iv...
mergemode:`part // the partbyattr writedown mode can merge data from temporary storage to the hdb in three ways: // 1. part - ...
/ Deletes the specified object reference from the namespace. If the reference deleted is the last object in the / namespace then the namespace is removed as well recursively up the namespace tree. / NOTE: The namespace hierarchy removal will never remove the root namespace even if it is empty / @param nsRef (Symbol) T...
// @private // @kind function // @category nlpTimeUtility // @desc Seperate YearMonth formats to year and month // i.e "ymd" -> "y","m","d" // @params ymd {string[]} The format for each date objecct // @returns {string} Formats of YearMonthDays objects seperated tm.i.formatYMD:{[ymd] @[ymd;i unq;:;"ymd" unq:where 1...
Running kdb+ as a service on Windows¶ Windows 7+ provides a task scheduler tool which can be used to run kdb+ processes as services. To schedule a kdb+ process to start on startup: - Press the +R keys to open Run. - Type taskschd.msc and press Enter. - Under Actions select Create Task. - Enter a name and description fo...
/ https://lintool.github.io/Cloud9/docs/exercises/pagerank.html node:asc distinct raze cloud9.l l:node?cloud9.l show S:(1 2#1+max over l), .ml.prepend[1f] l show node[i]!r i:idesc r:.ml.pageranks[d;S] over r:n#1f%n:S[0;0] -1 "into a full matrix"; show A:.ml.full S show node[i]!r i:idesc r:.ml.pageranka[d;A] show node[i...
Basic programs¶ From GeeksforGeeks Python Programming Examples Many of the published examples have been rewritten to use Python techniques more likely to illuminate the q solution. Where practical, the solutions are shown as expressions evaluated in the REPL, which better allows for experimenting. Follow links to the o...
/ if reQ not loaded, define necessary components here if[not `req in key `; .url.parse0:{[q;x] if[x~hsym`$255#"a";'"hsym too long - consider using a string"]; //error if URL~`: .. too long x:.url.sturl x; //ensure string URL ...
/ General job addition function. Adds a job to the cron system for execution / @param func (Symbol) Symbol reference to the function to execute / @param args () Any arguments that are required to execute the function. Pass generic null (::) for no arguments / @param runType (Symbol) The type of cron job to add. See ...
kdb+ in astronomy¶ The field of observational astronomy has always been data-driven, but like many other fields, technological advances are causing something of a paradigm shift, and – according to experts – a bit of a headache! Currently under construction are new infrastructures that have the potential to record volu...
// @kind function // @category models // @desc Fit a vanilla torch model to data // @param data {dictionary} Containing training and testing data according to // keys `xtrn`ytrn`xtst`ytst // @param model {<} Model object being passed through the system (compiled) // @return {<} A vanilla fitted torch model models.tor...
// @kind function // @category rs // @desc Cross validated parameter random search applied to data with // ascending split indices // @param k {int} Number of folds // @param n {int} Number of repetitions // @param features {any[][]} Matrix of features // @param target {any[]} Vector of targets // @param function {fn...
// Create FIFO and unzip file into it, return FIFO name readintofifo:{[filename] fifo:"/tmp/logfifo",string .z.i; fifostr:"mkfifo ",fifo,";gunzip -cd ",filename," > ",fifo," &"; @[system;fifostr;{.lg.e[`replay;"Failed to read log into named pipe"]}]; fifo }; // upd functions down here realupd:{[f;t;x] // in...
// @kind function // @category runModels // @desc Seeded cross validation function, designed to ensure that // models will be consistent from run to run in order to accurately assess // the benefit of updates to parameters. // @param tts {dictionary} Feature and target data split into training/testing // sets //...
Using modified .z functions to trace, monitor and control execution¶ Every client interaction with a kdb+ server is handled by one of the p ? functions you’ll find in the system namespace .z . These functions have reasonable, simple defaults that work fine right out of the box. What we’re doing here is taking advantage...
generatehdb:{[x] .lg.o[`mockdata;"generating mock hdb"]; x:updatehdbdir x; setondisk[x].'exec .getrange[partitiontype]'[til n]from x; loadhdb x`hdbdir; }; updatehdbdir:{[x]update hdbdir:` sv(testpath;hdbname)from x}; loadhdb:{[hdbdir]system "l ",1_string hdbdir}; generaterdb:{ .lg.o[`mockdata;"generating...
cov , scov ¶ Covariance cov ¶ x cov y cov[x;y] Where x and y are conforming numeric lists returns their covariance as a floating-point number. Applies to all numeric data types and signals an error with temporal types, char and sym. q)2 3 5 7 cov 3 3 5 9 4.5 q)2 3 5 7 cov 4 3 0 2 -1.8125 q)select price cov size by sym ...
Functional qSQL¶ The functional forms of delete , exec , select and update are particularly useful for programmatically-generated queries, such as when column names are dynamically produced. Functional form is an alternative to using a qSQL template to construct a query. For example, the following are equivalent: q)sel...
Performance tips¶ How do I execute functions in parallel?¶ In the expression f each xs , f is applied to each element of xs in sequence. In a multi-CPU setting, applications of f can be done in parallel by using peach instead of each . Typically this is worth it if f is computationally expensive. Evaluating a hardware ...
upsert ¶ Overwrite or append records to a table x upsert y upsert[x;y] Where x is a table, or the name of a table as a symbol atom, or the name of a splayed table as a directory handley is zero or more records the records are upserted into the table. The record/s y may be either - lists with types that match type each ...
u.q¶ u.q is available from KxSystems/kdb-tick Overview¶ Contains functions to allow clients to subscribe to all or subsets of available data, publishing to interested clients and alerting clients to events, for example, end-of-day. Tracks client subscription interest and removes client subscription details on their dis...
Implicit iteration¶ Before you specify iteration, see whether what you need is already implicit in the operators and keywords This tutorial as a video presentation Lists and dictionaries are first-class entities in q, and most operators and keywords iterate through them. This article is about when to leave it to q. Tha...
An introduction to neural networks with kdb+¶ Due to the desire to understand the brain and mimic the way it works by creating machines that learn, neural networks have been studied with great interest for many decades. A simple mathematical model for the neuron was first presented to the world by Warren McCulloch and ...
// @kind function // @category main // @subcategory new // // @overview // Generates a new named experiment within the specified registry without // adding a model on-prem or within a supported cloud providers storage solution // // @todo // It should be possible via configuration to add descriptive information // ab...
// @private // @kind function // @category optimizationUtility // @desc Optimize a function until gradient tolerance is reached or // maximum number of allowed iterations is met. The following outlines a // python equivalent // https://github.com/scipy/scipy/blob/v1.5.0/scipy/optimize/optimize.py#L1131 // @param f...
// Find offset of central directory signature in a zip vector. // Assumes last match is valid; more sophisticated algos are possible, // but they can be implemented as needed. // @param x bytes // @return long .finos.unzip.priv.ovcds:{ last("c"$x)ss"c"$0x504b0506} // Find offset of central directory signature in a ...
\d .subcut enabled:1b // switch on subscribercutoff \d .servers CONNECTIONS,:`segmentedtickerplant CONNECTIONSFROMDISCOVERY:1b ================================================================================ FILE: TorQ_config_settings_segmentedtickerplant.q SIZE: 1,446 characte...