ComplexityCalculator object init "requires" all arguments to be provided
During initialization of ComplexityCalculator object with one argument (for example metrics='f1'), the argument is being overwritten, because it expects all arguments to be provided:
# Set default metrics, colors and ranges based on mode, if not provided if None not in [metrics, colors, ranges, weights]: self.metrics = metrics self.colors = colors self.ranges = ranges self.weights = weights else: if self.mode == 'regression': self.metrics = R_METRICS self.colors = R_COLORS self.ranges = R_RANGES self.weights = R_WEIGHTS else: self.metrics = C_METRICS self.colors = C_COLORS self.ranges = C_RANGES self.weights = C_WEIGHTS
Example:
cc = px.ComplexityCalculator(metrics='f1') print(f"Metrics: {cc._metrics()}\n")
Returns:
Met: ['f1', 'f1v', 'f2', 'f3', 'f4', 'l1', 'l2', 'l3', 'n1', 'n2', 'n3', 'n4', 't1', 'lsc', 'density', 'clsCoef', 'hubs', 't2', 't3', 't4', 'c1', 'c2']
Furthermore, when I tried providing all arguments:
cc = px.ComplexityCalculator(metrics='f1', colors=['#FD0100', '#F76915', '#EEDE04', '#A0D636', '#2FA236', '#333ED4'], ranges={'FB': 5, 'LR': 3, 'NB': 6, 'NE': 3, 'DM': 3, 'CI': 2}, weights=np.ones((22)))
I got this error:
Traceback (most recent call last): File "C:\Users*\Desktop\MGR\Code\problexity_test.py", line 39, in
cc = px.ComplexityCalculator(metrics='f1', colors=['#FD0100', '#F76915', '#EEDE04', '#A0D636', '#2FA236', '#333ED4'], ranges={'FB': 5, 'LR': 3, 'NB': 6, 'NE': 3, 'DM': 3, 'CI': 2}, weights=np.ones((22))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users* \AppData\Roaming\Python\Python311\site-packages\problexity\ComplexityCalculator.py", line 92, in init if None not in [metrics, colors, ranges, weights]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()