TreeBuilding documentation¶
-
class
logflow.treebuilding.Dataset.Dataset(path_model='', name_model='', index_line_max=inf, path_data='', window_size=30, parser_function='')[source]¶ A dataset is an object containing the data. It is used to load the files and to compute the window for each new prediction on a log.
Parameters: - path_model (str, optional) – path to the model to load. Defaults to “”.
- name_model (str, optional) – name of the model to load. Defaults to “”.
- index_line_max (int, optional) – load only the lines with a lower index in the file. Avoid to load all the lines. Defaults to float(“+inf”).
- path_data (str, optional) – path to the logs. Defaults to “”.
- window_size (int, optional) – size of the window. Defaults to 30.
- parser_function (function, optional) – Function to split the log entry and get the message part. Defaults to “”, means split according to space and uses the words after the 9th position.
-
class
logflow.treebuilding.Inference.Inference(models: List[T])[source]¶ Manages the deep learning model, and run the inference through it.
Parameters: models (List) – list of the learned model to load. -
probability(x: List[float]) → List[float][source]¶ Compute probability (ie 0 =< proba =< 1) values for each sets of scores in x.
Parameters: x (List[float]) – list of values. Here, it is used at the output of the attention layer Returns: list of probabilities Return type: List[float]
-
test(data: List[List[float]], log: logflow.treebuilding.Log.Log) → List[T][source]¶ Run the inference through the model and return only the value greater than the threshold.
Parameters: - data (List[List[float]]) – vector to be used as an input
- log (Log) – log to predict
Returns: list of the log with a weigth greater than the threshold.
Return type: List
-
-
class
logflow.treebuilding.Log.Log(line: str, index_line=-1, parser_function='')[source]¶ Represents a line of log.
Parameters: - line (str) – the line
- index_line (int, optional) – index of the line in the file. Defaults to -1.
-
class
logflow.treebuilding.Parser.Parser(dict_patterns, w2v, counter_patterns)[source]¶ Get the pattern and the embedding of a log.
Parameters: - dict_patterns (dict) – dict of patterns
- w2v (dict) – word2vec model
- counter_patterns (dict) – dict of the cardinality of patterns.
-
class
logflow.treebuilding.Tree.Tree[source]¶ Manages the tree building according to the relation found by the Inference with the weigths of the attention value.
-
add_node(log: logflow.treebuilding.Log.Log, id=0, parent=-1, processed=False, weight=0)[source]¶ Add a node to the tree
Parameters: - log (Log) – log to add.
- id (int, optional) – id of the node. Defaults to 0.
- parent (int, optional) – id of the node’s parent. Defaults to -1.
- processed (bool, optional) – node has been merged or not. Defaults to False.
- weight (int, optional) – weigth associated to the node according to the attention layer. Defaults to 0.
-
get_node(index: int) → logflow.treebuilding.Node.Node[source]¶ Get a node at the index
Parameters: index (int) – index of the node Returns: node at the index “index” Return type: Node
-
-
class
logflow.treebuilding.Node.Node(log: logflow.treebuilding.Log.Log, id: int, parent: int, processed: bool, weight: float)[source]¶ Node of the tree
Parameters: - log (Log) – Log associated to the node
- id (int) – id of the node
- parent (int) – id of the node’s parents
- processed (bool) – node has been merged or not
- weight (float) – weigth associated to the node according to the attention layer.
-
class
logflow.treebuilding.Workflow.Workflow(dataset: logflow.treebuilding.Dataset.Dataset)[source]¶ Computes the tree of correlations.
Parameters: dataset (Dataset) – dataset containing the data for the inference and the tree building. -
detect_workflow(index_line: int) → str[source]¶ Detect the workflow (i.e. the correlations tree)
Parameters: index_line (int) – index of the line Returns: representation of the three to be used with graphviz. Return type: str
-