# ProbabilisticClassifierChain¶

Probabilistic Classifier Chains.

The Probabilistic Classifier Chains (PCC) 1 is a Bayes-optimal method based on the Classifier Chains (CC).

Consider the concept of chaining classifiers as searching a path in a binary tree whose leaf nodes are associated with a label $$y \in Y$$. While CC searches only a single path in the aforementioned binary tree, PCC looks at each of the $$2^l$$ paths, where $$l$$ is the number of labels. This limits the applicability of the method to data sets with a small to moderate number of labels. The authors recommend no more than about 15 labels for real-world applications.

## Examples¶

>>> from river import feature_selection
>>> from river import linear_model
>>> from river import metrics
>>> from river import multioutput
>>> from river import preprocessing
>>> from river.datasets import synth

>>> dataset = synth.Logical(seed=42, n_tiles=100)

>>> model = multioutput.ProbabilisticClassifierChain(
...     model=linear_model.LogisticRegression()
... )

>>> metric = metrics.multioutput.MicroAverage(metrics.Jaccard())

>>> for x, y in dataset:
...    y_pred = model.predict_one(x)
...    metric = metric.update(y, y_pred)
...    model = model.learn_one(x, y)

>>> metric
MicroAverage(Jaccard): 54.83%


## Methods¶

clear

D.clear() -> None. Remove all items from D.

copy
fromkeys
get

D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.

Parameters

• key
• default – defaults to None
items

D.items() -> a set-like object providing a view on D's items

keys

D.keys() -> a set-like object providing a view on D's keys

learn_one

Update the model with a set of features x and a label y.

Parameters

• x
• y

Returns

self

pop

D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised.

Parameters

• key
• default – defaults to <object object at 0x7f4d7f41a160>
popitem

D.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty.

predict_one

Predict the label of a set of features x.

Parameters

• x

Returns

The predicted label.

predict_proba_one

Predict the probability of each label for a dictionary of features x.

Parameters

• x

Returns

A dictionary that associates a probability which each label.

setdefault

D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D

Parameters

• key
• default – defaults to None
update

D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

Parameters

• other – defaults to ()
• kwds
values

D.values() -> an object providing a view on D's values

1. Cheng, W., Hüllermeier, E., & Dembczynski, K. J. (2010). Bayes optimal multilabel classification via probabilistic classifier chains. In Proceedings of the 27th international conference on machine learning (ICML-10) (pp. 279-286).
{"ft_lang_label":"__label__en","ft_lang_prob":0.59937817,"math_prob":0.8241478,"size":3080,"snap":"2023-40-2023-50","text_gpt3_token_len":827,"char_repetition_ratio":0.11443433,"word_repetition_ratio":0.06530612,"special_character_ratio":0.27435064,"punctuation_ratio":0.1763727,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9852735,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-24T11:47:16Z\",\"WARC-Record-ID\":\"<urn:uuid:4447246d-e479-4c4d-a7b5-d8e85dabc20e>\",\"Content-Length\":\"182359\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:daeefec5-3cc6-4c85-863c-f48dd8e06007>\",\"WARC-Concurrent-To\":\"<urn:uuid:3f33e66d-1564-47c2-b1d4-1275c93c8c21>\",\"WARC-IP-Address\":\"185.199.108.153\",\"WARC-Target-URI\":\"https://riverml.xyz/0.13.0/api/multioutput/ProbabilisticClassifierChain/\",\"WARC-Payload-Digest\":\"sha1:B2AMGARQQE7COJIMT5VGM7T2AM7DRTHI\",\"WARC-Block-Digest\":\"sha1:2GEGW6MNIPIG4CHO7NBZNAKD35OS2MUH\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233506632.31_warc_CC-MAIN-20230924091344-20230924121344-00836.warc.gz\"}"}