Meta-feature confidence interval

In this example, we will show you how to extract meta-features with confidence interval.

Began the metafeature extraction with confidence intervals process.
Now extracting metafeatures from original sample.
Done extracting metafeatures from original sample (total of 7 metafeatures).
Started data resampling with bootstrap with the following configurations:
| Total data resamples: 256
| Confidence levels used: [0.99] (total of 1).
. Random seeds:
   | For extractor model: 1234
   . For bootstrapping: None
Now extracting metafeatures from resampled data.

  0%|          | 0/256 [00:00<?, ?it/s]/home/docs/checkouts/readthedocs.org/user_builds/pymfe/envs/stable/lib/python3.7/site-packages/pymfe/_internal.py:1568: UserWarning: It is not possible make equal discretization
  warnings.warn("It is not possible make equal discretization")
/home/docs/checkouts/readthedocs.org/user_builds/pymfe/envs/stable/lib/python3.7/site-packages/pymfe/_internal.py:1568: UserWarning: It is not possible make equal discretization
  warnings.warn("It is not possible make equal discretization")

  8%|8         | 21/256 [00:00<00:01, 202.17it/s]
 16%|#6        | 42/256 [00:00<00:01, 204.17it/s]
 25%|##4       | 63/256 [00:00<00:00, 204.34it/s]/home/docs/checkouts/readthedocs.org/user_builds/pymfe/envs/stable/lib/python3.7/site-packages/pymfe/_internal.py:1568: UserWarning: It is not possible make equal discretization
  warnings.warn("It is not possible make equal discretization")

 33%|###2      | 84/256 [00:00<00:00, 204.76it/s]
 41%|####1     | 105/256 [00:00<00:00, 205.04it/s]/home/docs/checkouts/readthedocs.org/user_builds/pymfe/envs/stable/lib/python3.7/site-packages/pymfe/_internal.py:1568: UserWarning: It is not possible make equal discretization
  warnings.warn("It is not possible make equal discretization")

 49%|####9     | 126/256 [00:00<00:00, 204.27it/s]/home/docs/checkouts/readthedocs.org/user_builds/pymfe/envs/stable/lib/python3.7/site-packages/pymfe/_internal.py:1568: UserWarning: It is not possible make equal discretization
  warnings.warn("It is not possible make equal discretization")

 57%|#####7    | 147/256 [00:00<00:00, 204.56it/s]
 66%|######5   | 168/256 [00:00<00:00, 204.95it/s]
 74%|#######3  | 189/256 [00:00<00:00, 205.02it/s]/home/docs/checkouts/readthedocs.org/user_builds/pymfe/envs/stable/lib/python3.7/site-packages/pymfe/_internal.py:1568: UserWarning: It is not possible make equal discretization
  warnings.warn("It is not possible make equal discretization")

 82%|########2 | 210/256 [00:01<00:00, 204.40it/s]/home/docs/checkouts/readthedocs.org/user_builds/pymfe/envs/stable/lib/python3.7/site-packages/pymfe/_internal.py:1568: UserWarning: It is not possible make equal discretization
  warnings.warn("It is not possible make equal discretization")

 90%|######### | 231/256 [00:01<00:00, 204.28it/s]
 98%|#########8| 252/256 [00:01<00:00, 204.65it/s]
100%|##########| 256/256 [00:01<00:00, 204.56it/s]
Done extracting metafeatures from resampled data.
Finished data resampling with bootstrap.
Now calculating confidence intervals... Done.
max.mean                                                        5.425000000000001              5.625000000000002
max.sd                                                         2.3759112147178905              2.564498302062089
mean.mean                                                       3.302750000000002             3.5970708333333348
mean.sd                                                        1.8715704340684498             1.9580808450547889
nr_cor_attr                                                   0.16666666666666674                            0.5
sd.mean                                                        0.8723289319973981             1.0299047593601987
sd.sd                                                          0.5017337852499149             0.6390658778822161

# Load a dataset
import sklearn.tree
from sklearn.datasets import load_iris
from pymfe.mfe import MFE

data = load_iris()
y = data.target
X = data.data

# You can also extract your meta-features with confidence intervals using
# bootstrap. Keep in mind that this method extracts each meta-feature several
# times, and may be very expensive depending mainly on your data and the
# number of meta-feature extract methods called.

# Extract meta-features with confidence interval
mfe = MFE(features=["mean", "nr_cor_attr", "sd", "max"])
mfe.fit(X, y)

ft = mfe.extract_with_confidence(
    sample_num=256,
    confidence=0.99,
    verbose=1,
)

print("\n".join("{:50} {:30} {:30}".format(x, y[0], y[1])
                for x, y in zip(ft[0], ft[2])))

Total running time of the script: ( 0 minutes 1.266 seconds)

Gallery generated by Sphinx-Gallery