source: git/machine_learning/mlpredict.h @ 86420e

spielwiese
Last change on this file since 86420e was 86420e, checked in by Murray Heymann <heymann.murray@…>, 5 years ago
Update python testing
  • Property mode set to 100644
File size: 2.0 KB
Line 
1/**
2 * @file   mlpredict.h
3 * @brief  Function definitions for using python to do machine learning in Singular
4 *
5 * @author Murray Heymann
6 * @date   August 2019
7 */
8#ifndef MLPREDICT_H
9#define MLPREDICT_H
10
11#define SINGULAR_BIN    "~/Singular/Singular4/bin/Singular"
12#define EXTRACT_SCRIPT  "extract.lib"
13#define KEYWORDS_FILE   "keywords.txt"
14#define VECTORS_NPY             ".vectors.npy"
15#define HELPFILE_NPY    ".helpfilelist.npy"
16
17#define HELP_FILE_URL   "ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/src/4-1-2/doc.tbz2"
18#define HELP_FILE_PATH  "helpfiles/singular"
19
20#define LOOKUPTABLE "common.lookuptable"
21#define IS_LOOKUP_INITIALISED "is_lookup_initialised"
22#define INIT_TABLE_ON_SYSTEM "init_table_on_system"
23
24/**
25 * Check whether the helpfiles have been downloaded and the relevant
26 * vectors have been calculated and saved.
27 *
28 * @return An integer:  1 if it has been intialised, 0 otherwise
29 */
30int ml_is_initialised();
31
32/**
33 * Initialise the machine learning system by starting the python
34 * interpreter,  downloading the helpfiles if
35 * not present, and calculating the bag of words vectors for the helpfiles,
36 * saving this info on the local system.
37 *
38 * @return An integer: 1 if successful, 0 if some error were to occur.
39 */
40int ml_initialise();
41
42/**
43 * Finalize the python interpreter
44 *
45 * @return An integer: 1 if successful, 0 if not.
46 */
47int ml_finalise();
48
49/**
50 * Take a filename as string, pass it to the machine learning system, and
51 * return a helpfile name as string.
52 *
53 * @param[in]  filename A String indicating the for which the prediction
54 * must be made
55 * @param[in]  buffer_size The maximum length of the prediction string.
56 * @param[out] prediction_buffer The buffer into which the prediction
57 * filename is copied. 
58 * @param[out] pred_len A pointer to an integer, at which the string length
59 * of the prediction filename is set.
60 *
61 * @return 1 if successful, 0 if some error occurs.
62 */
63int ml_make_prediction(char *filename,
64                                           int buffer_size, 
65                                           char *prediction_buffer,
66                                           int *pred_len);
67
68#endif
Note: See TracBrowser for help on using the repository browser.