pascalabcnet/InstallerSamples/MachineLearning/09_Visualization/02_PairPlot_Iris.pas

27 lines
1 KiB
ObjectPascal
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// В этом примере строится pair plot для всех признаков датасета Iris.
//
// На диагонали расположены гистограммы отдельных признаков,
// а вне диагонали — scatter plot для всех пар признаков.
//
// Цвет точки показывает класс цветка.
uses MLABC, PlotML;
begin
var ds := Datasets.Iris;
var df := ds.Data;
// Преобразуем признаки в матрицу.
var X := df.ToMatrix(ds.Features);
// Кодируем классы в числа, чтобы раскрасить точки по видам Iris.
var y := df.EncodeLabels(ds.Target);
Println('Pair plot для датасета Iris');
Println;
Println('На диагонали показаны гистограммы признаков.');
Println('Вне диагонали показаны scatter plot для всех пар признаков.');
Plot.PairPlot(X, y, ds.Features);
end.