Struct linfa_trees::Tikz[][src]

pub struct Tikz<'a, F: Float, L: Label + Debug> { /* fields omitted */ }

Struct to print a fitted decision tree in Tex using tikz and forest.

There are two settable parameters:

  • legend: if true, a box with the names of the split features will appear in the top right of the tree
  • complete: if true, a complete and standalone Tex document will be generated; otherwise the result will an embeddable Tex tree.

Usage

use linfa::prelude::*;
use linfa_datasets;
use linfa_trees::DecisionTree;

// Load dataset
let dataset = linfa_datasets::iris();
// Fit the tree
let tree = DecisionTree::params().fit(&dataset).unwrap();
// Export to tikz
let tikz = tree.export_to_tikz().with_legend();
let latex_tree = tikz.to_string();
// Now you can write latex_tree to the preferred destination

Implementations

impl<'a, F: Float, L: Debug + Label> Tikz<'a, F, L>[src]

pub fn new(tree: &'a DecisionTree<F, L>) -> Self[src]

Creates a new Tikz structure for the decision tree with the following default parameters:

  • legend=false
  • complete=true

pub fn complete(self, complete: bool) -> Self[src]

Whether a complete Tex document should be generated

pub fn with_legend(self) -> Self[src]

Add a legend to the generated tree

Trait Implementations

impl<'a, F: Float, L: Debug + Label> Display for Tikz<'a, F, L>[src]

Auto Trait Implementations

impl<'a, F, L> RefUnwindSafe for Tikz<'a, F, L> where
    F: RefUnwindSafe,
    L: RefUnwindSafe

impl<'a, F, L> Send for Tikz<'a, F, L> where
    L: Sync

impl<'a, F, L> Sync for Tikz<'a, F, L> where
    L: Sync

impl<'a, F, L> Unpin for Tikz<'a, F, L>

impl<'a, F, L> UnwindSafe for Tikz<'a, F, L> where
    F: RefUnwindSafe,
    L: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,