Skip to content

Snippets

Gustavo Rosa edited this page Jul 7, 2020 · 5 revisions

Our code belongs to everyone. Thus, we strive to offer the most possible commented, documented, and exemplified code of all time. In OPFython, we present code snippets in an attempt to fulfill everyone's needs.

Applications

  • knn_supervised_opf_training.py: KNN-based Supervised OPF training;
  • semi_supervised_opf_training.py: Semi-Supervised OPF training;
  • supervised_opf_agglomerative.py: Supervised OPF agglomerative learning;
  • supervised_opf_learning.py: Supervised OPF learning;
  • supervised_opf_pre_computed_distances.py: Supervised OPF training with pre-computed distances;
  • supervised_opf_pruning.py: Supervised OPF pruning;
  • supervised_opf_training.py: Supervised OPF training;
  • unsupervised_opf_clustering.py: Unsupervised OPF clustering.

Core

  • create_heap.py: Heap class creation;
  • create_node.py: Node class creation;
  • create_opf.py: OPF class creation;
  • create_subgraph.py: Subgraph class creation.

Math

  • calculate_distances.py: A how-to guide in calculating several distance metrics;
  • general_purpose.py: General purpose functions implemented to assist other methods;
  • generate_random_numbers.py: How-to generate random numbers;
  • pre_compute_distances.py: Pre-computes a distance file for speeding up the algorithm.

Models

  • create_knn_supervised_opf.py: How-to create a KNNSupervisedOPF class;
  • create_semi_supervised_opf.py: How-to create a SemiSupervisedOPF class;
  • create_supervised_opf.py: How-to create a SupervisedOPF class;
  • create_unsupervised_opf.py: How-to create an UnsupervisedOPF class.

Stream

  • load_file.py: Loads an input file from .txt, .csv or .json;
  • parse_loaded_file.py: Parses the loaded file into X and Y numpy arrays;
  • split_data.py: Splits the data according to the desired characteristics.

Subgraphs

  • create_knn_subgraph.py: An assistant on how to create a KNN-based Subgraph structure.

Utils

  • convert_from_opf.py: Converts .dat / .opf files into OPFython's input types (.txt, .csv or .json).

Clone this wiki locally