My Project
Toggle main menu visibility
Loading...
Searching...
No Matches
Singular
dyn_modules
machinelearning
mlpredict.h
Go to the documentation of this file.
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
#if defined(HAVE_READLINE) && defined(HAVE_READLINE_READLINE_H)
12
#ifdef HAVE_PYTHON
13
#ifdef __cplusplus
14
extern
"C"
{
15
#endif
/* ifdef cpp */
16
17
#include <Python.h>
18
typedef
struct
ml_internal {
19
PyObject *pDictionary;
20
PyObject *pVectors;
21
PyObject *pFile_list;
22
} ml_internal;
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
*/
30
int
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
*/
40
int
ml_initialise();
41
42
/**
43
* Tell python to decrement the global variables, checking whether it is
44
* necessary in the first place.
45
*
46
* @return An integer: 1 if successful, 0 if not.
47
*/
48
int
ml_finalise();
49
50
/**
51
* Take a filename as string, pass it to the machine learning system, and
52
* return a helpfile name as string.
53
*
54
* @param[in] filename A String indicating the for which the prediction
55
* must be made
56
* @param[out] prediction_buffers The buffers 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
*/
63
int
ml_make_prediction(
char
*filename,
64
char
*prediction_buffers[],
65
int
*pred_len,
66
char
*(*custom_strdup)(
const
char
*));
67
68
#ifdef __cplusplus
69
}
70
#endif
/* ifdef cpp */
71
72
#endif
/* HAVE_PYTHON */
73
#endif
/* HAVE_READLINE */
74
#endif
Generated on
for My Project by
doxygen 1.17.0
for
Singular