Esempio n. 1
0
    def get_ts_properties(self, molecular_graphs: list,
                          group_size: int) -> None:
        """
        Gets molecular properties for group of molecular graphs, only for the
        training set.

        Args:
        ----
            molecular_graphs (list) : Contains `PreprocessingGraph`s.
            group_size (int) : Size of "group" (i.e. slice of graphs).
        """
        if self.is_training_set:

            analyzer = Analyzer()
            ts_properties = analyzer.evaluate_training_set(
                preprocessing_graphs=molecular_graphs)

            # merge properties of current group with the previous group analyzed
            if self.ts_properties:  # `self.ts_properties` is a dictionary
                self.ts_properties = analyzer.combine_ts_properties(
                    prev_properties=self.ts_properties,
                    next_properties=ts_properties,
                    weight_next=group_size)
            else:  # `self.ts_properties` is None (has not been calculated yet)
                self.ts_properties = ts_properties
        else:
            self.ts_properties = None