Update index.md
This commit is contained in:
parent
da6bb62470
commit
a1af311955
|
|
@ -24,19 +24,18 @@ The following script fetches a dataset of tweets, trains, applies, and evaluates
|
||||||
|
|
||||||
```python
|
```python
|
||||||
import quapy as qp
|
import quapy as qp
|
||||||
from sklearn.linear_model import LogisticRegression
|
|
||||||
|
|
||||||
dataset = qp.datasets.fetch_twitter('semeval16')
|
dataset = qp.datasets.fetch_UCIBinaryDataset("yeast")
|
||||||
|
training, test = dataset.train_test
|
||||||
|
|
||||||
# create an "Adjusted Classify & Count" quantifier
|
# create an "Adjusted Classify & Count" quantifier
|
||||||
model = qp.method.aggregative.ACC(LogisticRegression())
|
model = qp.method.aggregative.ACC()
|
||||||
model.fit(dataset.training)
|
model.fit(training)
|
||||||
|
|
||||||
estim_prevalence = model.quantify(dataset.test.instances)
|
estim_prevalence = model.quantify(test.X)
|
||||||
true_prevalence = dataset.test.prevalence()
|
true_prevalence = test.prevalence()
|
||||||
|
|
||||||
error = qp.error.mae(true_prevalence, estim_prevalence)
|
error = qp.error.mae(true_prevalence, estim_prevalence)
|
||||||
|
|
||||||
print(f'Mean Absolute Error (MAE)={error:.3f}')
|
print(f'Mean Absolute Error (MAE)={error:.3f}')
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue