MLJSerialization.jl

Author JuliaAI
Popularity
0 Stars
Updated Last
1 Year Ago
Started In
March 2021

MLJSerialization.jl

Linux Coverage
Build status codecov.io

A package adding model serialization to the MLJ machine learning framework.

Installation

using Pkg
Pkg.add("MLJ")
Pkg.add("MLJSerialization")

Sample usage

Fit and save a decision tree model:

Pkg.add("DecisionTree")

using MLJ
using MLJSerialization

X, y = @load_iris

Tree = @load DecisionTreeClassifier pkg=DecisionTree
tree = Tree()
mach = fit!(machine(tree, X, y))
MLJSerialization.save("my_machine.jlso", mach)

Retrieve the saved machine:

mach2 = machine("my_machine.jlso")

Xnew = selectrows(X, 1:3)
predict_mode(mach2, Xnew)

julia> predict_mode(mach2, Xnew)
3-element CategoricalArrays.CategoricalArray{String,1,UInt32}:
 "setosa"
 "setosa"
 "setosa"

Documentation

Documentation is provided in the Saving machines section of the MLJManual