getting started with MLJ

1. loading package and data

    import MLJ:evaluate
    using MLJ,DataFrames
    iris=load_iris()|>DataFrame
    display(first(iris,10))
10×5 DataFrame
Row sepal_length sepal_width petal_length petal_width target
Float64 Float64 Float64 Float64 Cat…
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa
5 5.0 3.6 1.4 0.2 setosa
6 5.4 3.9 1.7 0.4 setosa
7 4.6 3.4 1.4 0.3 setosa
8 5.0 3.4 1.5 0.2 setosa
9 4.4 2.9 1.4 0.2 setosa
10 4.9 3.1 1.5 0.1 setosa

2. build DecisionTree model

    y, X = unpack(iris, ==(:target); rng=123);
    Tree = @load DecisionTreeClassifier pkg=DecisionTree
    tree = Tree()
    evaluate(tree, X, y, resampling=CV(shuffle=true),
                 measures=[log_loss, accuracy],
                 verbosity=0)
[ Info: For silent loading, specify `verbosity=0`. 
import MLJDecisionTreeInterface ✔
PerformanceEvaluation object with these fields:
  model, measure, operation, measurement, per_fold,
  per_observation, fitted_params_per_fold,
  report_per_fold, train_test_rows, resampling, repeats
Extract:
┌──────────────────────┬──────────────┬─────────────┬─────────┬─────────────────
│ measure              │ operation    │ measurement │ 1.96*SE │ per_fold       ⋯
├──────────────────────┼──────────────┼─────────────┼─────────┼─────────────────
│ LogLoss(             │ predict      │ 3.12        │ 1.48    │ [2.88, 1.44, 5 ⋯
│   tol = 2.22045e-16) │              │             │         │                ⋯
│ Accuracy()           │ predict_mode │ 0.913       │ 0.041   │ [0.92, 0.96, 0 ⋯
└──────────────────────┴──────────────┴─────────────┴─────────┴─────────────────
                                                                1 column omitted