Forest iSAX

class pyCFOFiSAX._forest_iSAX.ForestISAX(size_word: int, threshold: int, data_ts: numpy.ndarray, base_cardinality: int = 2, number_tree: int = 1, indices_partition: Optional[list] = None, max_card_alphabet: int = 128, boolean_card_max: bool = True)

ForestISAX class containing one or more trees and pretreatment functions on the data contained in these trees

Paramètres
  • size_word (int) – The size of the SAX words

  • threshold (int) – The maximum threshold of nodes

  • data_ts (numpy.ndarray) – The sequences to be inserted to extract the stats

  • base_cardinality (int) – The smallest cardinality for encoding iSAX

  • number_tree (int) – The number of TreeISAX trees in the forest

  • indices_partition (list) – a list of index list where, for each tree, specifies the indices of

sequences to be inserted :param int max_card_alphabet: if boolean_card_max == True, the maximum cardinality of encoding iSAX in each of the trees :param boolean boolean_card_max: if == True, Defines a maximum cardinality for encoding iSAX Sequences in each of the trees

Variables

length_partition (list) – The length of the SAX words in each tree (== [size_word] if ``number_tree

== 1``)

_count_nodes(id_tree: int)

The _count_nodes function returns the number of nodes and leaf nodes for a given tree. Uses count_nodes_by_tree().

Paramètres

id_tree (int) – The tree ID to be analyzed

Renvoie

the number of internal nodes, the number of leaf nodes

Type renvoyé

int, int

_init_trees(data_ts: numpy.ndarray, max_card_alphabet: int, boolean_card_max: bool)

Function that initializes the tree (s) when creating a ForestISAX object

Paramètres
  • data_ts (numpy.ndarray) – The sequences to be inserted to extract the stats

  • max_card_alphabet (int) – if boolean_card_max == True, The maximum cardinality of encoding iSAX

dans chacun des arbres :param boolean boolean_card_max: if boolean_card_max == True, defines maximum cardinality for encoding iSAX sequences in each tree

index_data(new_sequences: numpy.ndarray)

The Index_Data function allows you to insert a large number of sequences

Paramètres

new_sequences (numpy.ndarray) – The sequences to be inserted

Renvoie

The number of sequences (sub sequences) insert into the tree (in the trees)

Type renvoyé

numpy.array

list_nodes(id_tree: int, bool_print: bool = False)

Returns lists of nodes and barycenters of the tree id_tree.Displays statistics on standard output if bool_print == True Uses get_list_nodes_and_barycentre().

Paramètres
  • id_tree (int) – The tree ID to be analyzed

  • bool_print (boolean) – Displays the nodes stats on the standard output

Renvoie

The list of nodes, the list of internal nodes, the list of barycenters

Type renvoyé

list, list, list

number_nodes_visited(query: numpy.array, ntss: numpy.ndarray)

Count the number of average visited nodes in each tree for calculating the approximation.

Paramètres
  • query (numpy.array) – The sequence to be evaluated

  • ntss (numpy.ndarray) – Reference sequences

Renvoie

Returns the number of nodes visited in each tree for the approximation iCFOF

Type renvoyé

numpy.array

preprocessing_forest_for_icfof(ntss: numpy.ndarray, bool_print: bool = False, count_num_node: bool = False)

Allows us to call, for the id_tree to the pre-treatment for the calculation iCFOF

Paramètres
  • ntss – Reference sequences

  • bool_print (boolean) – if True, displays the times of each pre-treatment step

  • count_num_node (boolean) – if True, count the number of nodes

Renvoie

if count_num_node, returns the number of nodes contained in each tree

Type renvoyé

numpy.array