def get_kde_numeric_attribute(log, attribute, parameters=None): """ Gets the KDE estimation for the distribution of a numeric attribute values Parameters ------------- log Event stream object (if log, is converted) attribute Numeric attribute to analyse parameters Possible parameters of the algorithm, including: graph_points -> number of points to include in the graph Returns -------------- x X-axis values to represent y Y-axis values to represent """ if type(log) is EventLog: event_log = transform.transform_event_log_to_event_stream(log) else: event_log = log values = [event[attribute] for event in event_log if attribute in event] return attributes_common.get_kde_numeric_attribute(values, parameters=parameters)
def get_kde_numeric_attribute(df, attribute, parameters=None): """ Gets the KDE estimation for the distribution of a numeric attribute values Parameters ------------- df Pandas dataframe attribute Numeric attribute to analyse parameters Possible parameters of the algorithm, including: graph_points -> number of points to include in the graph Returns -------------- x X-axis values to represent y Y-axis values to represent """ values = list(df.dropna(subset=[attribute])[attribute]) return attributes_common.get_kde_numeric_attribute(values, parameters=parameters)
def get_kde_numeric_attribute(df, attribute, parameters=None): """Gets the KDE estimation for the distribution of a numeric attribute values """ values = df.select(attribute).rdd.map(lambda row: row[0]).collect() return attributes_common.get_kde_numeric_attribute(values, parameters=parameters)
def get_numeric_attribute(self, attribute_key, parameters=None): if parameters is None: parameters = {} url = self.get_url("getNumericAttributeValues", parameters={"attribute_key": attribute_key}) r = requests.get(url) ret_text = r.text ret_json = json.loads(ret_text) ret = ret_json["points"] x, y = attributes_common.get_kde_numeric_attribute(ret) return x, y
def get_numeric_attribute(self, attribute_key, parameters=None): if parameters is None: parameters = {} list_logs = self.get_list_logs() for key in self.init_parameters: if key not in parameters: parameters[key] = self.init_parameters[key] parameters["filters"] = self.filters parameters["attribute_key"] = attribute_key ret = parquet_handler.get_case_duration(".", self.distr_log_path, list_logs, parameters=parameters) x, y = attributes_common.get_kde_numeric_attribute(ret) return x, y