Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if max_c is None:
max_c = len(transactions)
# Initializing outputs
concepts = []
if report == '#':
spec_matrix = np.zeros((max_z + 1, max_c + 1))
if report == '3d#':
spec_matrix = np.zeros((max_z + 1, max_c + 1, winlen))
spectrum = []
# Mining the data with fpgrowth algorithm
if np.unique(transactions, return_counts=True)[1][0] == len(
transactions):
fpgrowth_output = [(tuple(transactions[0]), len(transactions))]
else:
fpgrowth_output = fim.fpgrowth(
tracts=transactions,
target=target,
supp=-min_c,
zmin=min_z,
zmax=max_z,
report='a',
algo='s')
# Applying min/max conditions and computing extent (window positions)
fpgrowth_output = list(filter(
lambda c: _fpgrowth_filter(
c, winlen, max_c, min_neu), fpgrowth_output))
# filter out subsets of patterns that are found as a side-effect
# of using the moving window strategy
fpgrowth_output = _filter_for_moving_window_subsets(
fpgrowth_output, winlen)
for (intent, supp) in fpgrowth_output: