Изменения
Добавил Джява пример
'''val '''f1Score = '''new '''FMeasure().measure(predictions, y)
plot(x, y, ada)
===Пример на языке Java===
Пример классификации с применением <code>smile.classification.AdaBoost</code><ref>[https://haifengl.github.io/smile/api/java/smile/classification/AdaBoost.html/ Smile, AdaBoost]</ref>
maven зависимость:
<dependency>
<groupId>com.github.haifengl</groupId>
<artifactId>smile-core</artifactId>
<version>1.5.2</version>
</dependency>
'''import''' smile.classification.AdaBoost;
'''import''' smile.data.parser.ArffParser;
'''import''' smile.validation.Accuracy;
'''import''' smile.validation.ClassificationMeasure;
'''import''' smile.validation.FMeasure;
'''import''' java.util.Arrays;
// load train and test datasets
'''var''' arffParser = new ArffParser();
arffParser.setResponseIndex(0);
'''var''' train = arffParser.parse(this.getClass().getResourceAsStream("train.arff"));
'''var''' test = arffParser.parse(this.getClass().getResouceAsStream("test.arff"));
// create adaboost classifier
'''var''' forest = new AdaBoost(train.attributes(), train.x(), train.labels(), 200, 4);
// measure accuracy and F1-measure on test dataset
'''var''' measures = new ClassificationMeasure[]{new FMeasure(), new Accuracy()};
'''var''' results = forest.test(test.x(), test.labels(), measures);
System.out.println(Arrays.deepToString(results));
== См. также ==