You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: tsne.rs
    path of file: ./repos/linfa/algorithms/linfa-tsne/examples
    
    the code of the file until where you have to start completion: use linfa::traits::{Fit, Transformer};
use linfa_reduction::Pca;
use linfa_tsne::{Result, TSneParams};
use std::{io::Write, process::Command};

fn main() -> Result<()> {
    let ds = linfa_datasets::iris();
    let ds = Pca::params(3).whiten(true).fit(&ds).unwrap(
    
fn main() -> Result<()> {
    let ds = linfa_datasets::iris();
    let ds = Pca::params(3).whiten(true).fit(&ds).unwrap().transform(ds);

    let ds = TSneParams::embedding_size(2)
        .perplexity(10.0)
        .approx_threshold(0.1)
        .transform(ds)?;

    let mut f = std::fs::File::create("examples/iris.dat").unwrap();

    for (x, y) in ds.sample_iter() {
        f.write_all(format!("{} {} {}\n", x[0], x[1], y).as_bytes())
            .unwrap();
    }

    Command::new("gnuplot")
        .arg("-p")
        .arg("examples/iris_plot.plt")
        .spawn()
        .expect(
            "Failed to launch gnuplot. Pleasure ensure that gnuplot is installed and on the $PATH.",
        );

    Ok(())
}