Note
Click here to download the full example code
Customizing measures arguments
In this example we will show you how to custorize the measures.
Custom Arguments
It is possible to pass custom arguments to every meta-feature using PyMFE
extract method kwargs. The keywords must be the target meta-feature name, and
the value must be a dictionary in the format {argument: value}, i.e., each
key in the dictionary is a target argument with its respective value. In the
example below, the extraction of metafeatures min
and max
happens as
usual, but the meta-features sd
, nr_norm
and nr_cor_attr
will
receive user custom argument values, which will interfere in each metafeature
result.
# Extract measures with custom user arguments
mfe = MFE(features=["sd", "nr_norm", "nr_cor_attr", "min", "max"])
mfe.fit(X, y)
ft = mfe.extract(
sd={"ddof": 0},
nr_norm={"method": "all", "failure": "hard", "threshold": 0.025},
nr_cor_attr={"threshold": 0.6},
)
print("\n".join("{:50} {:30}".format(x, y) for x, y in zip(ft[0], ft[1])))
max.mean 5.425000000000001
max.sd 2.1158627082114756
min.mean 1.8499999999999999
min.sd 1.5660459763365826
nr_cor_attr 0.5
nr_norm 1.0
sd.mean 0.9447022382995245
sd.sd 0.4931078458294242
Total running time of the script: ( 0 minutes 0.011 seconds)