def mode_robust_kde(inputData, axis = None): """ Extracting the dataset of the mode using kernel density estimation """ if axis is not None: def fnc(x): return mode_robust_kde(x) dataMode = np.apply_along_axis(fnc, axis, inputData) else: # Create the function that we can use for the half-sample mode bandwidth, mesh, density, cdf = kde(inputData) dataMode = mesh[np.argamax(density)] return dataMode
def mode_robust_kde(inputData, axis = None): """ Extracting the dataset of the mode using kernel density estimation """ if axis is not None: def fnc(x): return mode_robust_kde(x) dataMode = np.apply_along_axis(fnc, axis, inputData) else: # Create the function that we can use for the half-sample mode bandwidth, mesh, density, cdf = kde(inputData) dataMode = mesh[np.argamax(density)] return dataMode