I am using the skfuzzy module to create a fuzzy logic controller to evaluate three arrays. I have defined my Antecedent/Consequent objects, built my membership functions, created my rules and control system, but when I try and loop across my three arrays that each consist of 52,110 elements, the output array is only 750 elements not 52,110 elements.
The three arrays were created using the following method:
# convert pandas frame to numpy array for skfuzzy
p_array = vul_df[['wet_dist', 'rd_dist', 'strm_dist', 'strm_order', 'slope']].to_numpy()
strm_dist = p_array[0:,2].flatten()
strm_order = p_array[0:,3].flatten()
strm_slope = p_array[0:,4].flatten()
dist_x = np.asfarray(strm_dist)
order_x = np.asfarray(strm_order)
slope_x = np.asfarray(strm_slope)
The following is the for loop method I used:
# FIS for stream distance, stream order, and stream slope
strm_vul = []
for i in range(len(strmdist)):
vulnerability.input['strmdist'] = dist_x[i]
vulnerability.input['strmord'] = order_x[i]
vulnerability.input['slope'] = slope_x[i]
vulnerability.compute()
strm_vul.append(vulnerability.output['vul'])